You may have spotted a trend in these articles – we like ARM Cortex M0s!
A year on from our first post on the subject, with some high-volume designs under our belt, we’re still big fans. Of course there are the obvious things like amazing value for money (a proper 32 bit processor for 50 pence), but there are other things we like as well.
Many of our designs require that the processor spends time in low-power sleep modes, for example when running from batteries or a low-power bus. This typically requires a low-frequency low-power clock to run background tasks while asleep, and this is traditionally achieved using an external 32kHz watch crystal, as the internal RC oscillators in most low-cost micros consume too much power. However the STM32F050 has an internal low-frequency RC oscillator that consumes a microamp or so, and by using this we save the cost and real estate of the watch crystal (approx 20 pence in 3k reels). The internal (LSI) oscillator has shockingly bad tolerance, but we have code that calibrates it against the internal high-speed oscillator (HSI) which is trimmed to 1%, plenty good enough for many embedded control designs.
The timers are pretty good too – not only does it have five 16 bit timers and a 32 bit timer, it also has the SysTick timer, which it inherited from the larger Cortex devices. A regular system tick forms the heart of most real-time control systems, and traditionally with small processors (for example with Atmel AVR or PIC devices) we have generated it using one of the general purpose timers. With the Cortex devices all the hard work is done for you.
Not surprisingly, the analog peripherals are great too – for example the STM32F050 has a 12-bit analog to digital converter with up to 16 external inputs, an internal temperature sensor, and built-in battery monitoring features. Of course, like the processor core itself, the ADC is fast, doing full-resolution conversions in under a microsecond. It makes the old PICs and AVRs look positively antiquated!
And of course you get all the features normally associated with high-end micros, such as proper Flash memory handlers, a direct memory access controller (DMA), CRC checks, and a proper debug interface.
Several manufacturers offer the Cortex M0 in UFQFPN (quad flat no-lead) packages, which are a great compromise, saving a lot of PCB real estate compared to QFP devices, without introducing the PCB design and assembly challenges of BGA packages. We have been using UFQFPN32 and UFQFPN28 packages – the latter really is tiny at 4x4mm including pads. And with the internal oscillators and power management features, they need very few supporting components either, just a 3V3 supply and a couple of decoupling capacitors.
We also like the community that has sprung up around these devices, with plenty of open-source resources, and low-cost development boards. The STM32 devices appear to have a particularly widespread following, with a huge range of readily available hardware and software tools and libraries.
It makes the designer’s job much simpler if there is an obvious choice of processor for embedded control systems. Long may that continue!