cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Output Compare mode change in STM32F4

m_a_amirian
Associate II
Posted on May 30, 2016 at 10:31

Hi!

I'm trying to run a bldc motor with stm32f407 IC. The most common method to do that is six-step mode control. I configured TIM1 in complementary mode. but as you know, timer mode must be changed during each step.

For example, TIM1 channel 1 CCx and CCxN should be in PWM1 mode in one step and it changes to forcedaction_InActive mode on the next step. My problem is that in some steps, both CCx and CCNx should be zero simultaneously and it seems there is no mode defined for that! what can i do? i tried to disable CCx and CCxN during those steps but when i do that both of them goes high! I use ''TIM_SelectOCxM() function to change the modes and TIM_CCxCmd() and TIM_CCxNCmd()  to enable and disable TIM outputs.

Thanks for your help.
3 REPLIES 3
Posted on May 31, 2016 at 06:53

> i tried to disable CCx and CCxN during those steps but when i do that both of them goes high!

Disabling timer channels does exactly what it says: it disables the outputs, i.e. makes them high-Z. What you may want is one of the Force modes (TIMx_CCMRy.CCzM=0b100 or 0b101), or a PWM mode set to its extreme, with polarity of one channel set to opposite to the polarity of other channel (TIMx_CCER.CCxP/CCxNP). TIM1 is maybe unnecessary tricky in that it has the advanced output module, see TIMx_BDTR. There is a table after TIMx_CCER's description, listing the outputs states in various settings.

JW

Walid FTITI_O
Senior II
Posted on May 31, 2016 at 18:40

Hi a.m.a,

Refer to the ''TIM_6Step'' example in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

package at this path:

STM32Cube_FW_F4_V1.12.0\Projects\STM324xG_EVAL\Examples\TIM

-Hannibal-

m_a_amirian
Associate II
Posted on June 07, 2016 at 06:48

Hi JW! and thanks to Hannibal .

I tried to use forced modes by configuring CCxE,CCxNE,CCxP,CCxNP,OISx,OISxN and OSSR,OSSI bits in different modes according to the table coming right after TIMx_CCER's description. but i didn't succeed! always at least one of them is high. I don't know what else I can do? I need help. Thank you.