AM243x MCU+ SDK  09.02.00
EPWM trip zone

Introduction

This example configures EHRPWM0 and EHRPWM1 as follows

  • EHRPWM0 has TZ0 as one shot trip source
  • EHRPWM1 has TZ0 as cycle by cycle trip source

Initially tie TZ0 high. During the test, monitor EHRPWM0 or EHRPWM1 outputs on a scope. Pull TZ0 low to see the effect.

  • EHRPWM0_A is on GPIO_A
  • EHRPWM1_A is on GPIO_B

The TZ-Event is defined such that EHRPWM0_A will undergo a One-Shot Trip and EHRPWM1_A will undergo a Cycle-By-Cycle Trip.

The difference could be seen in the waveform generated as shown below. We can see that the for OSHT, as long as we kept clearing the flag (i.e. for 10 times) it recovered. Once loop exits, it goes into permanent trip state.

For CBC as observed at the end, after exiting the loop, it recovers from trip state and goes to active state.

External Connections

  • For AM243x-LP:
    • EHRPWM_TZn_IN0(J4.34) is connected to GPIO1_44(J5.47)
    • EHRPWM0_A(J4.40) and EHRPWM1_A(J4.38) pin can be connected to an oscilloscope to view the waveform.

AM243X-LP

  • Connect boosterpack header J4 pin 34 to J5 pin 47
  • Connect boosterpack header J4 pin 40 to scope for EHRPWM0_A
  • Connect boosterpack header J4 pin 38 to scope for EHRPWM1_A

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 nortos
Toolchain ti-arm-clang
Board am243x-lp
Example folder examples/drivers/epwm/epwm_trip_zone

Steps to Run the Example

  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
  • Establish connections as mentioned in External Connections section
  • Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
  • When the trip input TZ is high, 2 EPWMs generate PWM waveforms.
  • When trip input is pulled low , 2 EPWMs gets tripped.

See Also

EPWM

Sample Output

Shown below is a sample output when the application is run,

EPWM Trip Zone Test Started ...
TZ OST interrupt hit 1 times!!
TZ OST interrupt hit 2 times!!
TZ OST interrupt hit 3 times!!
TZ OST interrupt hit 4 times!!
TZ OST interrupt hit 5 times!!
TZ OST interrupt hit 6 times!!
TZ OST interrupt hit 7 times!!
TZ OST interrupt hit 8 times!!
TZ OST interrupt hit 9 times!!
TZ OST interrupt hit 10 times!!
TZ CBC interrupt hit 1 times!!
TZ CBC interrupt hit 2 times!!
TZ CBC interrupt hit 3 times!!
TZ CBC interrupt hit 4 times!!
TZ CBC interrupt hit 5 times!!
TZ CBC interrupt hit 6 times!!
TZ CBC interrupt hit 7 times!!
TZ CBC interrupt hit 8 times!!
TZ CBC interrupt hit 9 times!!
TZ CBC interrupt hit 10 times!!
EPWM Trip Zone Test Passed!!
All tests have passed!!

EPWM Trip Zone waveform