When the Enhanced PWM is enabled in single output mode, the PxA I/O pin will drive the pulse width modulated signal. However, that can be directed to other PWM I/O pins through the Steering Mode option.
PWM steering allows any of the PWM pins to be set as a the modulated signal. Additionally, the same PWM signal can be simultaneously available on multiple PWM pins. The PWM auto-shutdown option works on all the enabled PWM I/O pins.
Single Output Mode
The Single Output mode is selected by the PxM<1:0> bits in the CCPxCON register. The module has to also be in the EPWM mode which is any of the Enhanced PWM mode selections in the CCPxCON register.
CCPxCON: CCPx Control Register
R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 |
PxM1 | PxM0 | DCxB1 | DCxB0 | CCPxM3 | CCPxM2 | CCPxM1 | CCPxM0 |
bit 7 | bit 0 |
bit 7-6
PxM<1:0>: Enhanced PWM Output Configuration Bits
00 = Single output; PxA modulated; PxB, PxC, PxD assigned as port pins
01 = Full-Bridge output forward; PxD modulated; PxA active; PxB, PxC inactive
10 = Half-Bridge output; PxA, PxB modulated with dead-band control; PxC, PxD assigned as port pins
11 = Full-Bridge output reverse; PxB modulated; PxC active; PxA, PxD inactive
bit 3-0
CCPxM<3:0>: ECCP Mode Select bits
1100 = PWM mode: PxA, PxC active-high; PxB, PxD active-high
1101 = PWM mode: PxA, PxC active-high; PxB, PxD active-low
1110 = PWM mode: PxA, PxC active-low; PxB, PxD active-high
1111 = PWM mode: PxA, PxC active-low; PxB, PxD active-low
Steering Mode Setting
Routing a PWM signal to a different I/O pin, or more than one I/O pin, can be accomplished with the PWM Steering option. By setting the associated bit for each PWM I/O pin in the PSTRxCON register, the PWM output can be directed to the specific I/O pin.
PSTRxCON: PWM Steering Control Register
U-0 | U-0 | U-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 |
— | — | — | STRxSYNC | STRxD | STRxC | STRxB | STRxA |
bit 7 | bit 0 |
bit 3
STRxD: Steering Enable bit D
1 = PxD pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxD pin is assigned to port pin
bit 2
STRxC: Steering Enable bit C
1 = PxC pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxC pin is assigned to port pin
bit 1
STRxB: Steering Enable bit B
1 = PxB pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxB pin is assigned to port pin
bit 0
STRxA: Steering Enable bit A
1 = PxA pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxA pin is assigned to port pin
Steering Synchronization
The Enhanced PWM Steering can control when the PWM signal will update via the Synchronization settings.
The STRxSYNC bit of the PSTRxCON register provides the user two options for when the steering event will occur.
When the STRxSYNC bit is ‘0’, the steering event will happen at the end of the instruction that writes to the PSTRxCON register. In this case the output signal at the Px<D:A> pins may be an incomplete PWM waveform. This operation is useful when the user firmware needs to immediately remove a PWM signal from the pin.
When the STRxSYNC bit is ‘1’, the effective steering update will happen at the beginning of the next PWM period. In this case steering ON/OFF of the PWM output will always produce a complete PWM waveform.
PSTRxCON: PWM Steering Control Register
U-0 | U-0 | U-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 |
— | — | — | STRxSYNC | STRxD | STRxC | STRxB | STRxA |
bit 7 | bit 0 |
bit 4
STRxSYNC: Steering Sync bit
1 = Output steering update occurs on next PWM period
0 = Output steering update occurs at the beginning of the instruction cycle boundary