Audience:

  1. Those moving from the arduino and would like to experiment with other micro controllers.
  2. 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

ti_cmos_cpd-fs8

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.

screenshot-from-2017-02-19-11-30-55-fs8

  • 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.

STM32 nucleo

en-nucleo-lx

  • 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
  • Memories
    • 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
    • SPDIF-Rx
    • 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

Arduino Mega-R3

 

arduinomega2560_r3_front

 

8-Bit Microcontroller
•Advanced RISC Architecture
– 135 Powerful Instructions – Most Single Clock Cycle Execution
– 32 × 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16MHz
– On-Chip 2-cycle Multiplier
•High Endurance Non-volatile Memory Segments
– 64K/128K/256KBytes of In-System Self-Programmable Flash
– 4Kbytes EEPROM
– 8Kbytes Internal SRAM
– Write/Erase Cycles:10,000 Flash/100,000 EEPROM
– Optional Boot Code Section with Independent Lock Bits
• In-System Programming by On-chip Boot Program
• True Read-While-Write Operation
– Programming Lock for Software Security
• Endurance: Up to 64Kbytes Optional External Memory Space
JTAG (IEEE®std. 1149.1 compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EE
PROM, Fuses, and Lock Bits through the JTAG Interface
•Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode
– Four 16-bit Timer/Counter with Separate Prescaler,
Compare- and Capture Mode
– Real Time Counter with Separate Oscillator
– Four 8-bit PWM Channels
– Six/Twelve PWM Channels with Programmable Resolution from 2 to 16 Bits
(ATmega1281/2561, ATmega640/1280/2560)
– Output Compare Modulator
– 8/16-channel, 10-bit ADC (ATmeg
a1281/2561, ATmega640/1280/2560)
– Two/Four Programmable Serial USART (ATmega1281/256
1, ATmega640/1280/2560)
– Master/Slave SPI Serial Interface
– Byte Oriented 2-wire Serial Interface
– Programmable Watchdog Timer with
Separate On-chip Oscillator
– On-chip Analog Comparator
– Interrupt and Wake-up on Pin Change
•Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby,
and Extended Standby

 

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.

Final thoughts

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.

 

 

 

 

 

 

 

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s