AnsweredAssumed Answered

MPC5604P Pictus FlexPWM Trouble

Question asked by Pascal Schroeder on Oct 13, 2009
Latest reply on Aug 19, 2011 by Mohamed Osama

Hello,

 

i tried to configure a simple PWM-output, but it doesn't work. Thats the mess I did:

1) i use a 40 MHz xtal and set the PLL0 to 64MHz. the PLL0 is activated for the RUN0-mode and the peripherals are active too also using PLL0.

 

2) activate alternative mode 2 and enable output-buffer for pads 10 (FlexPWM_0 B[0]) and 11 (FlexPWM_0 A[0])

SIU.PCR[10].R = 0x0A0C;
SIU.PCR[11].R = 0x0A0C;

 

3) set INIT and VALx values for a center-aligned PWM-output

FLEXPWM_0.SUB[0].INIT.R = 0xFF00;
FLEXPWM_0.SUB[0].VAL[0].R = 0x0000;
FLEXPWM_0.SUB[0].VAL[1].R = 0x0100;
FLEXPWM_0.SUB[0].VAL[2].R = 0x4000;
FLEXPWM_0.SUB[0].VAL[3].R = 0xC000;
FLEXPWM_0.SUB[0].VAL[4].R = 0x2000;
FLEXPWM_0.SUB[0].VAL[5].R = 0xE000;

 

4) use the independent mode and a 128x-prescaler for the FlexPWM-clock

FLEXPWM_0.SUB[0].CTRL2.B.INDEP = 1;
FLEXPWM_0.SUB[0].CTRL.B.PRSC = 0x07;

 

5) i finally activated PWMA and PWMB, set the LDOK-bit and afterwards the RUN-bit

FLEXPWM_0.OUTEN.B.PWMA_EN = 0x01;
FLEXPWM_0.OUTEN.B.PWMB_EN = 0x01;
FLEXPWM_0.MCTRL.B.LDOK = 0x01;
FLEXPWM_0.MCTRL.B.RUN = 0x01; 

running this code with the debugger I can see the FlexPWM_0 submodule 0 counter register is counting upwards. but i dont get any output-signal. I guess that was quiet confusing, but I hope someone can follow me. If you can't, some kind of an application note "how 2 setup FlexPWM" would be helpful too. Tanks!

Outcomes