Electronics > Microcontrollers

Choosing a MCU

(1/9) > >>


In the past I have used some PIC or TI C2000 MCU, but I never had to choose it as I would simply used what the company has.

For a personnal project, I now have this opportunity and I don't really now how to choose a processor.

Here is what I need (absolute minimum):
   - 2x SPI interface
   - 1x I2C interface
   - 16x GPIO (included 3x SPI chip select) (1x quadrature decoder optionnal)

In term of processing power, I don't really know how to evalute that. But the main task will be to read two SPI 24bit ADC at max 10ksps, and performing some calculation on these data. This include doing an FFT on both channel with a windows of 200ms.

I can reduce to 5ksps if the memory requirement get out of hand. Adding external RAM is also possible as I am still developing the board.

My past experience with a PIC18F and an ICD2 was not so good due to constant communication problem. Using CCS, a F28377 and a blackhawk programmer was much better.

As I have nothing at home, I am willing to invest and get a programmer. The real question is more for which MCU??? I am open to get either a bare MCU from any supplier, a dev board or one of this board with a mcu and a few parts to make it easily usable.

How do you guys choose your platform? Is there some kind of hobbyist "standard"?


--- Quote from: Hawaka on April 24, 2022, 01:10:45 pm ---For a personnal project, I now have this opportunity and I don't really now how to choose a processor.

--- End quote ---

It's easier than ever: you buy what is available. Now you have maybe 1% of the choice you used to.

It won't get any better at least in a year or so.

Assuming ARM, being tool agnostic and knowing how to use standard backend (GNU) tools instead of manufacturer IDEs has proven more important than ever, as this makes jumping between manufacturers easier. This leaves only one variable: peripherals. You still have some learning curve with each and every documentation writing style etc.

Really, if possible, pick ARM, because then you can re-use a significant part of the learning curve; same CPU, same compilers, same tools, same linker scripts, same interrupt controller. In your example, only the code related to SPI, I2C and GPIO would change between manufactures, but projects would be managed with exact same software, and even the same codebase could be compiled for different manufacturers.

It sounds like a lot of MCUs will do what you want.

Your data processing and FFT requirements are a bit nebulous.

One key difference might be whether you intend to use integer or floating point data storage and FFT since the floating point performance and sample conversion and dynamic range will matter with your choice.

But still even a fast Cortex M4F has a single precision FPU and you can check the 200ms * N S/s FFT benchmarks on it to get an idea of the capability and it might be fine.

For buying a developer kit it is not that much of a problem since with some patience and flexibility of choice you can probably find one for some cost, but even developer boards are not necessarily in good supply these days due to the IC shortage.

If you want to buy more MCUs or developer boards in the next months or year you might want to consider availability and cost as factors because lots of MCUs have very small availability at very inflated prices and very long (year+?) lead times.

On the other hand if you don't care about MCU cost if you just need to pick a capable one for R&D without needing to economize on chip volume pricing / availability, I don't see why you wouldn't choose a very highly capable MCU or SOC if the cost difference for a single kit / chip is not significant and maybe the development process will be easier with a more powerful chip.

One possible approach is to use a RTOS, for instance, and maybe even you could use multiple cores to ease programming and debugging and enable using more rich middleware / libraries even if a single core "barely fast enough" MCU might work with more effort and limitations.

For instance the STM32MP1 series has both an ARM-Cortex-A CPU (single or multi core)  and ARM Cortex-M MCU cores and has all the power of memory and processing and OS / RTOS capability you could want to ease development.
Surely excessive cost / complexity if you need 100,000 units, but for a development tool, who cares, make it easy.

The Cortex-M7 or M33 are usually more powerful / new chip options and are represented by various vendors' popular MCUs which are probably going to have ample MIPS / MFLOPS / memory etc.


Similarly the I.MXRT has some powerful chips, and the teensy board series includes an option with a Cortex-M7:

You might also consider middleware and RTOS options.  The support pages for FreeRTOS, Zephyr, et. al. list what kinds of kits they have some specific support for, so that can inform your choice.

And if you want to use something like MBED, Arduino, or other such tools then those will have certain platforms they work well with.

Of course you might want to consider how to make the code pieces more portable which might involve some kinds of libraries or RTOS or C++ or other assistive frameworks which can run both on MCU as well as on desktop PC and allow you to do development and debugging of parts of the system on a non embedded platform and then move the relevant parts to the MCU with basically zero code changes e.g. if you used ISO standard C / C++ or so on and the MCU hardware dependent layers are abstracted through interfaces.

