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.

TMS320F28377S - PWM to control a H-Bridge

I'm new on Texas Microcontrolers. I'm making some tests and I realized that Texas Microcontrolers are really powerful.

I'm using the LAUNCHXL-F28377S development board. I need to control a DC motor in a H-Bridge. I've read several applications notes and I downloaded the example "ecap_capture_pwm_cpu01" to understand how to configure the PWM modules. But I'm still having some difficult. I'd like to ask some questions:

1. Period.

To configure the period I have to use the registers HSPCLKDIV and CLKDIV? If yes, for a 200MHz clock frequency my minimum PWM frequency will be 111KHz (200MHz / 128x14)? I need 18KHz. What should I do to configure the PWM frequency to 18KHz?


2. Direction

To control 4 transistors I need 4 PWM outputs. How should I configure to use EPWM1A - EPWM2B for forward direction and EPWM2A - EPWM1B for reverse?

How can I turn on and turn off the PWM?

3. Duty cycle

How can I control the duty cycle?

Thank you!

  • Danilo,

    We don't have any reference code for the brushed DC case, but configuring the PWM should be very straightforward.  You would normally fix the time-base clock at the highest available frequency, then control the PWM period using the TBPRD register.  For example, with a 100MHz TBCLK and the counter configured in up-down mode, you would achieve close to 18kHz PWM frequency by setting TBPRD to 2778.  There is more on this in section 13.4.3 of the user's guide for this device:

    http://www.ti.com/lit/ug/spruhx5c/spruhx5c.pdf

    In the H-bridge configuration you will need two complementary-pair PWMs which are locked in phase.  You could configure, for example, PWM1A and B for one leg, and PWM2A & B for the other.  Both would run at the same frequency and in the same configuration - probably up-down count with dead-band. PWM1 would be the master and PWM2 would be synchronized with it using the SYNC method.  You control duty cycle by writing to the CMPA register of both modules.  The attached sketches show what I'm trying to describe.

    Alternatively, I think the H-bridge configuration can be driven by one complementary pair PWM with each output connected to diagonally opposite switches.

    There is a good online workshop which includes details of the C2000 PWM architecture at:

    https://training.ti.com/c2000-mcu-1-day-workshop-8-part-series

    I hope this helps.

    Regards,

    Richard

    DC motor PWM.pdf