Dear electronic hobbyist, If you are interested in small but powerful Arduino projects, you are going to love 644 Narrow and 1284 Narrow boards. These are basically beefed up Nano...
This question is certainly in the minds of many electronics makers:
“Should I use a 32 bits microcontroller instead of an 8 bits microcontroller ?”
As an Arduino maker I considered upgrading some designs to STM32. So I ran preliminary tests. My first surprise was that my code was using much more storage space and I had to move to devices with even more flash and RAM. The fact that these devices run in 3.3V is another concern.
I will publish a paper on how to choose the rigt MCU for Arduino projects later. For now, let’s focus on the storage capabilities and resources needed to run a program created in the Arduino IDE.
The following table shows the storage capabilities and resources needed to run blink for a couple of MCUs. Painted in green are negligible consumption of less or equal to 1% and painted in yellow are consumptions above 1%. You will certainly be quite surprised:
|Arduino Uno / Nano Arduino core||644 Narrow |
|Bootloader size (Kb)||0.5||1||1||8||16||20||20||In ROM.|
|"Blink" used Flash||930 (3%)||1122 (1%)||1214 (0%)||1460 (0%)||10624 (4%)||15828 (24%)||23516 (4%)||194472 (14%)|
|"Blink" used RAM||9 (0%)||9 (0%)||9 (0%)||9 (0%)||2732 (8%)||3088 (15%)||3244 (1%)||13332 (4%)|
So we can see that
- The code generated for all 32 bits devices is much heavier. It is even incredibly big on ESP32!
- These 32 bits MCU do not have EEPROM. They can use emulated EEPROM that consumes more flash resources.
- The more complex the MCU, the bigger the bootloader. This also reduces the available resources.
The conclusion of this raw test is that if you don’t need the extra features of 32 bits MCUs (like many communication ports, more pins, possibly faster SPI etc), but your program needs a lot of flash and RAM, it is really worth considering last generation 8 bits MCUs. These devices architecture is mature. They are running pretty well, and offer huge storage capabilities, to the opposite of what we naturally believe.