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.

TMS320F28069: Simple Square Wave PWM on GPIO Pins

Part Number: TMS320F28069
Other Parts Discussed in Thread: C2000WARE

I have an embarrassingly simple problem that I am having trouble with. I am attempting to modify an existing Example script which uses the TMS320F28069 for motor control. All I am looking to do is to set up a square wave PWM signal on the GPIO42/EPWM8A pin to communicate with a peripheral device. I am looking to make this a 50 Hz signal (PRI of 20 ms) with a pulse length that varies between 800 microseconds and 2200 microseconds (with the exact pulse length determined at runtime). 

How do I do this? I have reviewed C2000Ware_4_01_00_00/libraries/control/libraries/DCL/c28/examples/F28069_PID. I am struggling just to set up a constant PWM on the pin I specified earlier. Any tips here are appreciated--thanks.

-J

  • Hi John,

    Did you take a look at C2000Ware ePWM example? It is located at:

    C:/ti/c2000/C2000Ware_4_01_00_00/device_support/f2806x/examples/c28/epwm_updown_aq

    This example configures waveform using ePWM1, ePWM2, and ePWM3. The example can be modified to generate using ePWM8.

    Thanks & Regards,

    Santosh

  • Thank you, this was able to get me up and running with the PWM on the pins that I need. One problem I am running into now is that I cannot get the period of the PWM signal long enough. Following the example C:/ti/c2000/C2000Ware_4_01_00_00/device_support/f2806x/examples/c28/epwm_updown_aq, If I wanted to change the period of say EPWM1, then i would modify the #define variable called EPWM1_TIMER_TBPRD. From what I can tell this is interpreted as a Uint16 value. 

    For my needs, I need the period to be about 20 times longer, but I cannot get the period above 65535. How can I make the period longer on this PWM signal? I attempted to modify the F2806x_EPwm.h file to increase the datatype sizes, but this is not compiling. Any tips here?

    Thanks

    -J

  • I figured this out. The TBCTL.bit.HSPCLKDIV parameter allows me to set a clock ratio with SYSCLKOUT and enables me to have longer PWM periods. Problem solved!