Board for 6PWM Motor Control with SPI Magnetometer

Hello, I am driving an ROB-20441 motor from sparkfun with a TMC 6300 in 6PWM mode on an Elegoo UNO R3. I was previously using an AS5600 magnetometer over I2C to monitor the angular position, but was having issues with noise and couldn’t get closed-loop control of any kind to function. I invested in an AS5047P magnetometer hoping to benefit from the increased resolution (14 vs 12bits) and the speed of SPI communication, but the SPI pins on the Uno R3 (10,11,12,13) are also required for 6PWM (3,5,6,9,10,11). My understanding is that I cannot I cannot use other pins for SPI or PWM communication unless I wish to use software SPI, in which case I am taking a performance hit.

So, my question is this: is there an MCU supported by SimpleFOC that I could simultaneously use hardware SPI and 6PWM on?

Hi @nanotrav

Welcome to the community.

The fastest and cheapest way to get there would be a Blue Pill STM32F103


1 Like

I would recommend Nucleo G474RE as well. It is cheap ($15), similar form factor to Uno R3 (including fully supported Arduino header pins), but with some more pins. It is very well suited for motor control and has a very flexible pinout.


Hi Valentine

Thanks for the speedy suggestion! Looking at pictures of the Blue Pill F103RB pinout, it appears that it also doubly assigns the SPI and PWM pins on the Arduino headers–is the benefit here that we can also use the additional Morpho headers?

1 Like

what do you mean doubly assign please?

That the pinout for the Arduino headers on the Blue Pill you suggested indicates some of the SPI pins would also be required for 6PWM, same as the Uno R3. So, how am I meant to use both SPI and 6PWM at the same time on this board? Would I utilize the additional Morpho headers (which the Uno lacks) for either SPI or PWM?

I am not sure where you are reading, but there are also alternate functions “AF” that allow for remapping of peripherals. If you can link the specific blue pill you are looking at, we can try to find a 6PWM + SPI pinout that works. Or, you can get a full size Nucleo board (F103 or G474 or other) and use any of the pins from the morpho connector to get access to more peripherals.

Sorry if I haven’t been clear–I really appreciate the help. I am looking at a Nucleo-F103RB. Here is a link to it:

Oh, when people say “blue pill” they usually mean this board, the arduino nano form factor but with F103:

In any case if you buy full size Nucleo (with the extra pins on the side) you will be able to for sure find a combination of 6PWM and SPI pins to use. But actually , the STM32F1 chips are a very old design, I really would recommend to try something better, like F3, F4, G4. Keep in mind to not get any board with less than 64k flash as it will be impossible/difficult to fit simpleFOC library on with any other application code.