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.

TMS320F28379D: Calculate the time-base period for ePWM

Part Number: TMS320F28379D

Hello,

I'm trying to understand how to generate a PWM with my launchpad. I read the documentation about this, watched this video and read the example codes. I think I have a good understanding of how the submodules work together. But there is something I don't understand.

In the user guide, I have the following formula for calculing the TBPRD : T_{pwm} = (TBPRD + 1) * T_{TBCLK}.

For my application, I need a period of 20 ms (50 Hz). So I have two questions  :

- What is T_{TBCLK} ? Is it what they call CLKDIV in the example codes?

- What is the unit of the time in the board? Is it nanoseconds? Picoseconds? Milliseconds?

- How should I use the formula to determine the TBPRD I need?

Thanks for your help!

  • Hi,

    Louis Etienne said:
    - What is T_{TBCLK} ? Is it what they call CLKDIV in the example codes?


    TBCLK is the time base clock - that is the clock used for clocking the Time base counter inside PWM. So, all the settings inside PWM, for ex: TBPRD is the multiple of TBCLK. CLKDIV is one of the dividers to the system clock (SYSCLK) for deriving TBCLK.

    Refer to "Figure 15-5. Time-Base Submodule Signals and Registers"  of the TRM.


    Louis Etienne said:
    What is the unit of the time in the board? Is it nanoseconds? Picoseconds? Milliseconds?


    I'm not sure what you mean by unit of time in the board - typically clocks are defined in Nano seconds.

    Louis Etienne said:
    How should I use the formula to determine the TBPRD I need?


    In your case, assuming you went with default configuration of TBCLK i.e. 10ns in your formula.


    It would be very obvious once your run any example or configure PWM and observe the PWM output waveforms on a scope.

  • Hi, thanks for all of this informations, it's really helpful.

    Subrahmanya said:

    In your case, assuming you went with default configuration of TBCLK i.e. 10ns in your formula.

    How can I change this value if I want? I searched in the registers but I wasn't able to find it.

    Subrahmanya said:

    It would be very obvious once your run any example or configure PWM and observe the PWM output waveforms on a scope.

    I already tried to run the example but I don't have a scope (too expensive) so it's harder to vizualise the PWM.

  • Hi,

    Louis Etienne said:
    How can I change this value if I want? I searched in the registers but I wasn't able to find it.


    Please refer to TBCTL register. You can configure CLKDIV and HSPCLKDIV bits to further divide down the TBCLK.