AnsweredAssumed Answered

Timer output compare channel frequency problem

Question asked by code.xinyan on Sep 11, 2016
Latest reply on Sep 11, 2016 by Clive One
Hi, everyone,

I am using STM32F407, want to output a PWM signal using Timer 1 output compare function. the system clock rate is 168MHz, and input clock of Timer 1 is also 168MHz, no clock division applied.

in TIM1_CC_IRQHandler() ISR, I update CCR1 with the operations like this:
GPIO_ToggleBits( GPIOD, GPIO_Pin_15 );    //toggle a output signal
capture = TIM_GetCapture1( TIM1 );
TIM_SetCompare1( TIM1, capture + CCR1_value);

When CCR1_Value is larger than 250, the output PWM signal is correct, period and duty cycle are all correct. But when CCR1_value is lower than 200, the Period and duty cycle of PWM is wrong. it seems the timer can not handle so fast change.

Does anybody have some experience on this point? thank you for any suggestion and comments.