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.
AM62LX-EVM
- This example uses the user expansion connector (J2) in the board for testing on AM62LX-SK.
- All pin numbers are on the expansion connector in the board.
- The pins configured for the example is enabled on user expansion connector based on the FET selection switch(FET_SEL0).
- The SOC_VOUT0_DATAn are the input to FET switches. The pins that are configured for the example are pinmuxed with the FET switches.
- The S0 select pin decides if the configured pins (which is pinmuxed with SOC_VOUT0_DATAn) map to HDMI or USER EXP connector.
- The S0 pin is triggered to a high value in the software. When the S0 is high, the pin that is configured for the example (which is pinmuxed with SOC_VOUT0_DATAn) will be available on the user expansion connector.
The below diagram depicts the selection:
S2 | S1 | S0 | IP(nA)/OP(nB1 (Or) nB2) |
H | H | L | nA=nB1 -> SOC - HDMI |
H | H | H | nA=nB2 -> SOC - GPIO EXP CONN |
Connect the EPWM output to ECAP input
- Connect Pin 24 to Pin 18 of User Expansion Connector (J2) on the board.
- EPWM O/P: G22/V0UT0_DATA13 (Pin_18)
- ECAP I/P: L22/V0UT0_DATA0 (Pin_24)
Supported Combinations
Parameter | Value |
CPU + OS | a53ss0-0 freertos |
a53ss0-0 nortos |
Toolchain | arm.gnu.aarch64-none |
Board | am62lx-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)
- To Load and Run an example (see Application Run and debugging using CCS)
- 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.