Hi,
Unfortunately, I have not the phase-shift code for eFlexPWM module based on KV58, but i have the code for DSC, I think you can refer to it.
But you have to modify the code. Before you write any eFlexPWM registers, you have to enable the gated clock of eFlexPWM.
//enable PWM0 clock
SIM_SCGC4|=0xF000000;
write the pin assignment
void pinsAssignment(void)
{
//PTD14:PWM0_A0
//PTD15:PWM0_B0
//PTD12:PWM0_A1
//PTD13:PWM0_B1
//PTD10:PWM0_A2
//PTD11:PWM2_B2
//enable PORTD gated clock
SIM_SCGC5|=0x1000;
//set PTE MUX ALT5
PORTD_PCR14&=~(0xF00);
PORTD_PCR14|=(ALT6);
PORTD_PCR15&=~(0xF00);
PORTD_PCR15|=(ALT6);
PORTD_PCR12&=~(0xF00);
PORTD_PCR12|=(ALT6);
PORTD_PCR13&=~(0xF00);
PORTD_PCR13|=(ALT6);
PORTD_PCR10&=~(0xF00);
PORTD_PCR10|=(ALT6);
PORTD_PCR11&=~(0xF00);
PORTD_PCR11|=(ALT6);
}
For the PWM initialization, I attach the main.c which is based on the DSC, but the registers are the same.
Maybe the register definition is different.
I suppose that you can use like this:
PWM0_SM0INIT=0xxxxxx; for KV58
Hope it can help you
BR
XiangJun Rong