Multiple SimpleFocMini with Nucleo F446

Hi, I want to use a Nucleo F446 with 2 (or 3) SimpleFocMini drivers. To choose the PWM pins, can I pick them randomly or do I have to take in account the Timer Numbers (and if so, how do I choose the Timer numbers)?

You’ll need to chose the pins carefully. To do this, you’ll want to use cube ide’s pinout configuration tool to select the pins. I’ve put your board into it (NUCLEO-F446RE presumably) and it looks like TIM1 and TIM8 are the most capable - they can do 6PWM (or 3PWM). Whilst TIM2, TIM3, TIM4 are less capable (they can only do 3PWM).

Here is me playing with some of the timer configs:

You can see in picture I’m on TIM1 config and have set it up for 6PWM by setting tim1ch1, tim1ch2, tim1ch3 to all be PWM Generation CHx + CHxN. If I wanted 3PWM, I’d just set the three channels of TIM1 to PWM Generation CHx.

Lets say you want to use 3PWM to drive three motors using TIM1, TIM8 and TIM2, you might chose:

TIM1: PA8, PA9, PA10 for motor1 
TIM8: PC6, PC7, PC8 for motor2
TIM2: PA0, PA1, PB10 for motor3

I really do recommend you try this out for yourself as other choices might make the above unworkable. e.g. you may want to use SPI or ADC, etc which could conflict with the choices above (see the little yellow triangles in the picture).
FYI The above timers conflict with SPI1 and SPI2 but SPI3 is available.

If you don’t want to install cubeide you can get the same info from the stm32duino github variant files (PeripheralPins.c) - but this approach won’t make the conflicts obvious.
e.g. This tells you that PA8 can be used for TIM1_CH1


I’ll add the following to Owen’s excellent explanation:

to make it easier to see which pins are being used, add:


to the start of your setup, and add the following to your build flags:


Then SimpleFOC will print all the timers and channels it is deciding to use to the serial console of your Nucleo’s ST-Link USB connection.