Three SHDW buffers are available for
XCMP configurations. Each SHDW buffer contains the XCMP1-8 values (CMPA and CMPB
values), XTBPRD (TBPRD value), XCMPC (CMPC value), XCMPD (CMPD value), XAQCTLA and
XAQCTLB. Each SHDW buffer also contains the XMINMAX values which are used for CAPEVT
signal generation.
With the three SHDW buffer (SHDW1, SHDW2 and SHDW3) the values used for the upcoming
ePWM period cycles can be buffered.
With XCMPEN set, the load of the active registers are controlled by the XLOADCTL and
XLOAD registers. The shadow to active loading of the registers (other than XMINMAX,
XCMPC, XCMPD) are always done three cycles prior to TBCTR==ZERO event. XMINMAX,
XCMPC and XCMPD shadow loading is done at TBCTR==PRD.
There are two load modes configured by
XLOADCTL[LOADMODE]:
- LOADONCE Mode
(XLOADCTL[LOADMODE] = 0)
- In LOADONCE mode,
XLOADCTL[SHDWBUFPTR_ LOADONCE] is used to set the pointer location
of the shadow buffer.
- XLOADCTL[SHDWBUFPTR_
LOADONCE] is set by the user and is NOT automatically
decremented. Upon the occurrence of the first load strobe (write of
‘1’ to XLOAD[STARTLD] bit), active register set is loaded from the
XLOADCTL[SHDWBUFPTR_ LOADONCE] SHDW selected by the user. Further
load strobes are ignored, and ePWM waveform generation continues
with the active register set until next XLOAD[STARTLD] is
initiated.
- When the software
sets the XLOAD[STARTLD] bit again, the active register set is loaded
from the XLOADCTL[SHDWBUFPTR_ LOADONCE] SHDW selected by the user.
If the user wants to initiate a SHDW load from a different shadow
register set, then the software can update the XLOADCTL[SHDWBUFPTR_
LOADONCE] register accordingly before setting the
XLOADCTL[STARTLD].
- LOADMULTIPLE Mode (XLOADCTL[LOADMODE] = 1)
- XLOADCTL[SHDWBUFPTR_
LOADMULTIPLE] always points to the current shadow register set that
is loaded into the active registers set.
- Setting the
XLOAD[STARTLD] bit initiates a load strobe. The SHDW buffer pointer
resets to XLOADCTL[SHDWLEVEL] and the corresponding buffer contents
are loaded to the active register set. When the next valid load
strobe arrives, XLOADCTL[SHDWBUFPTR_ LOADMULTIPLE] is decremented by
1 and the corresponding buffer contents are loaded to the active
register set. This continues until the XLOADCTL[SHDWBUFPTR_
LOADMULTIPLE] value reaches 1. At this time SHDW1 values get copied
to the active register set. Further load strobes are ignored and the
ePWM waveform generation continues with the active register set
until next XLOAD[STARTLD] is initiated.
- Once the
XLOADCTL[SHDWBUFPTR_ LOADMULTIPLE] value reaches 1, no further
decrements to the this pointer are done until the next STARTLD
initiation. This means the XLOADCTL[SHDWBUFPTR_ LOADMULTIPLE]
remains at value of '1', indicating that the SHDW1 register set is
in use till the next load initiation by user.
- For a SHDWLEVEL of 3
buffers SHDW3 is loaded first followed by SHDW2 and SHDW1. Then
until the next STARTLD write by the software, the SHDW1 values are
in use.
With this new loading scheme, the global load functionality also changes when using
XCMP mode. In this new configuration, once a write to STARLD occurs, the next time
the time base counter equals zero or a force load software write occurs, the shadow
buffer pointers get reset, based on the load mode (load once or load multiple).
Shadow buffers can also be repeated
more than once. Shadow buffer repeat counters are:
- Users can optionally repeat
each shadow buffer multiple times. This option sets the repeat count for
SHDW2 and SHDW3 buffers before the pointer moves to the SHDW1 buffer. SHDW1
buffer by default repeats until the next load is initiated by the software
and hence there is no configurable repeat option for SHDW1 buffer.
- Repeat counter option of the
shadow buffers is applicable in LOADMULTIPLE mode. In the LOADONCE mode,
user can manually keep track of the repeat counts and move to the SHDW
pointer buffer.
- Each shadow buffer has a
3-bit counter. Each buffer can be set to repeat up to 8 times before moving
the pointer to the next buffer.
- XLOADCTL[RPTBUF2PRD] and
XLOADCTL[RPTBUF3PRD] are used to control the repeat period for each SHDW
buffer.
No shadowing can be set by setting the
XLOADCTL[SHDWLEVEL] to '0'. In this case, the ACTIVE registers are available for use
(XCMP1_ACTIVE, XCMP2_ACTIVE, and so on).