AnsweredAssumed Answered

S08MP16 Flextimer PWM setup?

Question asked by Abhijit Jagtap on Oct 14, 2013
Latest reply on Oct 17, 2013 by Abhijit Jagtap

Hello (bigmac)

 

I am trying to output a 6 channel PWMout for a 3 phase bridge with a MP16.

For this i setup the Flextimer2 within this module for edge aligned PWM , ch0 to ch5.

This setup works okay.

Now i want to use the combine + complementary mode on all channels, so that odd numbered channels will invert the even numbered PWM pulses, and also a dead time is inserted.

I am not able to do this

 

I am adding my Init routine which i am unable to make work.(just for testing i have updated channel values with the ones shown)

 

void Timer2_init(void) {           FTM2C0SC = Channel0_Start;              FTM2C1SC = Channel0_Start; //value is 0x24             FTM2C2SC = Channel0_Start;              FTM2C3SC = Channel0_Start;              FTM2C4SC = Channel0_Start;              FTM2C5SC = Channel0_Start;    // Timer1 period       FTM2MOD = TIMER_OVERFLOW; //62.5us     FTM2MODE = 0x05 ; //WPDIS and FTMEN enabled    FTM2COMBINE0 = 0x13; //Dead time , Complementary ,combine     FTM2COMBINE1 = 0x13; //Dead time , Complementary ,combine     FTM2COMBINE2 = 0x13; //Dead time , Complementary ,combine     FTM2DEADTIME = 0x86; // 83=3us   //Initial duty cycle     FTM2C0V = FTM2C1V = FTM2C2V = FTM2C3V = FTM2C4V = FTM2C5V =  0;   //Start timer FTM2SC = 0x4A ; // for 16KHz PWM out  }   void interrupt 14 FTM2OVF (void) {         FTM2C0V = 0;         FTM2C1V = 120;//         FTM2C2V = 0;//         FTM2C3V = 140;         FTM2C4V = 0;         FTM2C5V = 160;         FTM2SC_TOF=0; } 

Outcomes