So you just finished your most recent Arduino project and are hungry to build something new and impressive. Feeling confined by the Arduino's limited environment, peripherals, and power, you begin looking around for other options, but there are too many choices. There are microcontrollers from dozens of vendors in eight-, 16-, and 32-bit flavors, each requiring its own compilers and programmers, which could add up to a fortune. Is there no cheap and viable alternative for the little blue board that has stolen all our hearts?
Enter the ARM Cortex M series of 32-bit microcontrollers. They offer a common tool chain and core design across multiple vendors. There are many ways to access the Cortex M series, from MCU vendor dev boards with built-in proprietary debuggers to professional-grade open dev boards. The open approach is the way to go.
Using vendors' proprietary dev boards will feel more like using an Arduino. The boards often come with compilers that will work only for their chips. Sometimes they even have code size restrictions. Access to the full capability of 32 bits comes from selecting a tool chain that is limitless. I won't discuss tool chain choices in this blog, except to say a nonproprietary one provides many advantages over an Arduino or similar development environment.
The most obvious thing you gain when moving up from Arduino is the power of a Cortex M. A 32-bit processor outperforms an eight-bit one running at the same speed and is often less expensive. The larger devices can also run faster. Cortex M0s, for instance, run at higher speeds than any PIC or AVR I have worked with. The 16/32-bit blend of instructions the Cortex uses also leads to a higher code density -- fitting more code into less space. With the increased processing power comes a slightly less obvious advantage: lower power consumption. Using a "hurry up and wait" strategy yields a much longer battery life, as can be seen from this video on the new Kinesis line.
Though getting the Arduino up and running is simple, one major flaw is that it has no debug environment. A good ARM tool chain will allow you to stop the core when you like and find out the state of the processor. There's no more printing variables to the serial port. You just halt the processor and look directly at whatever variable or register you want.
Choosing the Cortex M series also gives you access to variety. A good tool chain will allow you to code for everything from simple entry-level devices all the way to dual-core signal-processing monsters.
All these advantages come with some downside, especially for hobbyists. Except for the upcoming LPC1114s, which will be available in SOIC and DIP packing, almost every Cortex M is either a leaded (QFP) or leadless (QFN) package. These packages make hand soldering extremely difficult, and they make direct breadboarding with the chips impossible. Additionally, if you get stuck at any point during a project, it is generally much harder to find help, because the community for these chips is much smaller. With some experience, it is very possible to take the code from other projects and port it over, but this technique is certainly not as simple as the plug-and-play friendliness of the Arduino.
This leads to the final disadvantage of moving to 32 bits: the time required to learn a new environment. With respect to coding, the switch from eight to 32 bits is not that noticeable as long as you are coding in C or C++. The difficulty lies in the switch from the finely polished Arduino libraries to the dirty but extremely powerful CMSIS libraries. Instead of spending time browsing the Arduino Reference Website, you will most likely be combing through 500-plus-page user manuals looking up registers and what they do. This may sound daunting at first, but once you realize how much more control you gain from this, you may feel like programming with an Arduino is like taking a shower in a raincoat.
Making the move up to the Cortex M series is a serious undertaking, and it is certainly not for every hobbyist or every project. In my experience, I've gone from Arduino to PIC to Cortex Ms, and I have never looked back. When a new idea pops up, I am confident there is a chip available that will fit the bill perfectly, whether it's for a simple LED blinker or a complex USB audio player.
What can a move to 32 bits do for you?