cancel
Showing results for 
Search instead for 
Did you mean: 

Just how powerful are STM32s?

Andrew Crawford
Associate II

I'm sure this is a pretty loaded question, especially considering that there are a range of them out there now, plus I'm sure it also varies based on application(s), ​im just curious because I am coming from an Arduino world (and going to school to get into working with microcontrollers professionally) but still fairly new at that, and next to an Arduino it seems like there would be quite a difference.

The particular model I have is an SSTM32F407VET6, which when comparing to the largest arduino board, everything is pretty comparable except it has something like 10x the SRAM? (SRAM may not be the correct terminology as I know the ARM architecture is different, just not sure how, but if not SRAM whatever memory type/function is similar).

Does this mean that it can simply 'do more work' as it has more on hand space to do so? If I am mistaken, how would does this affect performance/development potential?

I​ also saw that STM32CubeMX has its own AI package available, which is something I am very interested in as I am building a robot, eventually looking to graduate off of Arduino boards and likely onto standalone controllers (possibly STM32s). Is this something that requires a certain size controller to use, or can it be used with any?

8 REPLIES 8
S.Ma
Principal

There are many STM32 with various flavours and memory sizes.

In microcontroller space, usually the goal is to avoid external memories unless justified.

The size of Flash and SRAM in the MCU depends on the needs.

Example: Dual Bank Flash allows SW upgrade and keep previous version in case upgrade fails.

Add an RTOS, add some middleware such as connectivity with encryption, the RAM and Flash budget will inflate.

Next compromise will be between performance and power consumption if the application is battery operated. As a middle ground, STM32L496 is quite a good balanced device to play with.

As KIC said, there are several families of STM32, covering a wide range of performances and capabilities.

Speaking of STM32F407 versus some of the ATMegaXX AVR mcus in Arduinos, besides having significatnly more FLASH and RAM, the STM32 also runs at roughly 10x higher clock and performs 32-bit arithmetics in a single cycle. There is also a different approach how peripherals are handled - if they need to transfer data without processing, which is quite typical for communication peripherals, they can do so using DMA units, with only occasional intervention of the CPU - in other words, the DMA offloads certain tasks from the CPU.

The overall "increase" in performance is difficult to judge as it heavily depends on the particular task and the way how it is implemented, but broadly and very roughly speaking, the STM32 is like 10x more powerful than the ATMegaXX.

JW

S.Ma
Principal

If coming from school and contemplating jobs, maybe look at products using stm32 to find out where they hide. One way is to search the web with stm32 teardown ...

Andrew Crawford
Associate II

Ah, thanks so much! Yeah, from what Ive gathered the Arduino controllers cant really handle an RTOS very well as the atmel chips are just too limited (i have seen one or two RTOSs people have made, but I am not sure the limitations and it seems something that isn't as widely available or used considering the hardware limitations), I just wasn't sure how or why an STM32 would be more fit to handle it, but that makes perfect sense, thanks!

Also, I read somewhere that Arduino/Atmel are to hobbyists what STM32s are to actual industry use, just needed a little more ​info to put it into perspective. I am not so concerned with seeing where they are used for the purposes of finding a job, I am just curious to know the capabilities when considering my own projects (and direction). I wouldn't want to limit myself to using Atmel chips if the next logical step would be to move on to using an STM32 (and if it would be more fit for the task). And as for teardowns, I tried looking up STM32 projects but only found things comparable to Arduino capabilitie, but also wasn't sure because I know the range of controllers varies as well as being able to use multiple together, so again, just needed to put it a bit more into perspective. But that is very helpful, thanks again!

> Also, I read somewhere that Arduino/Atmel are to hobbyists what STM32s are to actual industry use,

You'll come across assertions like these, especially in school setting; and always watch out for those who say this, as it's likely to be a sign of incompetence (although sometimes it's just a result of the aggressive marketing of the mcu manufacturers, who simply want to push through the more costly 32-bitters). While Arduino is a platform originally intended for artists and is indeed hobbyist-centric, AVRs are very capable 8-bit microcontrollers (also note, that Atmel is a name of a company and can't refer to a microcontroller family, as they produced a range of very different microcontroller families, from the now gone 4-bit MARC-4 through 8-bit AVRs and '51 to 32-bit ARMs and AVR32s, plus some specialties too -- and then Atmel itself has been gulped by Microchip a couple of years ago, too). And 8-bitters are still the workhorse of the industry, whoever and whatever thinks about this. The 8-bitters and 32-bitters simply fit a different group of tasks. There are also merits in the 8-bitters which make them a better choice for various tasks, e.g. they often allow wide power supply, precise timing is more easily controlled - and then of course the cost is generally lower, too.

JW

Jack Peacock_2
Senior III

"Powerful" is a relative term, depending on what is to be accomplished. A 32-bit CPU running at 200MHz is far more powerful than an 8-bit at 4MHz, but if all you're doing is tripping a relay when a photo-transistor level changes all that extra processing power, and cost, is wasted. Multiply it by 100K units/month and a $1 difference is substantial. The cheaper 8-bit is more "economically powerful" in that case.

In the commercial world it all comes down to the economics. Low volume, development costs are substantial so a 32-bit with large memory, good C compiler and library tools, those tip the scale in favor of an STM32. High volume, simple application, even a lowly PIC or AVR might be the best choice, though development cost per line of code could be 5x that of an ARM processor.

Moore's Law is still working in favor of controllers. ARM Cortex parts, especially the M0, are getting cheaper all the time. It's getting harder to justify an 8-bit new design when the price gap is shrinking. And at the other end the high end Cortex A series is now creeping into the controller market with the A7. If an application requires internet and graphics front ending a control system there's only one real way to go now, dual M and A series in one IC, leaving the 8 and 16 bit world far behind.

So "powerful" is in the app more than the chip. I use the STM32, but I don't run it at anywhere near max clock rate. Quite the reverse, I try to slow it down as much as possible to conserve battery power. "Powerful" for my needs is how well it runs in a battery environment. A good RTOS and plenty of flash are far more important than clock speed, though the 32-bit arithmetic and the M4 DSP instructions also goes a long way in keeping down CPU cycles.

As for what size STM32 for a robot, start looking at the STM32L4 and STM32L5 (new M33) lines. You need a low power controller more than a fast one. Doesn't matter how fast your robot reacts if the battery is dead. Battery designs can be tricky, so focus on that type of design. Efficiency and current leakage are what's important, not raw speed.

Can you distribute your application across multiple controllers? In that case look at the STM32L0 line for localized control, with a simple network (i.e. RS-485 or CAN) to a central host. Only turn on the parts you need, instead of everything running all the time.

The low power modes in Cortex M parts work well but takes some time to learn. Battery life can be dramatically extended if you can properly manage low power sleep, stop and standby.

No comment on CubeMX. If it fits and gets you running quickly, then go with it but accept the limitations.

Jack Peacock

Good summary Jack.

Sometime the typical question of "what's the difference between MCU and MPU?" some too (for beefier processors). While the lines are blurring over time due to process integration, I would say:

  • Low power ("battery wise, what runs a day on android, runs a week on embedded MCU")
  • Most of the time all memories are in the same chip (except EEPROM and Frame buffers)
  • Analog built-in functions (ADC/DAC/Comparators/OpAmp/Oscillators)
  • Typically no Memory Management Unit on MCU

Andrew Crawford
Associate II

Awesome, thank you both, that's very helpful!​