FILE: epwm_ex15_xcmp_multiple_edges.c
(Note - base frequency and duty cycle of all ePWM's are 50 KHz and 50% respectively. Value of TBPRD = 1999) This example configures ePWM1, ePWM2, ePWM4, ePWM6 and ePWM8 as follows
- ePWM1A is allocated all XCMP1-8 registers. ePWM1B has no output.
- New duty cycle = 50%, new frequency = 200 KHz
- No Shadow registers used
- ePWM2A is allocated XCMP1-4 and ePWM2B is allocated XCMP5-8 registers.
- A and B waveforms are complimentary
- New duty cycle = 50%, new frequency = 100 KHz
- No Shadow registers used
- ePWM4 is configured same as ePWM2 with Minimum Deadband.
- Minimum Deadband of 200 SYSCLK cycles provided (200 * (1/200 MHz) = 1 micro second)
- This implies dead band of 1 us is visible on output of ePWM4A and ePWM4B after their falling edge
- New duty cycle = 40%, new frequency = 100 KHz
- ePWM6A is allocated XCMP1-4 registers.
- 3 Shadow register sets used with LOADMULTIPLE mode
- Shadow set 2 repeated 2 times, Shadow set 3 repeated 4 times
- ISR to update all Shadow registers with new values after they repeat
- This means Shadow3 is active for 5 periods, Shadow2 is active for 3 periods and Shadow1 is active for 1 period before their new values are visible in output
- ePWM8A is allocated XCMP1-4 registers.
- 3 Shadow register sets used with LOADONCE mode
- Only Shadow set 3 is loaded from every period
- ISR updates Shadow 3 register with new values every 5 periods
External Connections
- ePWM1A is on GPIO0
- ePWM2A is on GPIO2 and ePWM2B is on GPIO3
- ePWM4A is on GPIO6 and ePWM4B is on GPIO7
- ePWM6A is on GPIO14
- ePWM8A is on GPIO10
- Monitor GPIO24 for ePWM6A new Shadow register value loading
- Monitor GPIO25 for ePWM8A new Shadow register value loading
Shadow register updations for ePWM6 and ePWM8:
- Only XCMP1 and XCMP4 are updated
- Update values are +/- 20 TBCTR steps depending on direction of updation
- GPIO24 is toggled every 9 cycles for ePWM6 after cycling through all Shadow buffers and loading new values Similarly GPIO25 is toggled every 5 cycles for ePWM8