AnsweredAssumed Answered

PWM on MPC5674F not working

Question asked by Vincent Bergeron on May 7, 2015
Latest reply on May 11, 2015 by Petr Stancik

I am trying to output PWM en EMIOS CH4 and nothing is happening.  Here is my code:

 

initEMIOS(){

     EMIOS.MCR.B.GPRE = 63;    // Divide by 64

     EMIOS.MCR.B.GTBE = 1;      // Enable global time base

     EMIOS.MCR.B.FRZ = 1;         // Enable freeze mode when debugging

     EMIOS.MCR.B.GPREN = 1;   // Enable EMIOS Prescaler

}

 

initEMIOSCh23(){

     EMIOS.CH[23].CADR.R = 99;               // 100 clocks

     EMIOS.CH[23].CCR.B.MODE = 0x50;  // Modulus buffer counter

     EMIOS.CH[23].CCR.B.BSL = 0x3;        // All channels internal counter

     EMIOS.CH[23].CCR.B.UCPRE = 0;      // Divide by 1

     EMIOS.CH[23].CCR.B.UCPREN  = 1;  // Enable prescaler

}

 

initEMIOSCh4(){

     EMIOS.CH[4].CADR.R = 500;

     EMIOS.CH[4].CBDR.R = 1000;

     EMIOS.CH[4].CCR.B.BSL = 0;     // Use counter channel A

     EMIOS.CH[4].CCR.B.EDPOL = 1;

     EMIOS.CH[4].CCR.B.MODE = 0x20;  // OPWM

     SIU.PCR[183].R = 0x0600;    // Ouput and primary function

}

 

int main(){

 

initEMIOS();

initEMIOSCh23();

initEMIOSCh4();

 

while(1){}

 

}

Outcomes