STSPIN32F3201 / STM32F031 does not work

Dear SimpleFOC Community,

I’ve a few years ago succesfully powered up an old small 42V 3-phase induction linear actuator motor (mostly used in german pipe organs from the 60’s to the 80’s as slider actuator), using simpleFOC, a blue pill and two old school stepper driver IC’s. It just worked as a charm on the bench.

I planned to do something more professional, so I dusted the project off, and ordered a more capable devkit from STM including all bridges and drivers, an STEVAL-SPIN3201. I was struggling with the original firmware package which comes with it. Even though it spinned the motor, after reaching the desired speed, immediately stopped with some errors, as it’s not a BLDC motor, so I tried to bring the project back to SimpleFOC which just operated fine in my first experiment. I just want to generate a simple open loop PWM based V/F drive, and stop the motor as the slider is moved to the desidered position, which appoximately takes a second, and a dozen of revs.

Two problems I encountered, which are software related: in PlatformIO, I must find an existing header which can be run on the target. Its only a Nucleo board with an STM32F031K6 (same core, same RAM and FLASH, but with less GPIO count), while the STSPIN has a built-in STM32F031C6T with some GPIO’s hardwired to the integrated MOSFET drivers. I could overcome this problem. Fortunately, the missing GPIO’s are still accessible via software, as in the PlatformIO / STM32Dunio, the headers are present for the whole F031 series, so it would not be a show stopper at the moment, a working code for this MCU can be compiled with PlatformIO.

After installing SimpleFOC into the project, I got error messages related to the ADC subsystem, like “.pio\libdeps\nucleo_f031k6\Simple FOC\src\current_sense\hardware_specific\stm32\stm32_adc_utils.cpp:400:52: error: ‘ADC_INJECTED_RANK_1’ was not declared in this scope”

Opened the project folder, and I did not see any examples or configurations for STM32F0xx series.

Can you fix this issue? On the picture attached, there’s the GPIO layout of this evaluation board generated by the original STM software studio, which should be used with the 6PWM mode of simpleFOC.

Thanks, Peter

I don’t know how to fix it, but there is a github issue about it [BUG] STM32 F0 - ADC_INJECTED_RANK_1 not declared · Issue #501 · simplefoc/Arduino-FOC · GitHub

Thanks, so it’s an already known bug. So I would suggest adding this STSPIN3201 devkit as a nice all-in-one evaluation board for simpleFOC. It’s perfect for the most of small low voltage BLDC motors, with an ingegrated ST-Link and USB UART.