cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating TL494 Full-Bridge (H-Bridge) control using STM32F103 (Blue Pill) – 180° phase-shifted PWM

Strsh
Associate

Hello everyone,

My name is Aleksandar, and this is my first time posting here.
I’m trying to simulate the operation of the TL494 controller in a full-bridge (H-bridge) configuration using an STM32F103 (Blue Pill) and STM32CubeIDE with the HAL library.
Project goal: The aim is to simulate the TL494 controller and apply it to control MOSFETs in a full-bridge (H-bridge) configuration.

The goal is to generate two PWM signals that are phase-shifted by 180°.
I would like to have full control over the switching frequency (1kHz - 200kHz) and duty cycle (5% - 45%) , and I also want to implement dead time (5%) that is proportional (percentage-based) to the frequency.

I have already tried to simulate this behavior in CubeIDE, but I couldn’t get the correct phase-shifted signals.
I would really appreciate some guidance or examples on how to properly configure the timers for this.

My question is:
Is it better to use CH1 and CH1N of a single timer (with complementary outputs), or two independent timers?

Thank you in advance for your help and advice!
This is just an introduction to my project, and I’ll likely have more questions as I move forward.

Best regards,
Aleksandar

3 REPLIES 3
Ozone
Principal II

To be honest, I have very little experience with motor control, so I can't really help in this regard.

However, the STM32F103 is one of ST's very first Cortex M3 devices.
It's release far predates Cube/HAL, thus the number of Cube examples is surely very limited.
Most examples and extensions are created with the "legacy" SPL (Standard Peripheral Library), which is still available on ST's site : https://www.st.com/en/embedded-software/stsw-stm32054.html

And, if you check, there are a lot of extension packages for motor control and other tasks available, based upon SPL (section "MCU and MPU embedded software") : https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32f1-series/stm32f103/stm32f103r8.html#tools-software

 

I suggest to either take the SPL example closest to your requirements and adapt it to your needs, or try to replicate the timer / PWM settings with Cube.

Watson_1058
Visitor

I have the same experience with you, I used to use TL494 and STM32F103C8T6 to contorl H-Bridge.

It is better to use CH1 and CH1N of a single timer. Advanced timers are designed for your purpose.

It might be hard for the F103 to generate PWM with a high frequency of up to 200 kHz. This does not mean that the F103 cannot generate it, but the general-purpose timer may lose its precision when generating high-frequency PWM. Assuming it runs at the maximum speed of 72 MHz without division, a 200 kHz PWM requires a value of “360” to be placed into the auto-reload register. This will result in a final PWM resolution of only 1/360 which is not good for contorl loop designing. Maybe F334 or G474 series are more suitable for creating high frequency PWM by using HRTIM.

 

 

mƎALLEm
ST Employee

Hello,

STM32F103 - Blue Pill is not an ST board and most probably it contains a counterfeit chip.

We suggest to use any of ST boards the NUCLEO-xxxx boards format. In your case I can suggest NUCLEO-F103RB board.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.