Are there any more examples of PWM on the TWR-KV58F?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Are there any more examples of PWM on the TWR-KV58F?

522 Views
edgardnetz
Contributor I

I'm using Mcuxpresso and have downloaded the corresponding SDK for this board,

when loading the PWM driver example all I get is three pwm outputs with 25 50 and 75 duty cycle all in phase, which is curious since the example says 3ph PWM.

I understand that I have to modify the VALx registers, but in the example no matter what you do all of these registers are always set to zero.

This is the only page in the reference manual about phase shifted PWMs

Can someone please point me to a good reference on this?

Thank you.

pastedImage_1.png

0 Kudos
1 Reply

440 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

0 Kudos