cancel
Showing results for 
Search instead for 
Did you mean: 

Using the comparator + break input to control the complementary output in the advanced control timer

Hi all,

I am working on a project where we are using the advanced control timer to control a motor in half-bridge (with both outputs of channel 1, OC & OCN), and we are already using the OCxRef-clear feature to control the maximum allowed current (using the COMP1 & DAC to limit it), but in addition to it we also need to disable the OCN output when the current reach's a minimum value, for this I want to use the COMP2 in window mode, and use the output of the comparator to disable the OCN output using maybe the break feature with the AOE enabled (which would reeanble the timer output at each new PWM cycle), but I am having trouble to put it to work, and reading the documentation I found the following statement:

"The PWM signal is not allowed to resume its configured duty-cycle until the beginning of a new PWM cycle. If the current drawn is still higher than the threshold, the PWM signal will continue to be at low state until the next PWM cycle and so on."

(from https://www.st.com/content/ccc/resource/technical/document/application_note/group0/91/01/84/3f/7c/67/41/3f/DM00236305/files/DM00236305.pdf/jcr:content/translations/en.DM00236305.pdf)

So it means that if I use the comparator to trig the break feature when the current goes bellow a certain level (changing the polarity) I will not be able to reenable to PWM output at the next cycle if the current still bellow the threshold, even if the AOE bit is set, correct? is there anyway of forcing it to restart?

Here are my probed signals:

0690X000008B1mVQAS.png

The yellow signal is the high side PWM

The green signal is the load voltage

The purple signal is the low side complementary PWM

The cyan signal is the COMP2 output, which is blanked with the same period of the duty cycle and go low as soon the signal crosses the minimum threshold (white line crossing the green)

What I need is to find a way of "ANDing" the complementary output (purple) with the COMP2 output (cyan) in software, anyone else had this need? is there any other way of doing it with the timer peripheral?

PS: I am using the STM32G071KB part

Thanks!

0 REPLIES 0