I have a STM32F051 driving a H-bridge (with proper gate drivers and overcurrent pulse sent back to the MCU) which power a transformer, using TIM1 and complementary signals (and dead time generation).
I am trying to configure a different "safe" state depending on which overcurrent pulse I receive:
- On high side overcurrent, turn off low side fets, turn on high side fets.
- On low side overcurrent, turn off high side fets, turn on low side fets.
Idea is to improve overcurrent performance on an inverter.
Is there a possibility to manually set the outputs of the timers to a defined state immediately when receiving a pulse on a GPIO ? I tried with the break function, but you can only set one predefined "safe" state. For my application I need two (for now, more to come).
In the end I found the result and I share it with you.
The source code and examples of libopencm3 helped me to find the answer.
Utility functions to disable and enable outputs.
Here is how to force the H bridge to short the load to ground as an example.
Hope this will be useful to someone else!