Topic : Timer - One Pulse Mode

Forum : ST7/STM8

Original Post
Post Information Post
February 2, 2011 - 10:28am
Guest

Hi everyone,

I work on STM8S105... and STM8 Discovery

The story:
I would like to do 2 signals with the same duty cycle but with different phase (180°).
So I use an OPM on TIM1_CH2 and a second on TIM2_CH2.
Also, I use a trigger input TIM1_CH1 (for OPM tim1) and the same trig on TIM2_CH1 (for OPM tim2).

This programme work on TIM1 but it doesn't work on TIM2 !!!

So, I try to do a unique OPM generator using TIM2_CH2 with a trigger on TIM2_CH1 but It doesn't work !!!

Is there anyone had work on this subject ?

Code with TIM3:
TIM3_DeInit();

TIM3_TimeBaseInit(0,150);

TIM3_OC2Init(TIM3_OCMODE_PWM1,TIM3_OUTPUTSTATE_ENABLE,1,TIM3_OCPOLARITY_HIGH);

TIM3_ICInit(TIM3_CHANNEL_1,TIM3_ICPOLARITY_RISING,TIM3_ICSELECTION_INDIRECTTI,0,0);

/* TIM3_CCxCmd */
TIM3->CCER1 |= (u8)TIM3_CCER1_CC1E;

/* TIM3_SelectOnePulseMode */
TIM3->CR1 |= (u8)TIM3_CR1_OPM;

/* TIM3_Cmd */
TIM3->CR1 |= (u8)TIM3_CR1_CEN;

Thank you and best regards,
Sylvain