- Those moving from the arduino and would like to experiment with other micro controllers.
- Hobbyists new to the field
32 bit micro controllers are different beast from the lowly 8 bit micro controllers. The 8 bit micro controllers include the PIC 8 bit series, AVR series from microchip, the notable 8051 among others. A very notable use of the 8 bit microcontrollers among hobbyists is the arduino.
To have a feel of the arduino capabilities without saying much, here are a few videos of projects completed by other people using arduino.
A good comparison and summary of the 8 bit vs 32 bit battle, which to choose? can be found in this hackaday article. I would suggest reading that article first. Now comes the big question:
If the arduino works so well then why move on to a more complex platform?
- Control-“With great power comes great responsibility”
There is a direct linear relationship between device complexity and degree of control.
This means that complexity increases with the number of items one has to handle. The STM32 among other 32 bit arm platforms allows you to have full control of your system which may be more beneficial in a professional setting as opposed to a hobby one though it increases complexity. In the STM32, the most notable of this is setting the clocks on the device.
Prior to using a device peripheral, say an on chip LCD TFT controller, one has to set up its clock (Normally given in Megahertz) prior to using the device among other settings. This helps in controlling the power consumption of the device as the power consumed . A good reference of the power dissipation in CMOS circuits can be found in this Texas Instruments article
Fig: Current draw from the power rail against frequency for AHC (Advanced high speed CMOS). From Texas instruments.
Here is a sample image of the clock distribution settings one can control in the STM32.
- Abundance of peripherals and capability
Peripherals are the items that give the microcontroller its ability to control the outside world among other functions. This is the first thing to consider when choosing a microcontroller for system design.I shall make a direct comparison of the peripherals available on the STM32 and arduino. In this case I shall use the STM32 Nucleo F446RE vs Arduino Mega.
- Core: ARM® 32-bit Cortex®-M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator™) allowing 0-wait state execution from Fl ash memory, frequency up to 180 MHz, MPU, 225 DMIPS/1.25 DMIPS/MHz (Dhrystone 2.1), and DSP instructions
- 512 kB of Flash memory
- 128 KB of SRAM
- Flexible external memory controller with up to 16-bit data bus: SRAM,PSRAM,SDRAM/LPSDR SDRAM, Flash NOR/NAND memories
- Dual mode Quad SPI interface
- LCD parallel interface, 8080/6800 modes
- Clock, reset and supply management
- 1.7 V to 3.6 V application supply and I/Os
- POR, PDR, PVD and BOR
- 4-to-26 MHz crystal oscillator
- Internal 16 MHz factory-trimmed RC (1% accuracy)
- 32 kHz oscillator for RTC with calibration
- Internal 32 kHz RC with calibration
- Low power
- Sleep, Stop and Standby modes
- VBAT supply for RTC, 20×32 bit backup registers + optional 4 KB backup SRAM
- 3×12-bit, 2.4 MSPS ADC: up to 24 channels and 7.2 MSPS in triple interleaved mode
- 2×12-bit D/A converters
- General-purpose DMA: 16-stream DMA controller with FIFOs and burst support
- Up to 17 timers: 2x watchdog, 1x SysTick timer and up to twelve 16-bit and two 32-bit timers up to 180 MHz, each with up to 4 IC/OC/PWM or pulse counter
- Debug mode
- SWD & JTAG interfaces
- Cortex®-M4 Trace Macrocell™
- Up to 114 I/O ports with interrupt capability
- Up to 111 fast I/Os up to 90 MHz
- Up to 112 5 V-tolerant I/Os
- Up to 20 communication interfaces
- Up to 4 × I2 C interfaces (SMBus/PMBus)
- Up to 4 USARTs/2 UARTs (11.25 Mbit/s, ISO7816 interface, LIN, IrDA, modem control)
- Up to 4 SPIs (45 Mbits/s), 3 with muxed I2 S for audio class accuracy via internal audio PLL or external clock
- 2 x SAI (serial audio interface)
- 2 × CAN (2.0B Active)
- SDIO interface
- Consumer electronics control (CEC) I/F
- Advanced connectivity
- USB 2.0 full-speed device/host/OTG controller with on-chip PHY
- USB 2.0 high-speed/full-speed device/host/OTG controller with dedicated DMA, on-chip full-speed PHY and ULPI
- Dedicated USB power rail enabling on-chip PHYs operation throughout the entire MCU power supply range
- 8- to 14-bit parallel camera interface up to 54 Mbytes/s
- CRC calculation unit
- RTC: subsecond accuracy, hardware calendar
- 96-bit unique ID
As can be seen the STM32 has greater advanced peripherals out of the box such as USB, ethernet among others.
- Greater computational capability per Watt
- Availability of cheap debugging tools on the STM32 and other ARM platforms compared to the arduino.
This gives one the ability to see what the program is doing and instructions it is performing in real time. Even the 15 dollar Nucleo board above has an on board debugger.
- Code portability across vendor devices
Because of (CMSIS)Cortex Micro controller Software Interface Standard. Code is more readily portable among devices belonging to different vendors. A good case for this is the recent semiconductor company mergers that have been shaking up the industry. In case you were to use an Atmel micro controller found in the arduino and Microchip acquired Atmel. If Microchip decided that it would EOL(End of life) a product line that is in your 10 thousand products, that is a bite in your posterior! Ouch. Back to design! Of course this may not happen but it is good to be open to the possibility.
As opposed to this, the same arm core that is in the STM32 can be found readily available in other vendors products such as NXP, TI among others.
The STM32 is a great device for moving onto more complex designs where the time and cost complexity of having an 8 bit solution is outweighed by the benefits of a 32 bit solution at the expense of greater complexity but more control.
Grab an STM32 Nucleo from mouser when you can.
Note: I am not affiliated to any of the aforementioned companies.