If you can get a STM32H7xx demonstration board it's pretty easy to get started. The download and debugging interface is included and there is free software on the web. There are various offers, with TFT (Disco) or without (Nucleo). The processor is rather powerful. Arm Cortex architecture includes a DSP instruction set.
Another choice would be a Raspberry PI. Those are cheap and even more powerful when used with a solid power supply, yet one needs to learn more to successfully develop and integrate the application with Linux and NEON. I think RPIs outperform any C2000. And you can develop and debug on the machine itself.

Regards, Dieter

There are vastly different philsophies for choosing a microcontroller family.

Some people like to hunt down cents on the hardware, while others find availability of tools and support more important.

For me it's quite simple, It has to be able to run GCC (maybe SDCC is also acceptable) and tools must be available for Linux, and programmers have to cheap and easily obtainable. I won't pay EUR 100 for a programmer or debugger!

I do not mind gross overkill. I'd be happy to use an STM32 @100MHz to blink a LED, that is, if it's possible to buy them at all.

I started a long time ago with microcontrollers, long before "arduino" existed. I first dabbled a bit with PIC16F84, did not like assembly at all, and as soon as I found out that the AVR microcontrollers could be programmed in C, I switched to the AVR microcontrollers. I have a quite big dislike of Atmel (now Microchip) using a different programming protocol every 3 years, so for the AVR's I just stick to the old chips such as the ATMEGA8, ATMEGA32 and ATMEGA328 and similar chips. (I avoid all the "tinies" because of peripheral incompatibilities). and for some 15+ years I was quite content with those microcontrollers.

Then came a time I wanted to try something new, and after lots of mind boggling complications I settled on the STM32.
It fits the bill in that it works with GCC (so do many others), and at that time the "Blue Pills" were cheap and reliable (Now they are kaput, don't buy the "Blue Pills" anymore).
STM32 IC's are also very popular in losts of other Chinese stuff. for example:
* Gophert Power supplies.
* JDS6600 function generator.
* Drok / Juntek power supplies.
* FN2 compatible PLC boards (Great buy, EUR25 for STM32 with hardened power supply and IO!!!)
* Owon xxx1041 "benchtop" DMM.
* Lots of PCB's for 3D printers.
* Nextion TFT LCD's have an STM32 on their back (and can be repurposed if you want...).
* Motor controllers such as VESC, O-drive and lots of small chinese ESC boards.
* Lots of other stuff...

Getting an STM32 to do something useful was an enormous struggle though. Those microcontrollers are indeed a bit more complex then the 8-bitters, but you can ignore a lot of it (such as DMA) if you don't need it. The most important thing to remember is that you have to enable clocks for almost each peripheral separately. Most of the complication with STM32 comes from ST which tries to force their configuration tools on you, and on a myriad of other choices you have to make (mbed, stm32duino, platformio, home brew, and 10+others)

I do not agree completely wit Siwastaya.
Availability of microcontrollers is probably more then an order of magnitude lower.
Last time I checked the "available" checkbox, my choice went from 600+ devices to zero.
So at the moment it's really anything you can get your hands on.
If you can get a handfull of microcontollers (and a programmer) via your job, then go for it.

For hobby level it's not so bad though.
Prices of breadboard compatible uC' development boards have also gone up from "China Direct", but they are still available.
The "Blue Pill" is dead because of a myriad (at least 8 different) clones, which all have their own little quircks, and the Chinese erase the partnumbers and print "stm32" on it, and I have no intention on wasting my time in those incompatibilities.

Before it got as bad as it is now I bought a bunch of WeAct STM32F411 boards. I've got about 20 of them for EUR 7.5 each so I have enough headroom to sit out the shortage. (It's just hobby for me). I just checked, and these have currently also doubled in price, but are still available.

Teensies are also going out of stock now.
ESP32 and ESP8266 have also doubled or tripled in price, but are apparently still available.
I expect this chip shortage to get a lot worse before it gets better.
It seems people are now getting desperate to get anything at whatever price.
Doing a bit of hoarding yourself is probably the only ting you can do.
Think of some uC that ticks most of your boxes, looks reasonable and is still available, and then buy 10+ of them before stock runs out to sit out the shortage for the next one or two years.

Lots of new chip factories are being built now, but they take 2 to 5 year before production starts.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version