AnsweredAssumed Answered

MPC5643L_FlexPWM_question(reload and interrupt)

Question asked by na yan on Mar 13, 2016
Latest reply on Mar 17, 2016 by Peter Vlna
  • Aboout FlexPWM

Q1:   If the VAL1 is required for register reloading and an interrupt, which will happen first, reloading or interrupt?

For example: 

 

FLEXPWM_0.SUB[0].CTRL.B.FULL = 1; // Full cycle reload

FLEXPWM_0.SUB[0].VAL[1].R = 600;     //FLEXPWM0_VAL1; // Max value for counter

FLEXPWM_0.SUB[0].TCTRL.R = 0x1;        //Enable CTU trig only for VAL1

 

      CTU.TGSISR.R = 0x00000800; // active input = PWM_EVEN0 (VAL1 - VAL3 - VAL5 OUT_TRIG1_0 )

      CTU.TGSCR.R  = 0x0000;      //triggered mode

          //Compare modulo & reload value

     CTU.T0CR.R = 0;

     CTU.TGSCRR.R = 0;

     CTU.TGSCCR.R = 1200;

 

//Trigger Handler control registers

     CTU.THCR1.R = 0x00000040;  //T0: enable

     CTU.THCR2.R = 0x00000000;  //T4-T7: disable

 

//Interrupt enable

     CTU.CTUIR.R = 0x0100;//T0 interrupt enable 

 

 

void PWM0_sub0__CTU_T0_Isr(void)

{

    ...

  FLEXPWM_0.SUB[0].VAL[2].R =x;

}

If in the k cycle , the value we read FLEXPWM_0.SUB[0].VAL[2] is 100 and the value currently using

( FLEXPWM_0.SUB[0].VAL[2]) is 200 ,

Case 1: in the k+1 cycle , the value we read FLEXPWM_0.SUB[0].VAL[2] is x and the value currently using( FLEXPWM_0.SUB[0].VAL[2]) is 100;(reload first,interrupt second)

Case 2: in the k+1 cycle , the value we read FLEXPWM_0.SUB[0].VAL[2] is x and the value currently using( FLEXPWM_0.SUB[0].VAL[2]) is x; (interrupt first, reload second)

 

Which case is right?

 

Thanks very much

Yanna

Outcomes