AM64x MCU+ SDK  08.02.00
ECAP EPWM Loopback

Introduction

This example demonstrates ePWM to eCAP loopback test. The ecap module is configured in the capture mode and the ecap device pin is configured as input pin. A square wave needs to be fed to the ecap pin externally. Based on the internal counter the count values for each of the edge is latched in register. 4th edge will generate the interrupt. Based on the latched counter values, calculates the input signal frequency and the duty cycle based on the epwm input to the ecap module. ePWM is configured to generate a square wave with 25% duty cycle. Connect the ePWM output to eCAP input externally on the board. Below is the setup details.

  • This example needs IO breakout board for testing on AM64X-EVM.
  • Short Pin 2 and 3 of J11 on IO break out board.
  • Connect the EPWM output to ECAP input on the board by connecting Pin 7 on J6 Header in IO IO break out board to Pin 1 on J12 Header on base board.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 nortos
r5fss0-0 freertos
Toolchain ti-arm-clang
Board am64x-evm
Example folder examples/drivers/ecap/ecap_epwm_loopback/

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)
  • Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
  • Please connect the ePWM output to eCAP input externally as mentioned above in Introduction section

See Also

ECAP

Sample Output

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

EPWM to ECAP loopback application started...
Please refer EXAMPLES_DRIVERS_ECAP_EPWM_LOOPBACK example user guide for the test setup details.
Count1 = 93751, Count2 = 31247, Count3 = 93751, Count4 = 31247
Hight time is 250 us, Low time is 750 us
Expected DutyCycle 25%, Actual DutyCycle 25%
Expected Output Frequency 1KHz, Actual Output Frequency 1KHz
All tests have passed.