AnsweredAssumed Answered

About MPC5744P PWM Input capture

Question asked by Damon Meng on Apr 9, 2018
Hi All,
About MPC5744P PWM Input capture,it happened a question:
I select the FlexPWM_0 Auxiliary Input 2,the Pad is 102,the signal is Square,DUTY 75%,Whatever 100Hz/500Hz/1KHz/5KHz,Get CVAL0 & CVAL1 is all Fault.Please see the question.Thanks!
MC_CGM.AC0_SC.R = 0x02000000;    
MC_CGM.AC0_DC0.R = 0x80000000|(4 << 16);    
    SIUL2.MSCR[98].B.SRC = 0b00;
    SIUL2.MSCR[98].B.OBE = 0;
    SIUL2.MSCR[98].B.ODE = 0;
    SIUL2.MSCR[98].B.SMC = 0;
    SIUL2.MSCR[98].B.APC = 0;
    SIUL2.MSCR[98].B.IBE = 1;
    SIUL2.MSCR[98].B.PUS = 1;
    SIUL2.MSCR[98].B.PUE = 1;
    SIUL2.MSCR[98].B.SSS = 0b0001;
    SIUL2.IMCR[96].B.SSS = 0b0010;
    FlexPWM_0.OUTEN.R = 0x110;
    FlexPWM_0.SUB[2].CTRL1.R = 0x0400 | (3 << 4)
    FlexPWM_0.SUB[2].CTRL2.R = 0x2000;
    FlexPWM_0.SUB[2].DTCNT0.R = 0x0000;
    FlexPWM_0.SUB[2].DTCNT1.R = 0x0000;
    FlexPWM_0.SUB[2].INIT.R = 0x0;
    FlexPWM_0.SUB[2].VAL0.R = 4096/2;  // PWMX rising edge
    FlexPWM_0.SUB[2].VAL1.R = 4096;  // PWMX falling edge
    FlexPWM_0.SUB[2].DISMAP.R = 0x0000;
    FlexPWM_0.SUB[2].CAPTCMPX.B.EDGCMPX = 0b1000;

 

    FlexPWM_0.SUB[2].CAPTCTRLX.B.CFXWM = 0b00;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.EDGCNTX_EN = 0b0;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.INPSELX = 0b0;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.EDGX1 = 0b01;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.EDGX0 = 0b10;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.ONESHOTX = 0b1;
    FlexPWM_0.SUB[2].CAPTCTRLX.B.ARMX = 0b0;
    FlexPWM_0.MCTRL.B.LDOK = 0b0100;
main
    FlexPWM_0.MCTRL.B.RUN = 0b0100;

 

    for(;;)
    {

 

    FlexPWM_0.SUB[2].CAPTCTRLX.B.ARMX = 0b1;
    while(!(0x0080 & FlexPWM_0.SUB[2].STS.R)){};  // wait for capture flag X1

 

    txmsg.data[0] = 0;
    txmsg.data[1] = (FlexPWM_0.SUB[2].CVAL0.R) >> 8;
     txmsg.data[2] = FlexPWM_0.SUB[2].CVAL0.R;
    txmsg.data[3] = 0;

 

    txmsg.data[4] = 0;
     txmsg.data[5] = (FlexPWM_0.SUB[2].CVAL1.R) >> 8;
    txmsg.data[6] = FlexPWM_0.SUB[2].CVAL1.R;
    txmsg.data[7] = 0;

 


     FlexPWM_0.SUB[2].STS.R = 0x00C0; // clear CFX1/CFX0 flags
     }

Outcomes