ePWM Submodules
693
SPRUHE8E – October 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
C28 Enhanced Pulse Width Modulator (ePWM) Module
Table 7-7. Counter-Compare Submodule Key Signals (continued)
Signal
Description of Event
Registers Compared
CTR = PRD
Time-base counter equal to the active period
Used to load active counter-compare A and B registers from the
shadow register.
TBCTR = TBPRD
CTR = ZERO
Time-base counter equal to zero
Used to load active counter-compare A and B registers from the
shadow register.
TBCTR = 0x00
7.2.3.3
Operational Highlights for the Counter-Compare Submodule
The counter-compare submodule is responsible for generating two independent compare events based on
two compare registers which is fed to action-qualifier submodule and Event Trigger submodule :
1. CTR = CMPA: Time-base counter equal to counter-compare A register (TBCTR = CMPA).
2. CTR = CMPB: Time-base counter equal to counter-compare B register (TBCTR = CMPB).
For up-count or down-count mode, each event occurs only once per cycle. For up-down-count mode each
event occurs twice per cycle if the compare value is between 0x00-TBPRD and once per cycle if the
compare value is equal to 0x00 or equal to TBPRD. These events are fed into the action-qualifier
submodule where they are qualified by the counter direction and converted into actions if enabled. Refer
to
for more details.
The counter-compare registers CMPA and CMPB each have an associated shadow register. Shadowing
provides a way to keep updates to the registers synchronized with the hardware. When shadowing is
used, updates to the active registers only occur at strategic points. This prevents corruption or spurious
operation due to the register being asynchronously modified by software. The memory address of the
active register and the shadow register is identical. Which register is written to or read from is determined
by the CMPCTL[SHDWAMODE] and CMPCTL[SHDWBMODE] bits. These bits enable and disable the
CMPA shadow register and CMPB shadow register respectively. The behavior of the two load modes is
described below:
Shadow Mode:
The shadow mode for the CMPA is enabled by clearing the CMPCTL[SHDWAMODE] bit and the shadow
register for CMPB is enabled by clearing the CMPCTL[SHDWBMODE] bit. Shadow mode is enabled by
default for both CMPA and CMPB.
If the shadow register is enabled then the content of the shadow register is transferred to the active
register on one of the following events as specified by the CMPCTL[LOADAMODE]
CMPCTL[LOADBMODE] CMPCTL[LOADASYNC] & CMPCTL[LOADBSYNC] register bits:
•
CTR = PRD: Time-base counter equal to the period (TBCTR = TBPRD).
•
CTR = Zero: Time-base counter equal to zero (TBCTR = 0x00)
•
Both CTR = PRD and CTR = Zero
•
SYNC event caused by DCAEVT1 or DCBEVT1 or EPWMxSYNCI or TBCTL[SWFSYNC]
•
Both SYNC event or a selection made by LOADAMODE/LOADBMODE
Only the active register contents are used by the counter-compare submodule to generate events to be
sent to the action-qualifier.
Immediate Mode:
If immediate load mode is selected (i.e., CMPCTL[SHDWAMODE] = 1 or CMPCTL[SHDWBMODE] = 1),
then a read from or a write to the register will go directly to the active register.
Addtional Comparators on ePWM type 2
The counter-compare submodule on ePWM type 2 is responsible for generating two additional
independent compare events based on two compare registers which is fed to Event Trigger submodule :
1. CTR = CMPC: Time-base counter equal to counter-compare C register (TBCTR = CMPC).
2. CTR = CMPD: Time-base counter equal to counter-compare D register (TBCTR = CMPD).