Close

Thoughts on ARM vs. AVR

A project log for NoteOn Smartpen

Slim, wireless, self-contained. No special paper, no base station.

Nick AmesNick Ames 08/21/2014 at 04:420 Comments

Until now, I've only used AVR microcontrollers. Although not very powerful, they have good documentation and a high-quality toolchain. (Avr-libc is fantastic.) As NoteOn will require some heavy number crunching (for a microcontroller), I equipped it with an STM32F302, which contains an ARM Cortex-M4 with a floating-point coprocessor. 

Setting up a toolchain was difficult. After trial and error, I settled on gcc-arm-embedded for the compiler and utilities with libopencm3 for chip support. (Using ST's library wasn't an option.  It comes with a restrictive license which would have prevented NoteOn from meeting the Hackaday Prize openness requirement.) I patched stm32flash to support the F302 in order to download code via the serial bootloader. (Dfu-util may work for downloading code over USB, but I haven't tried it.)

After getting the toolchain working, I found development much harder than with AVRs. The chip is more complicated, but the real issue is libopencm3's lack of documentation. (ST's terse datasheets don't help.) For the most part, the only documentation is the source code.

However, the sweet nectar of DMA, 32-bit word size, and the NVIC (interrupt controller) soothe the pain of development. While AVRs will still be my first choice for small projects, I won't hesitate to use an ARM if the chip is doing any heavy lifting.

Discussions