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.

TMS320F28P650DK: Configuration of phase and period control mode for HRPWM

Part Number: TMS320F28P650DK
Other Parts Discussed in Thread: C2000WARE,

Tool/software:

Hello,
I have a question about the configuration of HRPWM for TMS320F28P650DK9.

We are trying to control the MEP of HRPWM in a kind of "hybrid" mode: chosen a frequency value (about 200kHz), below that frequency we need to control the MEP of HRPWM in phase shift mode, above that frequency we need to control the MEP of HRPWM in period mode. We need to switch from phase shift mode to period mode without stopping the PWM.

My questions are:
1 - It's possible to implement the behaviour I described above? And if so, is there a guide or an example about peripheral configuration?
2 - I cannot find any examples in C2000Ware on the configuration of phase shift control mode and deadband for HRPWM. Can you suggest where to look?

Thank you in advance,

Simone

  • Hi Simone,

    The expert is currently out of office today due to US holiday. Please expect a delay in response.

    Best Regards,

    Aishwarya

  • 1 - It's possible to implement the behaviour I described above? And if so, is there a guide or an example about peripheral configuration?

    It is possible to use both TBPRDHR and TBPHSHR and control both in your different modes.

    We have examples on updating TBPRD:TBPRDHR. We do not have currently an example of TBPHSHR but we have a guide in our TRM to enable this. 

    Step 6 outlines what is needed to have TBPHSHR enabled.

    2 - I cannot find any examples in C2000Ware on the configuration of phase shift control mode and deadband for HRPWM. Can you suggest where to look?

    To configure this, you should have dead band counter running at 2* TBCLK rate, configure the load mode for DBRED/FEDHR to be load on counter zero or period. Please take note of this limitation below. If you're in up-down count mode you should be fine.

    Here is a simple example show casing TBPHSHR below using HRPWM ex 3 as the starter code:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //#############################################################################
    //
    // FILE: hrpwm_ex3_prdupdown_sfo.c
    //
    // TITLE: HRPWM Period Control.
    //
    //! \addtogroup driver_example_list
    //! <h1>HRPWM Period Control</h1>
    //!
    //! This example modifies the MEP control registers to show edge displacement
    //! for high-resolution period with ePWM in Up-Down count mode
    //! due to the HRPWM control extension of the respective ePWM module.
    //!
    //! This example calls the following TI's MEP Scale Factor Optimizer (SFO)
    //! software library V8 functions:
    //!
    //! \b int \b SFO(); \n
    //! - updates MEP_ScaleFactor dynamically when HRPWM is in use
    //! - updates HRMSTEP register (exists only in EPwm1Regs register space)
    //! with MEP_ScaleFactor value
    //! - returns 2 if error: MEP_ScaleFactor is greater than maximum value of 255
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
    * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
    * @cliArgs --device "F28P65x" --package "256ZEJ" --part "F28P65x_256ZEJ" --context "CPU1" --product "C2000WARE@5.03.00.00"
    * @versions {"tool":"1.20.0+3587"}
    */
    /**
    * Import the modules used in this configuration.
    */
    const epwm = scripting.addModule("/driverlib/epwm.js", {}, false);
    const epwm1 = epwm.addInstance();
    const epwm2 = epwm.addInstance();
    const inputxbar = scripting.addModule("/driverlib/inputxbar.js", {}, false);
    const inputxbar1 = inputxbar.addInstance();
    const inputxbar_input = scripting.addModule("/driverlib/inputxbar_input.js");
    const inputxbar_input1 = inputxbar_input.addInstance();
    const inputxbar_input2 = inputxbar_input.addInstance();
    /**
    * Write custom configuration values to the imported modules.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,
    thank you for your answer. I just have one last question about TBPHSHR.
    In TRM I read that I need to use TRREM register instead of TBPHSHR for phase shift (22.20.2.35 TBPHS Register, pag. 3967):

    Can I use the following thread as guideline or for TMS320F28P650DK something is different?

    TMS320F28379D: Usage information on TRREM register for periodic HR phase update - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

  • Hi Simone,

    You can use that thread as guideline.

    Best,

    Ryan Ma

  • Hi Ryan,

    Ok, Thank you very much.

    Regards,

    Simone

  • Hi Simone,

    No problem!

    Best,

    Ryan Ma