cancel
Showing results for 
Search instead for 
Did you mean: 

Launching RCR with center aligned PWM

michael2399
Associate II
Posted on August 29, 2017 at 08:42

Good morning,

we use the Timer 1 with Center aligned mode 3 (in CR1) to generate a pwm for generating the sinus for a field oriential control of a synchron machine. The UEV of the timer trigger the ADC with an regular sequenz. The values of the ADC are transfer to memory with the DMA2 Channel 0. If the DMA complete the interrupt service routine is starting.

We use PWM_Mode2 (in CCMRx.OC1M=7). We use RCR=1 to get only the Overflows.

For calucaltion we need the time from starting the adc sequenz to now.

In the Reference Manuell (RM0385, Rev 6) on Page 625 is written: ' if the RCR was written before launching the counter, the UEV occurs on overflow'. What means 'lauchning'. I have do some test in try-and-error menor. I found a relation between the RCR and the EGR.UG-Bit.

If a write

TIM1.RCR := 1;

TIM1.EGR := TIM1_Bits.EGR.UG;

then my Interrupt Service Routine is started with TIM1.CR.DIR=low and TIM1.CNT near 5000.

If a write

TIM1.EGR := TIM1_Bits.EGR.UG;

TIM1.RCR := 1;

then my Interrupt Service Routine is started with TIM1.CR.DIR=high and TIM1.CNT near 27600. (The value of ARR is 33600.)

If I my suggestion right the UG-Event launches the timer. Is this right?

Is there a mistake in the Datasheet of the description the RCR?

Best regards, Michael

0 REPLIES 0