cancel
Showing results for 
Search instead for 
Did you mean: 

PWM: drive output low in disabled mode

stinguely
Associate II
Posted on April 15, 2014 at 16:26

I'm using TIM1 for a 6-step motor control on a STM32F2xx. According of the table 4 in DM0004234 application note, I update OCxE and OCxNE at each commutation, to select a new step. When OCxE = 0 and OCxNE = 0, the output is disabled. In this case, the output seems to be in high impedance. I would rather have it in OFF-state (low Z). Is there a way to get this result?

Thanks for your help.

Simon
8 REPLIES 8
Posted on April 15, 2014 at 16:33

Change the pin configuration?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stinguely
Associate II
Posted on April 15, 2014 at 17:00

You mean switch the GPIO_mode to GPIO_Mode_OUT instead of GPIO_Mode_AF? I wanted to avoid this option if there is an alternative.

chen
Associate II
Posted on April 15, 2014 at 17:21

Hi

You can change the CNT reg of the counter to what ever you like (you may want to disable the TIM if you want it to stop counting).

Change the value to greater/less than CMRR to change between high/low output

Posted on April 15, 2014 at 17:26

Motors really aren't my thing, can't you play games with the enable, polarity and idle settings?

/* Channel 1, 2,3 and 4 Configuration in PWM mode */
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
TIM_OCInitStructure.TIM_Pulse = 2047;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Set;

If I wanted to tri-state the pins I'd pick an INPUT mode.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stinguely
Associate II
Posted on April 15, 2014 at 17:27

I don't want to put all the 6 outputs to off state but only one branch...

stinguely
Associate II
Posted on April 15, 2014 at 17:31

Ok, that's ST example, but when you put OCxE = 0 and OCxNE = 0, the corresponding output are in tri-state. I would prefer to have them in low impedance, to actively force the MOS OFF.

Posted on April 15, 2014 at 17:37

Try the

https://my.st.com/public/STe2ecommunities/motordriver_ics/default.aspx

?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stinguely
Associate II
Posted on April 15, 2014 at 17:54

Ok! Thanks for the suggestion!