2014-04-15 07:26 AM
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. Simon2014-04-15 07:33 AM
Change the pin configuration?
2014-04-15 08:00 AM
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.
2014-04-15 08:21 AM
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 output2014-04-15 08:26 AM
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.
2014-04-15 08:27 AM
I don't want to put all the 6 outputs to off state but only one branch...
2014-04-15 08:31 AM
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.
2014-04-15 08:37 AM
Try the
https://my.st.com/public/STe2ecommunities/motordriver_ics/default.aspx
?2014-04-15 08:54 AM
Ok! Thanks for the suggestion!