PWM signal is inconsistent for STMF446RE - Help needed
Posted: Thu Mar 11, 2021 5:37 am
Hi All,
I'm developing a project that aims to control 3 Gimbal BLDC motors. So the MCU I selected is the STM32F446RE (Nucleo-64).
The Driver is basically a L6234 using the simpleFOCShield. This is from a community that creates and maintains an arduino library that runs BLDC motors, based on a claim that FOC makes BLDC more effiecient.
More info here -> https://www.simplefoc.com
The driver takes 3 pwm signals and 1pwm enable(optional enable).
The closed loop programming is completed using a Magnetic angle sensor, AS5048a. The data from the sensors is collected via SPI.
So, STM32F446RE has an arduino uno stack system, so it is compartiable with the shield.
Testing I have done,
Motors and drivers are fine, as I used an Arduino uno to test the other hardware and the motors runs as commanded, in both open loop/closed loop operations. So the only difference from the working setup I have is the STM32F446RE <- this is the only difference.
However, I face a few problems with the STM32. I currently have 2 boards, and both gave me different behaviours.
Board 1)
Can run the motors, however the SPI DOES NOT work.
Board 2)
The motors will not move. However, the SPI can work well. I can hook up 3 sensors and get accurate readings from them.
The codes that run the 2 STM32F446RE and Arduino Uno are the same, so the Uno proves that the codes is not in error. (using the same pins etc)
I understand the difference bwt the PWM signals of the Uno and the STM32 is the voltage and frequency. As I just started using the STM32 (just for a few days actually) I'm suspecting the the pwm signal is causing the problem. I tried using different PWM outputs from the STM32 board that cannot run the motors (i.e. board 2)and I sometimes get it to vibrate between two points instead of a continuous motion.
I do noticed that in order to get better SPI data, I actually have to make some changes to the SPI setting for the working SPI board. This was due to the frequency mostly.
Any help or any guidance in solving this problem (PWM) is much appreciated.
I'm developing a project that aims to control 3 Gimbal BLDC motors. So the MCU I selected is the STM32F446RE (Nucleo-64).
The Driver is basically a L6234 using the simpleFOCShield. This is from a community that creates and maintains an arduino library that runs BLDC motors, based on a claim that FOC makes BLDC more effiecient.
More info here -> https://www.simplefoc.com
The driver takes 3 pwm signals and 1pwm enable(optional enable).
The closed loop programming is completed using a Magnetic angle sensor, AS5048a. The data from the sensors is collected via SPI.
So, STM32F446RE has an arduino uno stack system, so it is compartiable with the shield.
Testing I have done,
Motors and drivers are fine, as I used an Arduino uno to test the other hardware and the motors runs as commanded, in both open loop/closed loop operations. So the only difference from the working setup I have is the STM32F446RE <- this is the only difference.
However, I face a few problems with the STM32. I currently have 2 boards, and both gave me different behaviours.
Board 1)
Can run the motors, however the SPI DOES NOT work.
Board 2)
The motors will not move. However, the SPI can work well. I can hook up 3 sensors and get accurate readings from them.
The codes that run the 2 STM32F446RE and Arduino Uno are the same, so the Uno proves that the codes is not in error. (using the same pins etc)
I understand the difference bwt the PWM signals of the Uno and the STM32 is the voltage and frequency. As I just started using the STM32 (just for a few days actually) I'm suspecting the the pwm signal is causing the problem. I tried using different PWM outputs from the STM32 board that cannot run the motors (i.e. board 2)and I sometimes get it to vibrate between two points instead of a continuous motion.
I do noticed that in order to get better SPI data, I actually have to make some changes to the SPI setting for the working SPI board. This was due to the frequency mostly.
Any help or any guidance in solving this problem (PWM) is much appreciated.