AnsweredAssumed Answered

TRK-MPC5604P PWM

Question asked by simbasoft on Feb 26, 2014
Latest reply on Feb 28, 2014 by simbasoft

I want to create a simple PWM generator to run on the TRK-MPC5604P evaluation board.   I used the code listed in the function initAndRunPwm() below. The counter starts but there is not any output on any of the pins (D9, D10, D11). I suspect it is caused by he fault input, D8. It is supposed to be the Fault[0] input pin. but I'm not sure how to configure it.

 

Any hints what is the issue?

===================================

void initAndRunPwm(void){

    vuint8_t  ldok_test;

 

//  SIU.PCR[56].R = ??;         // D8, Fault[0]

    SIU.PCR[57].R = 0x0600; // D9, X[0]

    SIU.PCR[58].R = 0x0600; // D10, A[0]

    SIU.PCR[59].R = 0x0600; // D11, B[0]

 

    FLEXPWM_0.OUTEN.R    = 0x0111;

    FLEXPWM_0.MASK.R     = 0x0111;

    FLEXPWM_0.SWCOUT.R   = 0x0000;

    FLEXPWM_0.DTSRCSEL.R = 0x0000;   

    FLEXPWM_0.MCTRL.R    = 0x0000;

    FLEXPWM_0.FCTRL.R    = 0x0000;   

    FLEXPWM_0.FSTS.R     = 0x0000;    

    FLEXPWM_0.FFILT.R    = 0x0000;

 

    FLEXPWM_0.SUB[0].INIT.R  = 0xFC00;   

    FLEXPWM_0.SUB[0].CTRL2.R = 0x0010;   

    FLEXPWM_0.SUB[0].CTRL.R  = 0x1400;

 

    FLEXPWM_0.SUB[0].VAL[0].R = 0x0000;

    FLEXPWM_0.SUB[0].VAL[1].R = 0x0400;

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

    FLEXPWM_0.SUB[0].VAL[3].R = 0x0200;

    FLEXPWM_0.SUB[0].VAL[4].R = 0xFE00;

    FLEXPWM_0.SUB[0].VAL[5].R = 0x0200;   

 

    FLEXPWM_0.SUB[0].OCTRL.R  = 0x0000;   

    FLEXPWM_0.SUB[0].STS.R    = 0x0000;   

    FLEXPWM_0.SUB[0].INTEN.R  = 0x0000;                                           

    FLEXPWM_0.SUB[0].DMAEN.R  = 0x0000;  

    FLEXPWM_0.SUB[0].TCTRL.R  = 0x0000;

    FLEXPWM_0.SUB[0].DISMAP.R = 0x0FFF;

    FLEXPWM_0.SUB[0].DTCNT0.R = 0x0000;

    FLEXPWM_0.SUB[0].DTCNT1.R = 0x0000;

   

    FLEXPWM_0.SUB[0].CAPTCOMPA.R = 0x0000;

    FLEXPWM_0.SUB[0].CAPTCOMPB.R = 0x0000;

    FLEXPWM_0.SUB[0].CAPTCOMPX.R = 0x0000;

   

    FLEXPWM_0.SUB[0].CAPTCTRLA.R = 0x0000; 

    FLEXPWM_0.SUB[0].CAPTCOMPA.R = 0x0000; 

 

    FLEXPWM_0.SUB[0].CAPTCTRLB.R = 0x0000;

    FLEXPWM_0.SUB[0].CAPTCOMPB.R = 0x0000;

   

    FLEXPWM_0.SUB[0].CAPTCTRLX.R = 0x0000; 

    FLEXPWM_0.SUB[0].CAPTCOMPX.R = 0x0000;

  

    ldok_test = FLEXPWM_0.MCTRL.B.LDOK;    // Read the LDOK bit field first
    FLEXPWM_0.MCTRL.B.LDOK  |= 0x0001;
    FLEXPWM_0.MCTRL.R |= 0x0100;   

 

 

}

Outcomes