AnsweredAssumed Answered

PWM change not initially happening

Question asked by Matt on Sep 14, 2015
Latest reply on Sep 14, 2015 by Matt
Hello Everybody.

I am observing some strange behavior on the scope for a PWM output. I am driving it at 800kHz with alternating high time of 400ns and 800ns.

In the TIM1_UP_TIM10_IRQHandler I am alternating the high time value: -

     if(TIM1->CCR4 == 33)
          TIM1->CCR4 = 66;     /* pulse on for 800ns */
          TIM1->CCR4 = 33;     /* pulse on for 400ns */

On the scope I am looking for 800ns - 400ns - 800ns - 400ns

But I see 800ns - 800ns - 400ns - 400ns - 800ns - 800ns - 400ns - 400ns 

Thus two pulses at each high time.

I have the Auto-reload preload disabled (TIM1->CR1 ARPE bit = 0) so it is not buffering the previous value.

I was wondering it the register write was too slow at this speed and if DMA would help?

Any help appreciated!
Thank you