AnsweredAssumed Answered

KV46F256 PWM Module Problem

Question asked by İsmail Tatlınar on Feb 8, 2018
Latest reply on Feb 10, 2018 by xiangjun.rong

Hi all;

I'm using KV46F256VLL16 for motor control application. But i have very bad problem with PWM module.

Before testing my application, i create basic sinusoidal pwm with Pulse Width Modulator A (PWMA/eFlexPWM). But when duty cycle near 50%, duty pulse getting worse. I put some pictures below from oscilloscope screen. Corruption isn't same everytime.

My board is TWR-KV46F150M and i'm using portD pins for PWM module.

My pwm module settings is below also. I'm using MQX 5.0.2 HAL and Driver libraries.

 

 

    uint16_t deadTimeVal;
    PWM_Type *pwmBase = g_pwmBase[instance];
    pwm_module_setup_t moduleParams;

 


    moduleParams.clkSrc         = kClkSrcPwmIPBusClk;  /* Use IP Bus clock as source */
    moduleParams.prescale         = kPwmDividedBy2;
    moduleParams.cntrInitSel     = kInitSrcMasterSync;
    moduleParams.reloadLogic     = kFlexPwmReloadPwmFullCycle;
    moduleParams.reloadFreq     = kPwmLoadEvery1Oportunity;
    moduleParams.chnlPairOper     = kFlexPwmIndependent; //kFlexPwmComplementaryPwmA;
    moduleParams.forceTrig         = kForceOutputLocalForce;

 

    signalParams.pwmPeriod         = 1000;
    signalParams.pwmType         = kFlexPwmEdgeAligned;
    signalParams.pwmAPulseWidth = 1;
    signalParams.pwmBPulseWidth = 999;
    signalParams.pwmAPolarity     = false;
    signalParams.pwmBPolarity     = false;

 

    /*********** PWMA_SM0 - phase A, configuration ************/
    PWM_DRV_SetupPwm(instance, kFlexPwmModule0, &moduleParams, &signalParams);

 

    /* Set deadtime count, we set this to about 650ns */
    deadTimeVal = ((uint64_t)CLOCK_SYS_GetPwmFreq(0) * 20000) / 1000000000;

 

    PWM_WR_DTCNT0(pwmBase, kFlexPwmModule0, deadTimeVal);
    PWM_WR_DTCNT1(pwmBase, kFlexPwmModule0, deadTimeVal);

 

 

 

And my while rutine has this code :

 

   signalParams.pwmAPulseWidth = duty_arr[pwmVal];
   PWM_DRV_UpdatePwmSignal(0, kFlexPwmModule0, &signalParams);

 

//const unsigned int duty_arr[90] = { ...} there is duty values between 0 to 1000 for sinus signal. values taken from Matlab.

Attachments

Outcomes