2025-04-11 7:25 PM
Hello people,
I'm a newborn baby in this microcontroller world, I'm hoping in getting some help with my current project and know if it's possible to do it first of all. I did a program to control a BLDC motor in a simple Nucleo board using an ADC channel and PWM output. Then I bought an STM32F4291 and I'm trying to implement the gauge widget animation with the same purpose of controlling a BLDC. I have the Widget running thanks to a good video in YouTube but I'm struggling in adding the PWM output to the project. Does my PWM function needs to be in ScreenView.cpp , Model.cpp etc? Can I use the same value that I'm getting from the gauge? I don't exactly what to do, I did try the main loop but didn't work.
Thank You for your time!
2025-04-14 2:38 AM
Hello @Abucio24 ,
To control a BLDC motor you have a few solution.
You say you have an STM32F4291, I assume that you have bought a discovery board STM32F429i-DK and used the available TBS in TouchGFX Designer to create your project.
This TBS uses FreeRTOS to share the MCU usage to various tasks such as the TouchGFX task or the communication tasks.
This is why the code you put in the main loop is never executed : with an RTOS, the main loop is never reached.
Instead you have 2 solutions :
Regards,
2025-04-14 2:49 AM
Hi Gaetan!
Thanks for the reply, indeed I read the documentation, and I already did my code using FreeRTOS I did obtain the PWM signal required for running the motor, but it has a lower peak voltage than my Nucleo Board. I'm wondering if it is due to the task scheduler, or the board is not capable of giving the same voltage as the Nucleo (L476RG) ?
Thanks for the help!
2025-04-14 4:17 AM
I don't see why a pin from an STM32F4 would have lower voltage than a pin from a STM32L4.
Can you check the pin in STM32CubeMX and in the documentation, make sure this pin is not limited in voltage or power.
Also, can you try to use a different pin?
Regards,