This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to setup PWM chopping for high-frequency carrier?

Other Parts Discussed in Thread: MOTORWARE, RM46L852

Hello, everyone,

On the DVD of motorware,

I can not find any code about the PWM setting for generating the high-frequency carrier wave  to control the high power electronics, IGBTs.

IGBTs are  IRGPS60B120KDP with 1200V, 60A and IXDN55N120D1(1200V, 100A) respectively and gate driver is ISO5500 by TI.

Would you please tell me how to setup this PWM chopping function on RM46 core and DRV8301-RM46-Kit?

Thanks.

  • The TRM (SPNU514) chapter 19.2.6 describes how to use this sub-module.

    Please read that and let's know if there are questions.

    Regards,

    Haixiao

  • I need a demo code not to read this large datasheet.

    This big datasheet is a reference data, not a practice.

    Read this datasheet and try to write some pieces code is the most dangerous work for a real-time control a high-power motor about 30kW.

    I do not assure whether worked or not.

    In the RM46L852_instaspin_bldc and RM46L852_sensored_speed_smo projects

    there have 

    void PWM_disableChopping(PWM_Handle pwmHandle)

    void PWM_enableChopping(PWM_Handle pwmHandle)

    void PWM_setChoppingClkFreq(PWM_Handle pwmHandle,const PWM_ChoppingClkFreq_e clkFreq)

    void PWM_setChoppingDutyCycle(PWM_Handle pwmHandle,const PWM_ChoppingDutyCycle_e dutyCycle)

    void PWM_setChoppingPulseWidth(PWM_Handle pwmHandle,const PWM_ChoppingPulseWidth_e pulseWidth)

    totally five PWM_chopping functions declaration and bodies.

    But, in these two projects, there has no any further infomation about the PWM_chopping.

    Where can I find about PWM_chopping implementation examples code?

  • Those code about Choppoing in Hercules Motorware was not validated on hardware.

    Do you still need PWM chopping examples? If yes, I can build one.

    Regards,

    Haixiao

     

  • Thanks your hardwork!

    Yes, I need a PWM chopping program.

    The following section is my idea for PWM chopping:

    ///////////////////////////////////////////////////////////////////////////////////

    void PWM_HFCarrier(anSRM_struct *pSRM, int chanOn)
    {
    /////////////////////////////////////////////////////////////////////////////////////
    //! Created 2013/02/23 by R&D
    //!//! PWM_Handle pwmHandle[PWM_CHAN_NUMBER] in DRV_Obj is remapped to DRV_Handle pointer
    //! From epwm.h, the PWM chopping(carrier) setting:
    //! void PWM_disableChopping(PWM_Handle pwmHandle);
    //! void PWM_enableChopping(PWM_Handle pwmHandle);
    //! void PWM_setChoppingClkFreq(PWM_Handle pwmHandle,const PWM_ChoppingClkFreq_e clkFreq);
    //! void PWM_setChoppingDutyCycle(PWM_Handle pwmHandle,const PWM_ChoppingDutyCycle_e dutyCycle);
    //! void PWM_setChoppingPulseWidth(PWM_Handle pwmHandle,const PWM_ChoppingPulseWidth_e pulseWidth);
    //! const PWM_ChoppingClkFreq_e clkFreq, const PWM_ChoppingDutyCycle_e dutyCycle
    //! and const PWM_ChoppingPulseWidth_e pulseWidth are not easily im[lemented.
    //! Change three constant matrics as following:
    //! void MyPWM_setChoppingClkFreq(PWM_Handle pwmHandle, int chan, int const clkFreq[]);
    //! void MyPWM_setChoppingDutyCycle(PWM_Handle pwmHandle,int chan,int const dutyCycle[]);
    //! void MyPWM_setChoppingPulseWidth(PWM_Handle pwmHandle,int chan,int const pulseWidth[]);
    ///////////////////////////////////////////////////////////////////////////////////////

    int const freq[]= { PWM_ChoppingClkFreq_SysClkOut_by_1,
    PWM_ChoppingClkFreq_SysClkOut_by_2,
    PWM_ChoppingClkFreq_SysClkOut_by_3,
    PWM_ChoppingClkFreq_SysClkOut_by_4,
    PWM_ChoppingClkFreq_SysClkOut_by_5,
    PWM_ChoppingClkFreq_SysClkOut_by_6,
    PWM_ChoppingClkFreq_SysClkOut_by_7,
    PWM_ChoppingClkFreq_SysClkOut_by_8
    };

    int const DutyCycle[]= { PWM_ChoppingDutyCycle_One_Eighth,
    PWM_ChoppingDutyCycle_Two_Eighths,
    PWM_ChoppingDutyCycle_Three_Eighths,
    PWM_ChoppingDutyCycle_Four_Eighths,
    PWM_ChoppingDutyCycle_Five_Eighths,
    PWM_ChoppingDutyCycle_Six_Eighths,
    PWM_ChoppingDutyCycle_Seven_Eighths
    };
    int const pulseWidth[] = {
    PWM_ChoppingPulseWidth_One_Eighth_SysClkOut,
    PWM_ChoppingPulseWidth_Two_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Three_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Four_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Five_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Six_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Seven_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Eight_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Nine_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Ten_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Eleven_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Twelve_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Thirteen_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Fourteen_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Fifteen_Eighths_SysClkOut,
    PWM_ChoppingPulseWidth_Sixteen_Eighths_SysClkOut
    };

    //! void PWM_setChoppingClkFreq(PWM_Handle pwmHandle,const PWM_ChoppingClkFreq_e clkFreq);
    //! int random_number(int min_num, int max_num);
    MyPWM_setChoppingClkFreq(drv.pwmHandle[chanOn], random_number(1,7),freq);
    //! void PWM_setChoppingDutyCycle(PWM_Handle pwmHandle,const PWM_ChoppingDutyCycle_e dutyCycle);
    MyPWM_setChoppingDutyCycle(drv.pwmHandle[chanOn],random_number(1,6),DutyCycle);
    //! void PWM_setChoppingPulseWidth(PWM_Handle pwmHandle,const PWM_ChoppingPulseWidth_e pulseWidth);
    MyPWM_setChoppingPulseWidth(drv.pwmHandle[chanOn],random_number(1,15),pulseWidth);
    /////////////////////////////////////////////////////////////
    PWM_enableChopping(drv.pwmHandle[chanOn]);
    /////////////////////////////////////////////////////////////

    }

    ///////////////////////////////////////////////////////////////////////////////////

  • I verified the chopping functions in the motorware:

    1. PWM_setChoppingClkFreq, PWM_setChoppingDutyCycle, PWM_setChoppingPulseWidth, PWM_disableChopping can be used as it is.

    2. PWM_enableChopping need to be modified:

    void PWM_enableChopping(PWM_Handle pwmHandle)
    {
      PWM_Obj *pwm = (PWM_Obj *)pwmHandle;

      // set the bits
      pwm->PCCTL |= (uint16_t)1;

      return;
    }

     The original code forget '|'.

    Regards,

    Haixiao