Stm32 MCU Selection

Hi all, I’m looking at a dual motor application using 2x SimpleFOC shields from AliExpress and a single stm32 nucleo running the code using the step/dir interface. Using standard encoder interrupts I’m expecting around 120k counts per second at top speed per motor. Currently doing my testing with a st32f411 working well with a single motor only, is it worth buying a 180MHz MCU over the f411? Or even the stm32g? Or is this a drop in the ocean in terms of processing power?

Thanks in advance!

The STM32G4 is 170MHz so that should not behave so differently from whatever 180MHz one you have in mind, but I don’t think you will get that much speed from the increased frequency. One area you could get a lot of benefit from is going to HardwareEncoder on STM32 as this entirely removes the overhead of checking the sensor, and without the consequences of high interrupt loads. I have recently been developing on the STM32G474RE Nucleo and would highly recommend it, it is cheap and quite powerful.

I think @Copper280z looked and there actually is no way to configure 2x SFOC shields on a Nucleo without having conflicting timers IIRC.

1 Like

The STM32G474RE has an external crystal occilator, as opposed to the onchip timing for the F4 boards.

I found the STM32G474RE to be slightly better at speed stability. Altho it was minimal. Worked better for my application tho.

Great to know about the STM32G474RE, will check it out. Yeh I’ve started to look into HW encoder, it seems to work but has you said there is conflicting pinout arrangements when using the standard Arduino headers. I’ve been able to work out some encoder combos that work with the HW encoder package, but I need to shift around the PWM and enable lines as well, would you have any advice on which pins are more suitable than others for the PWM signals? I’m looking at making a BOB anyway to utilise the 2 x SFOC with the stmorpho pins so any pins should be available in theory.

Great, thanks, another thumbs up for the G4!

You can’t have one timer per motor, but that’s not so much an issue with Antun’s new timer synchronization code in the dev branch.