48EPWM1 Configured as a Typical Master, EPWM2 Configured as a Slave ....................................... 69
49Control of Four Buck Stages. Here F
50Buck Waveforms for (Note: Only three bucks shown here).......................................................... 71
51Control of Four Buck Stages. (Note: F
52Buck Waveforms for (Note: F
53Control of Two Half-H Bridge Stages (F
54Half-H Bridge Waveforms for (Note: Here F
55Control of Dual 3-Phase Inverter Stages as Is Commonly Used in Motor Control ............................... 79
563-Phase Inverter Waveforms for (Only One Inverter Shown) ....................................................... 80
57Configuring Two PWM Modules for Phase Control................................................................... 82
58Timing Waveforms Associated With Phase Control Between 2 Modules.......................................... 83
59Control of a 3-Phase Interleaved DC/DC Converter.................................................................. 84
603-Phase Interleaved DC/DC Converter Waveforms for .............................................................. 85
The Enhanced Pulse Width Modulator (ePWM) module described in this reference guide is a Type 0
ePWM. See the TMS320x28xx, 28xxx DSP Peripheral Reference Guide (SPRU566) for a list of all
devices with a ePWM module of the same type, to determine the differences between the types, and for a
list of device-specific differences within a type. This reference guide includes an overview of the module
and information about each of its sub-modules:
•Time-Base Module
•Counter Compare Module
•Action Qualifier Module
•Dead-Band Generator Module
•PWM Chopper (PC) Module
•Trip Zone Module
•Event Trigger Module
Related Documentation From Texas Instruments
The following books describe the TMS320F2833x, 2823x module and related support tools that are
available on the TI website:
The enhanced pulse width modulator (ePWM) peripheral is a key element in controlling many of the power
electronic systems found in both commercial and industrial equipments. These systems include digital
motor control, switch mode power supply control, uninterruptible power supplies (UPS), and other forms of
power conversion. The ePWM peripheral performs a digital to analog (DAC) function, where the duty cycle
is equivalent to a DAC analog value; it is sometimes referred to as a Power DAC.
This reference guide is applicable for ePWM type 0 . See the TMS320x28xx, 28xxx DSP PeripheralReference Guide (SPRU566) for a list of all devices with an ePWM module of the same type, to determine
the differences between the types, and for a list of device-specific differences within a type.
1Introduction
An effective PWM peripheral must be able to generate complex pulse width waveforms with minimal CPU
overhead or intervention. It needs to be highly programmable and very flexible while being easy to
understand and use. The ePWM unit described here addresses these requirements by allocating all
needed timing and control resources on a per PWM channel basis. Cross coupling or sharing of resources
has been avoided; instead, the ePWM is built up from smaller single channel modules with separate
resources that can operate together as required to form a system. This modular approach results in an
orthogonal architecture and provides a more transparent view of the peripheral structure, helping users to
understand its operation quickly.
In this document the letter x within a signal or module name is used to indicate a generic ePWM instance
on a device. For example output signals EPWMxA and EPWMxB refer to the output signals from the
ePWMx instance. Thus, EPWM1A and EPWM1B belong to ePWM1 and likewise EPWM4A and EPWM4B
belong to ePWM4.
1.1Submodule Overview
The ePWM module represents one complete PWM channel composed of two PWM outputs: EPWMxA
and EPWMxB. Multiple ePWM modules are instanced within a device as shown in Figure 1. Each ePWM
instance is identical with one exception. Some instances include a hardware extension that allows more
precise control of the PWM outputs. This extension is the high-resolution pulse width modulator (HRPWM)
and is described in the TMS320x2833x, 2823x High-Resolution Pulse Width Modulator (HRPWM)Reference Guide (SPRUG02) . See the device-specific data manual to determine which ePWM instances
include this feature. Each ePWM module is indicated by a numerical value starting with 1. For example
ePWM1 is the first instance and ePWM3 is the 3rd instance in the system and ePWMx indicates any
instance.
The ePWM modules are chained together via a clock synchronization scheme that allows them to operate
as a single system when required. Additionally, this synchronization scheme can be extended to the
capture peripheral modules (eCAP). The number of modules is device-dependent and based on target
application needs. Modules can also operate stand-alone.
Each ePWM module supports the following features:
•Dedicated 16-bit time-base counter with period and frequency control
•Two PWM outputs (EPWMxA and EPWMxB) that can be used in the following configurations:
– Two independent PWM outputs with single-edge operation
– Two independent PWM outputs with dual-edge symmetric operation
•Asynchronous override control of PWM signals through software.
•Programmable phase-control support for lag or lead operation relative to other ePWM modules.
•Hardware-locked (synchronized) phase relationship on a cycle-by-cycle basis.
•Dead-band generation with independent rising and falling edge delay control.
•Programmable trip zone allocation of both cycle-by-cycle trip and one-shot trip on fault conditions.
•A trip condition can force either high, low, or high-impedance state logic levels at PWM outputs.
•All events can trigger both CPU interrupts and ADC start of conversion (SOC)
•Programmable event prescaling minimizes CPU overhead on interrupts.
•PWM chopping by high-frequency carrier signal, useful for pulse transformer gate drives.
Each ePWM module is connected to the input/output signals shown in Figure 1. The signals are described
in detail in subsequent sections.
www.ti.com
– One independent PWM output with dual-edge asymmetric operation
Figure 3 shows more internal details of a single ePWM module. The main signals used by the ePWM
module are:
•PWM output signals (EPWMxA and EPWMxB).
•Trip-zone signals (TZ1 to TZ6).
•Time-base synchronization input (EPWMxSYNCI) and output (EPWMxSYNCO) signals.
•ADC start-of-conversion signals (EPWMxSOCA and EPWMxSOCB).
•Peripheral Bus
www.ti.com
Figure 2. Submodules and Signal Connections for an ePWM Module
The PWM output signals are made available external to the device through the GPIO peripheral
described in the system control and interrupts guide for your device.
These input signals alert the ePWM module of fault conditions external to the ePWM module. Each
module on a device can be configured to either use or ignore any of the trip-zone signals. The TZ1 to
TZ6 trip-zone signals can be configured as asynchronous inputs through the GPIO peripheral.
The synchronization signals daisy chain the ePWM modules together. Each module can be configured
to either use or ignore its synchronization input. The clock synchronization input and output signal are
brought out to pins only for ePWM1 (ePWM module #1). The synchronization output for ePWM1
(EPWM1SYNCO) is also connected to the SYNCI of the first enhanced capture module (eCAP1).
Each ePWM module has two ADC start of conversion signals (one for each sequencer). Any ePWM
module can trigger a start of conversion for either sequencer. Which event triggers the start of
conversion is configured in the Event-Trigger submodule of the ePWM.
The peripheral bus is 32-bits wide and allows both 16-bit and 32-bit writes to the ePWM register file.
TBCTL0x00001NoTime-Base Control Register
TBSTS0x00011NoTime-Base Status Register
TBPHSHR0x00021NoExtension for HRPWM Phase Register
TBPHS0x00031NoTime-Base Phase Register
TBCTR0x00041NoTime-Base Counter Register
TBPRD0x00051YesTime-Base Period Register
CMPCTL0x00071NoCounter-Compare Control Register
CMPAHR0x00081YesExtension for HRPWM Counter-Compare A Register
CMPA0x00091YesCounter-Compare A Register
CMPB0x000A1YesCounter-Compare B Register
AQCTLA0x000B1NoAction-Qualifier Control Register for Output A (EPWMxA)
AQCTLB0x000C1NoAction-Qualifier Control Register for Output B (EPWMxB)
AQSFRC0x000D1NoAction-Qualifier Software Force Register
AQCSFRC0x000E1YesAction-Qualifier Continuous S/W Force Register Set
TZSEL0x00121YesTrip-Zone Select Register
TZCTL0x00141YesTrip-Zone Control Register
TZEINT0x00151YesTrip-Zone Enable Interrupt Register
TZFLG0x00161Trip-Zone Flag Register
TZCLR0x00171YesTrip-Zone Clear Register
TZFRC0x00181YesTrip-Zone Force Register
ETSEL0x00191Event-Trigger Selection Register
ETPS0x001A1Event-Trigger Pre-Scale Register
ETFLG0x001B1Event-Trigger Flag Register
ETCLR0x001C1Event-Trigger Clear Register
ETFRC0x001D1Event-Trigger Force Register
PCCTL0x001E1PWM-Chopper Control Register
HRCNFG0x00201YesHRPWM Configuration Register
(1)
(2)
(3)
www.ti.com
Table 1. ePWM Module Control and Status Register Set Grouped by Submodule
OffsetSize
Name
Locations not shown are reserved.
These registers are only available on ePWM instances that include the high-resolution PWM extension. Otherwise these
locations are reserved. These registers are described in the TMS320x2833x, 2823x High-Resolution Pulse Width Modulator(HRPWM) Reference Guide (SPRUG02) . See the device specific data manual to determine which instances include the
HRPWM.
EALLOW protected registers as described in the specific device version of the System Control and Interrupts Reference Guide
listed in Related Documentation From Texas Instruments.
Seven submodules are included in every ePWM peripheral. Each of these submodules performs specific
tasks that can be configured by software.
2.1Overview
Table 2 lists the seven key submodules together with a list of their main configuration parameters. For
example, if you need to adjust or control the duty cycle of a PWM waveform, then you should see the
counter-compare submodule in Section 2.3 for relevant details.
SubmoduleConfiguration Parameter or Option
Time-base (TB)
Counter-compare (CC)
Action-qualifier (AQ)
Dead-band (DB)
PWM-chopper (PC)
ePWM Submodules
Table 2. Submodule Configuration Parameters
• Scale the time-base clock (TBCLK) relative to the system clock (SYSCLKOUT).
• Configure the PWM time-base counter (TBCTR) frequency or period.
• Set the mode for the time-base counter:
–count-up mode: used for asymmetric PWM
–count-down mode: used for asymmetric PWM
–count-up-and-down mode: used for symmetric PWM
• Configure the time-base phase relative to another ePWM module.
• Synchronize the time-base counter between modules through hardware or software.
• Configure the direction (up or down) of the time-base counter after a synchronization event.
• Configure how the time-base counter will behave when the device is halted by an emulator.
• Specify the source for the synchronization output of the ePWM module:
–Synchronization input signal
–Time-base counter equal to zero
–Time-base counter equal to counter-compare B (CMPB)
–No output synchronization signal generated.
• Specify the PWM duty cycle for output EPWMxA and/or output EPWMxB
• Specify the time at which switching events occur on the EPWMxA or EPWMxB output
• Specify the type of action taken when a time-base or counter-compare submodule event occurs:
–No action taken
–Output EPWMxA and/or EPWMxB switched high
–Output EPWMxA and/or EPWMxB switched low
–Output EPWMxA and/or EPWMxB toggled
• Force the PWM output state through software control
• Configure and control the PWM dead-band through software
• Control of traditional complementary dead-band relationship between upper and lower switches
• Specify the output rising-edge-delay value
• Specify the output falling-edge delay value
• Bypass the dead-band module entirely. In this case the PWM waveform is passed through
without modification.
• Create a chopping (carrier) frequency.
• Pulse width of the first pulse in the chopped pulse train.
• Duty cycle of the second and subsequent pulses.
• Bypass the PWM-chopper module entirely. In this case the PWM waveform is passed through
Event-trigger (ET)• Enable the ePWM events that will trigger an interrupt.
Code examples are provided in the remainder of this document that show how to implement various
ePWM module configurations. These examples use the constant definitions shown in Example 1. These
definitions are also used in the C2833x/2823x C/C++ Header Files and Peripheral Examples (SPRC530) .
• Configure the ePWM module to react to one, all, or none of the trip-zone pins .
• Specify the tripping action taken when a fault occurs:
–Force EPWMxA and/or EPWMxB high
–Force EPWMxA and/or EPWMxB low
–Force EPWMxA and/or EPWMxB to a high-impedance state
–Configure EPWMxA and/or EPWMxB to ignore any trip condition.
• Configure how often the ePWM will react to each trip-zone pins :
–One-shot
–Cycle-by-cycle
• Enable the trip-zone to initiate an interrupt.
• Bypass the trip-zone module entirely.
• Enable ePWM events that will trigger an ADC start-of-conversion event.
• Specify the rate at which events cause triggers (every occurrence or every second or third
occurrence)
• Poll, set, or clear event flags
Example 1. Constant Definitions Used in the Code Examples
Each ePWM module has its own time-base submodule that determines all of the event timing for the
ePWM module. Built-in synchronization logic allows the time-base of multiple ePWM modules to work
together as a single system. Figure 4 illustrates the time-base module's place within the ePWM.
Figure 4. Time-Base Submodule Block Diagram
www.ti.com
2.2.1Purpose of the Time-Base Submodule
You can configure the time-base submodule for the following:
•Specify the ePWM time-base counter (TBCTR) frequency or period to control how often events occur.
•Manage time-base synchronization with other ePWM modules.
•Maintain a phase relationship with other ePWM modules.
•Set the time-base counter to count-up, count-down, or count-up-and-down mode.
•Generate the following events:
– CTR = PRD: Time-base counter equal to the specified period (TBCTR = TBPRD) .
– CTR = Zero: Time-base counter equal to zero (TBCTR = 0x0000).
•Configure the rate of the time-base clock; a prescaled version of the CPU system clock
(SYSCLKOUT). This allows the time-base counter to increment/decrement at a slower rate.
2.2.2Controlling and Monitoring the Time-base Submodule
Table 3 shows the registers used to control and monitor the time-base submodule.
Table 3. Time-Base Submodule Registers
RegisterAddress offsetShadowedDescription
TBCTL0x0000NoTime-Base Control Register
TBSTS0x0001NoTime-Base Status Register
TBPHSHR0x0002NoHRPWM Extension Phase Register
TBPHS0x0003NoTime-Base Phase Register
TBCTR0x0004NoTime-Base Counter Register
TBPRD0x0005YesTime-Base Period Register
(1)
This register is available only on ePWM instances that include the high-resolution extension (HRPWM). On ePWM modules that
do not include the HRPWM, this location is reserved. This register is described in the device-specific High-Resolution Pulse
Width Modulator (HRPWM) Reference Guide. See the device specific data manual to determine which ePWM instances include
this feature.
The block diagram in Figure 5 shows the critical signals and registers of the time-base submodule.
Table 4 provides descriptions of the key signals associated with the time-base submodule.
Figure 5. Time-Base Submodule Signals and Registers
CTR = PRDTime-base counter equal to the specified period.
CTR = ZeroTime-base counter equal to zero
CTR = CMPBTime-base counter equal to active counter-compare B register (TBCTR = CMPB).
CTR_dirTime-base counter direction.
CTR_maxTime-base counter equal max value. (TBCTR = 0xFFFF)
TBCLKTime-base clock.
www.ti.com
Table 4. Key Time-Base Signals
Input pulse used to synchronize the time-base counter with the counter of ePWM module earlier in the
synchronization chain. An ePWM peripheral can be configured to use or ignore this signal. For the first ePWM
module (EPWM1) this signal comes from a device pin. For subsequent ePWM modules this signal is passed
from another ePWM peripheral. For example, EPWM2SYNCI is generated by the ePWM1 peripheral,
EPWM3SYNCI is generated by ePWM2 and so forth. See Section 2.2.3.3 for information on the
synchronization order of a particular device.
This output pulse is used to synchronize the counter of an ePWM module later in the synchronization chain.
The ePWM module generates this signal from one of three event sources:
1. EPWMxSYNCI (Synchronization input pulse)
2. CTR = Zero: The time-base counter equal to zero (TBCTR = 0x0000).
3. CTR = CMPB: The time-base counter equal to the counter-compare B (TBCTR = CMPB) register.
This signal is generated whenever the counter value is equal to the active period register value. That is when
TBCTR = TBPRD.
This signal is generated whenever the counter value is zero. That is when TBCTR equals 0x0000.
This event is generated by the counter-compare submodule and used by the synchronization out logic
Indicates the current direction of the ePWM's time-base counter. This signal is high when the counter is
increasing and low when it is decreasing.
Generated event when the TBCTR value reaches its maximum value. This signal is only used only as a status
bit
This is a prescaled version of the system clock (SYSCLKOUT) and is used by all submodules within the
ePWM. This clock determines the rate at which time-base counter increments or decrements.
2.2.3Calculating PWM Period and Frequency
The frequency of PWM events is controlled by the time-base period (TBPRD) register and the mode of the
time-base counter. Figure 6 shows the period (T
down-count, and up-down-count time-base counter modes when when the period is set to 4 (TBPRD = 4).
The time increment for each step is defined by the time-base clock (TBCLK) which is a prescaled version
of the system clock (SYSCLKOUT).
The time-base counter has three modes of operation selected by the time-base control register (TBCTL):
•Up-Down-Count Mode:
In up-down-count mode, the time-base counter starts from zero and increments until the period
(TBPRD) value is reached. When the period value is reached, the time-base counter then decrements
until it reaches zero. At this point the counter repeats the pattern and begins to increment.
•Up-Count Mode:
In this mode, the time-base counter starts from zero and increments until it reaches the value in the
period register (TBPRD). When the period value is reached, the time-base counter resets to zero and
begins to increment once again.
•Down-Count Mode:
In down-count mode, the time-base counter starts from the period (TBPRD) value and decrements until
it reaches zero. When it reaches zero, the time-base counter is reset to the period value and it begins
to decrement once again.
The time-base period register (TBPRD) has a shadow register. Shadowing allows the register update to
be synchronized with the hardware. The following definitions are used to describe all shadow registers in
the ePWM module:
•Active Register
The active register controls the hardware and is responsible for actions that the hardware causes or
invokes.
•Shadow Register
direct effect on any control hardware. At a strategic point in time the shadow register's content is
transferred to the active register. This prevents corruption or spurious operation due to the register
being asynchronously modified by software.
The memory address of the shadow period register is the same as the active register. Which register is
written to or read from is determined by the TBCTL[PRDLD] bit. This bit enables and disables the TBPRD
shadow register as follows:
•Time-Base Period Shadow Mode:
The shadow register buffers or provides a temporary holding location for the active register. It has no
The TBPRD shadow register is enabled when TBCTL[PRDLD] = 0. Reads from and writes to the
TBPRD memory address go to the shadow register. The shadow register contents are transferred to
the active register (TBPRD (Active) ← TBPRD (shadow)) when the time-base counter equals zero
(TBCTR = 0x0000). By default the TBPRD shadow register is enabled.
memory address goes directly to the active register.
2.2.3.2Time-Base Clock Synchronization
The TBCLKSYNC bit in the peripheral clock enable registers allows all users to globally synchronize all
enabled ePWM modules to the time-base clock (TBCLK). When set, all enabled ePWM module clocks are
started with the first rising edge of TBCLK aligned. For perfectly synchronized TBCLKs, the prescalers for
each ePWM module must be set identically.
The proper procedure for enabling ePWM clocks is as follows:
1. Enable ePWM module clocks in the PCLKCRx register
2. Set TBCLKSYNC= 0
3. Configure ePWM modules
4. Set TBCLKSYNC=1
2.2.3.3Time-Base Counter Synchronization
A time-base synchronization scheme connects all of the ePWM modules on a device. Each ePWM
module has a synchronization input (EPWMxSYNCI) and a synchronization output (EPWMxSYNCO). The
input synchronization for the first instance (ePWM1) comes from an external pin. The possible
synchronization connections for the remaining ePWM modules are shown in Figure 7, Figure 8, and
Figure 9.
Scheme 1 shown in Figure 7 applies to the 280x, 2801x, 2802x, and 2803x devices. Scheme 1 also
applies to the 2804x devices when the ePWM pinout is configured for 280x compatible mode
(GPAMCFG[EPWMMODE] = 0).
Scheme 2 shown in Figure 8 is used by the 2804x devices when the ePWM pinout is configured for
A-channel only mode (GPAMCFG[EPWMMODE] = 3). If the 2804x ePWM pinout is configured for 280x
compatible mode (GPAMCFG[EPWMMODE] = 0), then Scheme 1 is used.
NOTE: All modules shown in the synchronization schemes may not be available on all devices.
Please refer to the device specific data manual to determine which modules are available on
a particular device.
Each ePWM module can be configured to use or ignore the synchronization input. If the TBCTL[PHSEN]
bit is set, then the time-base counter (TBCTR) of the ePWM module will be automatically loaded with the
phase register (TBPHS) contents when one of the following conditions occur:
•EPWMxSYNCI: Synchronization Input Pulse:
The value of the phase register is loaded into the counter register when an input synchronization pulse
is detected (TBPHS → TBCTR). This operation occurs on the next valid time-base clock (TBCLK)
edge.
The delay from internal master module to slave modules is given by:
– if ( TBCLK = SYSCLKOUT): 2 x SYSCLKOUT
– if ( TBCLK != SYSCLKOUT):1 TBCLK
•Software Forced Synchronization Pulse:
Writing a 1 to the TBCTL[SWFSYNC] control bit invokes a software forced synchronization. This pulse
is ORed with the synchronization input signal, and therefore has the same effect as a pulse on
EPWMxSYNCI.
•This feature enables the ePWM module to be automatically synchronized to the time base of another
ePWM module. Lead or lag phase control can be added to the waveforms generated by different
ePWM modules to synchronize them. In up-down-count mode, the TBCTL[PSHDIR] bit configures the
direction of the time-base counter immediately after a synchronization event. The new direction is
independent of the direction prior to the synchronization event. The PHSDIR bit is ignored in count-up
or count-down modes. See Figure 10 through Figure 13 for examples.
Clearing the TBCTL[PHSEN] bit configures the ePWM to ignore the synchronization input pulse. The
synchronization pulse can still be allowed to flow-through to the EPWMxSYNCO and be used to
synchronize other ePWM modules. In this way, you can set up a master time-base (for example, ePWM1)
and downstream modules (ePWM2 - ePWMx) may elect to run in synchronization with the master. See
the Application to Power Topologies Section 3 for more details on synchronization strategies.
2.2.4Phase Locking the Time-Base Clocks of Multiple ePWM Modules
The TBCLKSYNC bit can be used to globally synchronize the time-base clocks of all enabled ePWM
modules on a device. This bit is part of the device's clock enable registers and is described in the specific
device version of the System Control and Interrupts Reference Guide listed in Related Documentation
From Texas Instruments. When TBCLKSYNC = 0, the time-base clock of all ePWM modules is stopped
(default). When TBCLKSYNC = 1, all ePWM time-base clocks are started with the rising edge of TBCLK
aligned. For perfectly synchronized TBCLKs, the prescaler bits in the TBCTL register of each ePWM
module must be set identically. The proper procedure for enabling the ePWM clocks is as follows:
1. Enable the individual ePWM module clocks. This is described in the specific device version of the
System Control and Interrupts Reference Guide listed in Related Documentation From Texas
Instruments.
2. Set TBCLKSYNC = 0. This will stop the time-base clock within any enabled ePWM module.
3. Configure the prescaler values and desired ePWM modes.
4. Set TBCLKSYNC = 1.
www.ti.com
2.2.5Time-base Counter Modes and Timing Waveforms
The time-base counter operates in one of four modes:
•Up-count mode which is asymmetrical.
•Down-count mode which is asymmetrical.
•Up-down-count which is symmetrical
•Frozen where the time-base counter is held constant at the current value
To illustrate the operation of the first three modes, the following timing diagrams show when events are
generated and how the time-base responds to an EPWMxSYNCI signal.
The counter-compare submodule takes as input the time-base counter value. This value is continuously
compared to the counter-compare A (CMPA) and counter-compare B (CMPB) registers. When the
time-base counter is equal to one of the compare registers, the counter-compare unit generates an
appropriate event.
The counter-compare:
•Generates events based on programmable time stamps using the CMPA and CMPB registers
– CTR = CMPA: Time-base counter equals counter-compare A register (TBCTR = CMPA).
•Controls the PWM duty cycle if the action-qualifier submodule is configured appropriately
•Shadows new compare values to prevent corruption or glitches during the active PWM cycle
2.3.2Controlling and Monitoring the Counter-Compare Submodule
The counter-compare submodule operation is controlled and monitored by the registers shown in Table 5:
Table 5. Counter-Compare Submodule Registers
Register NameAddress OffsetShadowedDescription
CMPCTL0x0007NoCounter-Compare Control Register.
CMPAHR0x0008YesHRPWM Counter-Compare A Extension Register
CMPA0x0009YesCounter-Compare A Register
CMPB0x000AYesCounter-Compare B Register
(1)
This register is available only on ePWM modules with the high-resolution extension (HRPWM). On ePWM modules that do not
include the HRPWM this location is reserved. This register is described in the device-specific High-Resolution Pulse Width
Modulator (HRPWM) Reference Guide. Refer to the device specific data manual to determine which ePWM instances include
this feature.
www.ti.com
(1)
Figure 15. Detailed View of the Counter-Compare Submodule
32
The key signals associated with the counter-compare submodule are described in Table 6.
CTR = CMPATime-base counter equal to the active counter-compare A valueTBCTR = CMPA
CTR = CMPBTime-base counter equal to the active counter-compare B valueTBCTR = CMPB
CTR = PRDTime-base counter equal to the active period.TBCTR = TBPRD
Used to load active counter-compare A and B registers from the
shadow register
CTR = ZEROTime-base counter equal to zero.TBCTR = 0x0000
Used to load active counter-compare A and B registers from the
shadow register
2.3.3Operational Highlights for the Counter-Compare Submodule
The counter-compare submodule is responsible for generating two independent compare events based on
two compare registers:
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 0x0000-TBPRD and once per cycle if the
compare value is equal to 0x0000 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 Section 2.4.1 for more details.
ePWM Submodules
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] and
CMPCTL[LOADBMODE] register bits:
•CTR = PRD: Time-base counter equal to the period (TBCTR = TBPRD).
•CTR = Zero: Time-base counter equal to zero (TBCTR = 0x0000)
•Both CTR = PRD and CTR = Zero
Only the active register contents are used by the counter-compare submodule to generate events to be
sent to the action-qualifier.
Immediate Load Mode:
If immediate load mode is selected (i.e., TBCTL[SHADWAMODE] = 1 or TBCTL[SHADWBMODE] = 1),
then a read from or a write to the register will go directly to the active register.
2.3.4Count Mode Timing Waveforms
The counter-compare module can generate compare events in all three count modes:
•Up-count mode: used to generate an asymmetrical PWM waveform.
•Down-count mode: used to generate an asymmetrical PWM waveform.
•Up-down-count mode: used to generate a symmetrical PWM waveform.
To best illustrate the operation of the first three modes, the timing diagrams in Figure 16 through Figure 19
show when events are generated and how the EPWMxSYNCI signal interacts.
The action-qualifier submodule has the most important role in waveform construction and PWM
generation. It decides which events are converted into various action types, thereby producing the
required switched waveforms at the EPWMxA and EPWMxB outputs.
www.ti.com
Figure 20. Action-Qualifier Submodule
2.4.1Purpose of the Action-Qualifier Submodule
The action-qualifier submodule is responsible for the following:
•Qualifying and generating actions (set, clear, toggle) based on the following events:
– CTR = PRD: Time-base counter equal to the period (TBCTR = TBPRD).
– CTR = Zero: Time-base counter equal to zero (TBCTR = 0x0000)
– CTR = CMPA: Time-base counter equal to the counter-compare A register (TBCTR = CMPA)
– CTR = CMPB: Time-base counter equal to the counter-compare B register (TBCTR = CMPB)
•Managing priority when these events occur concurrently
•Providing independent control of events when the time-base counter is increasing and when it is
decreasing. .
2.4.2Action-Qualifier Submodule Control and Status Register Definitions
The action-qualifier submodule operation is controlled and monitored via the registers in Table 7.
Table 7. Action-Qualifier Submodule Registers
RegisterAddress offsetShadowedDescription
Name
AQCTLA0x000BNoAction-Qualifier Control Register For Output A (EPWMxA)
AQCTLB0x000CNoAction-Qualifier Control Register For Output B (EPWMxB)
AQSFRC0x000DNoAction-Qualifier Software Force Register
AQCSFRC0x000EYesAction-Qualifier Continuous Software Force
The action-qualifier submodule is based on event-driven logic. It can be thought of as a programmable
cross switch with events at the input and actions at the output, all of which are software controlled via the
set of registers shown in Table 7.
ePWM Submodules
Figure 21. Action-Qualifier Submodule Inputs and Outputs
For convenience, the possible input events are summarized again in Table 8.
Table 8. Action-Qualifier Submodule Possible Input Events
SignalDescriptionRegisters Compared
CTR = PRDTime-base counter equal to the period valueTBCTR = TBPRD
CTR = ZeroTime-base counter equal to zeroTBCTR = 0x0000
CTR = CMPATime-base counter equal to the counter-compare ATBCTR = CMPA
CTR = CMPBTime-base counter equal to the counter-compare BTBCTR = CMPB
Software forced eventAsynchronous event initiated by software
The software forced action is a useful asynchronous event. This control is handled by registers AQSFRC
and AQCSFRC.
The action-qualifier submodule controls how the two outputs EPWMxA and EPWMxB behave when a
particular event occurs. The event inputs to the action-qualifier submodule are further qualified by the
counter direction (up or down). This allows for independent action on outputs on both the count-up and
count-down phases.
The possible actions imposed on outputs EPWMxA and EPWMxB are:
•Set High:
Set output EPWMxA or EPWMxB to a high level.
•Clear Low:
Set output EPWMxA or EPWMxB to a low level.
•Toggle:
If EPWMxA or EPWMxB is currently pulled high, then pull the output low. If EPWMxA or EPWMxB is
currently pulled low, then pull the output high.
•Do Nothing:
Keep outputs EPWMxA and EPWMxB at same level as currently set. Although the "Do Nothing" option
prevents an event from causing an action on the EPWMxA and EPWMxB outputs, this event can still
trigger interrupts and ADC start of conversion. See the Event-trigger Submodule description in
Actions are specified independently for either output (EPWMxA or EPWMxB). Any or all events can be
configured to generate actions on a given output. For example, both CTR = CMPA and CTR = CMPB can
operate on output EPWMxA. All qualifier actions are configured via the control registers found at the end
of this section.
For clarity, the drawings in this document use a set of symbolic actions. These symbols are summarized in
Figure 22. Each symbol represents an action as a marker in time. Some actions are fixed in time (zero
and period) while the CMPA and CMPB actions are moveable and their time positions are programmed
via the counter-compare A and B registers, respectively. To turn off or disable an action, use the "Do
Nothing option"; it is the default at reset.
Figure 22. Possible Action-Qualifier Actions for EPWMxA and EPWMxB Outputs
It is possible for the ePWM action qualifier to receive more than one event at the same time. In this case
events are assigned a priority by the hardware. The general rule is events occurring later in time have a
higher priority and software forced events always have the highest priority. The event priority levels for
up-down-count mode are shown in Table 9. A priority level of 1 is the highest priority and level 7 is the
lowest. The priority changes slightly depending on the direction of TBCTR.
Table 9. Action-Qualifier Event Priority for Up-Down-Count Mode
Priority LevelEvent If TBCTR is IncrementingEvent If TBCTR is Decrementing
TBCTR = Zero up to TBCTR = TBPRDTBCTR = TBPRD down to TBCTR = 1
Table 12. Behavior if CMPA/CMPB is Greater than the Period (continued)
Counter ModeCompare on Up-Count EventCompare on Down-Count Event
CAD/CBDCAD/CBD
Up-Down-CountIf CMPA/CMPB < TBPRD and the counter isIf CMPA/CMPB < TBPRD and the counter is
Modeincrementing, the event occurs on a compare matchdecrementing, the event occurs on a compare match
(TBCTR=CMPA or CMPB).(TBCTR=CMPA or CMPB).
If CMPA/CMPB is ≥ TBPRD, the event will occur on a If CMPA/CMPB ≥ TBPRD, the event occurs on a
period match (TBCTR = TBPRD).period match (TBCTR=TBPRD).
2.4.4Waveforms for Common Configurations
NOTE:The waveforms in this document show the ePWMs behavior for a static compare register
value. In a running system, the active compare registers (CMPA and CMPB) are typically
updated from their respective shadow registers once every period. The user specifies when
the update will take place; either when the time-base counter reaches zero or when the
time-base counter reaches period. There are some cases when the action based on the new
value can be delayed by one period or the action based on the old value can take effect for
an extra period. Some PWM configurations avoid this situation. These include, but are not
limited to, the following:
Use up-down-count mode to generate a symmetric PWM:
•If you load CMPA/CMPB on zero, then use CMPA/CMPB values greater
than or equal to 1.
•If you load CMPA/CMPB on period, then use CMPA/CMPB values less than
or equal to TBPRD-1.
This means there will always be a pulse of at least one TBCLK cycle in a
PWM period which, when very short, tend to be ignored by the system.
Use up-down-count mode to generate an asymmetric PWM:
•To achieve 50%-0% asymmetric PWM use the following configuration: Load
CMPA/CMPB on period and use the period action to clear the PWM and a
compare-up action to set the PWM. Modulate the compare value from 0 to
TBPRD to achieve 50%-0% PWM duty.
When using up-count mode to generate an asymmetric PWM:
•To achieve 0-100% asymmetric PWM use the following configuration: Load
CMPA/CMPB on TBPRD. Use the Zero action to set the PWM and a
compare-up action to clear the PWM. Modulate the compare value from 0 to
TBPRD+1 to achieve 0-100% PWM duty.
See the Using Enhanced Pulse Width Modulator (ePWM) Module for 0-100%Duty Cycle Control Application Report (literature number SPRAAI1)
www.ti.com
42
Figure 23 shows how a symmetric PWM waveform can be generated using the up-down-count mode of
the TBCTR. In this mode 0%-100% DC modulation is achieved by using equal compare matches on the
up count and down count portions of the waveform. In the example shown, CMPA is used to make the
comparison. When the counter is incrementing the CMPA match will pull the PWM output high. Likewise,
when the counter is decrementing the compare match will pull the PWM signal low. When CMPA = 0, the
PWM signal is low for the entire period giving the 0% duty waveform. When CMPA = TBPRD, the PWM
signal is high achieving 100% duty.
When using this configuration in practice, if you load CMPA/CMPB on zero, then use CMPA/CMPB values
greater than or equal to 1. If you load CMPA/CMPB on period, then use CMPA/CMPB values less than or
equal to TBPRD-1. This means there will always be a pulse of at least one TBCLK cycle in a PWM period
which, when very short, tend to be ignored by the system.
The PWM waveforms in Figure 24 through Figure 29 show some common action-qualifier configurations.
The C-code samples in Example 2 through Example 7 shows how to configure an ePWM module for each
case. Some conventions used in the figures and examples are as follows:
•TBPRD, CMPA, and CMPB refer to the value written in their respective registers. The active register,
not the shadow register, is used by the hardware.
•CMPx, refers to either CMPA or CMPB.
•EPWMxA and EPWMxB refer to the output signals from ePWMx
•Up-Down means Count-up-and-down mode, Up means up-count mode and Dwn means down-count
mode
Figure 24. Up, Single Edge Asymmetric Waveform, With Independent Modulation on EPWMxA and
EPWMxB—Active High
www.ti.com
APWM period = (TBPRD + 1 ) × T
BDuty modulation for EPWMxA is set by CMPA, and is active high (that is, high time duty proportional to CMPA).
CDuty modulation for EPWMxB is set by CMPB and is active high (that is, high time duty proportional to CMPB).
DThe "Do Nothing" actions ( X ) are shown for completeness, but will not be shown on subsequent diagrams.
EActions at zero and period, although appearing to occur concurrently, are actually separated by one TBCLK period.
TBCTR wraps from period to 0000.
TBCLK
Example 2 contains a code sample showing initialization and run time for the waveforms in Figure 24.
Figure 25. Up, Single Edge Asymmetric Waveform With Independent Modulation on EPWMxA and
EPWMxB—Active Low
APWM period = (TBPRD + 1 ) × T
BDuty modulation for EPWMxA is set by CMPA, and is active low (that is, the low time duty is proportional to CMPA).
CDuty modulation for EPWMxB is set by CMPB and is active low (that is, the low time duty is proportional to CMPB).
DActions at zero and period, although appearing to occur concurrently, are actually separated by one TBCLK period.
TBCTR wraps from period to 0000.
TBCLK
Example 3 contains a code sample showing initialization and run time for the waveforms in Figure 25.
Figure 26. Up-Count, Pulse Placement Asymmetric Waveform With Independent Modulation on EPWMxA
APWM frequency = 1/( (TBPRD + 1 ) × T
BPulse can be placed anywhere within the PWM cycle (0000 - TBPRD)
CHigh time duty proportional to (CMPB - CMPA)
DEPWMxB can be used to generate a 50% duty square wave with frequency =× ( (TBPRD + 1 ) × TBCLK )
TBCLK
)
Example 4 contains a code sample showing initialization and run time for the waveforms Figure 26. Use
Figure 27. Up-Down-Count, Dual Edge Symmetric Waveform, With Independent Modulation on EPWMxA
and EPWMxB — Active Low
APWM period = 2 x TBPRD × T
BDuty modulation for EPWMxA is set by CMPA, and is active low (that is, the low time duty is proportional to CMPA).
CDuty modulation for EPWMxB is set by CMPB and is active low (that is, the low time duty is proportional to CMPB).
DOutputs EPWMxA and EPWMxB can drive independent power switches
TBCLK
Example 5 contains a code sample showing initialization and run time for the waveforms in Figure 27. Use
Figure 28. Up-Down-Count, Dual Edge Symmetric Waveform, With Independent Modulation on EPWMxA
and EPWMxB — Complementary
APWM period = 2 × TBPRD × T
BDuty modulation for EPWMxA is set by CMPA, and is active low, i.e., low time duty proportional to CMPA
CDuty modulation for EPWMxB is set by CMPB and is active high, i.e., high time duty proportional to CMPB
DOutputs EPWMx can drive upper/lower (complementary) power switches
EDead-band = CMPB - CMPA (fully programmable edge placement by software). Note the dead-band module is also
available if the more classical edge delay method is required.
TBCLK
Example 6 contains a code sample showing initialization and run time for the waveforms in Figure 28. Use
Figure 29. Up-Down-Count, Dual Edge Asymmetric Waveform, With Independent Modulation on
EPWMxA—Active Low
APWM period = 2 × TBPRD × TBCLK
BRising edge and falling edge can be asymmetrically positioned within a PWM cycle. This allows for pulse placement
techniques.
CDuty modulation for EPWMxA is set by CMPA and CMPB.
DLow time duty for EPWMxA is proportional to (CMPA + CMPB).
ETo change this example to active high, CMPA and CMPB actions need to be inverted (i.e., Set ! Clear and Clear Set).
FDuty modulation for EPWMxB is fixed at 50% (utilizes spare action resources for EPWMxB)
Example 7 contains a code sample showing initialization and run time for the waveforms in Figure 29. Use
Figure 30 illustrates the dead-band submodule within the ePWM module.
Figure 30. Dead_Band Submodule
ePWM Submodules
2.5.1Purpose of the Dead-Band Submodule
The "Action-qualifier (AQ) Module" section discussed how it is possible to generate the required
dead-band by having full control over edge placement using both the CMPA and CMPB resources of the
ePWM module. However, if the more classical edge delay-based dead-band with polarity control is
required, then the dead-band submodule described here should be used.
The key functions of the dead-band module are:
•Generating appropriate signal pairs (EPWMxA and EPWMxB) with dead-band relationship from a
single EPWMxA input
•Programming signal pairs for:
– Active high (AH)
– Active low (AL)
– Active high complementary (AHC)
– Active low complementary (ALC)
•Adding programmable delay to rising edges (RED)
•Adding programmable delay to falling edges (FED)
•Can be totally bypassed from the signal path (note dotted lines in diagram)
2.5.2Controlling and Monitoring the Dead-Band Submodule
The dead-band submodule operation is controlled and monitored via the following registers:
2.5.3Operational Highlights for the Dead-Band Submodule
The following sections provide the operational highlights.
The dead-band submodule has two groups of independent selection options as shown in Figure 31.
•Input Source Selection:
The input signals to the dead-band module are the EPWMxA and EPWMxB output signals from the
action-qualifier. In this section they will be referred to as EPWMxA In and EPWMxB In. Using the
DBCTL[IN_MODE) control bits, the signal source for each delay, falling-edge or rising-edge, can be
selected:
– EPWMxA In is the source for both falling-edge and rising-edge delay. This is the default mode.
– EPWMxA In is the source for falling-edge delay, EPWMxB In is the source for rising-edge delay.
– EPWMxA In is the source for rising edge delay, EPWMxB In is the source for falling-edge delay.
– EPWMxB In is the source for both falling-edge and rising-edge delay.
•Output Mode Control:
The output mode is configured by way of the DBCTL[OUT_MODE] bits. These bits determine if the
falling-edge delay, rising-edge delay, neither, or both are applied to the input signals.
•Polarity Control:
The polarity control (DBCTL[POLSEL]) allows you to specify whether the rising-edge delayed signal
and/or the falling-edge delayed signal is to be inverted before being sent out of the dead-band
submodule.
Figure 31. Configuration Options for the Dead-Band Submodule
www.ti.com
Although all combinations are supported, not all are typical usage modes. Table 14 documents some
classical dead-band configurations. These modes assume that the DBCTL[IN_MODE] is configured such
that EPWMxA In is the source for both falling-edge and rising-edge delay. Enhanced, or non-traditional
modes can be achieved by changing the input signal source. The modes shown in Table 14 fall into the
following categories:
•Mode 1: Bypass both falling-edge delay (FED) and rising-edge delay (RED)
Allows you to fully disable the dead-band submodule from the PWM signal path.
These represent typical polarity configurations that should address all the active high/low modes
required by available industry power switch gate drivers. The waveforms for these typical cases are
shown in Figure 32. Note that to generate equivalent waveforms to Figure 32, configure the
action-qualifier submodule to generate the signal as shown for EPWMxA.
•Mode 6: Bypass rising-edge-delay and Mode 7: Bypass falling-edge-delay
Figure 32 shows waveforms for typical cases where 0% < duty < 100%.
ePWM Submodules
Finally the last two entries in Table 14 show combinations where either the falling-edge-delay (FED) or
rising-edge-delay (RED) blocks are bypassed.
Table 14. Classical Dead-Band Operating Modes
ModeMode Description
1EPWMxA and EPWMxB Passed Through (No Delay)XX00
2Active High Complementary (AHC)1011
3Active Low Complementary (ALC)0111
4Active High (AH)0011
5Active Low (AL)1111
EPWMxA Out = EPWMxA In (No Delay)
60 or 10 or 101
EPWMxB Out = EPWMxA In with Falling Edge Delay
EPWMxA Out = EPWMxA In with Rising Edge Delay
The dead-band submodule supports independent values for rising-edge (RED) and falling-edge (FED)
delays. The amount of delay is programmed using the DBRED and DBFED registers. These are 10-bit
registers and their value represents the number of time-base clock, TBCLK, periods a signal edge is
delayed by. For example, the formula to calculate falling-edge-delay and rising-edge-delay are:
FED = DBFED × T
RED = DBRED × T
Where T
TBCLK
For convenience, delay values for various TBCLK options are shown in Table 15.
Figure 33 illustrates the PWM-chopper (PC) submodule within the ePWM module.
Figure 33. PWM-Chopper Submodule
The PWM-chopper submodule allows a high-frequency carrier signal to modulate the PWM waveform
generated by the action-qualifier and dead-band submodules. This capability is important if you need
pulse transformer-based gate drivers to control the power switching elements.
ePWM Submodules
2.6.1Purpose of the PWM-Chopper Submodule
The key functions of the PWM-chopper submodule are:
•Programmable chopping (carrier) frequency
•Programmable pulse width of first pulse
•Programmable duty cycle of second and subsequent pulses
•Can be fully bypassed if not required
2.6.2Controlling the PWM-Chopper Submodule
The PWM-chopper submodule operation is controlled via the registers in Table 16.
Table 16. PWM-Chopper Submodule Registers
mnemonicAddress offsetShadowedDescription
PCCTL0x001ENoPWM-chopper Control Register
2.6.3Operational Highlights for the PWM-Chopper Submodule
Figure 34 shows the operational details of the PWM-chopper submodule. The carrier clock is derived from
SYSCLKOUT. Its frequency and duty cycle are controlled via the CHPFREQ and CHPDUTY bits in the
PCCTL register. The one-shot block is a feature that provides a high energy first pulse to ensure hard and
fast power switch turn on, while the subsequent pulses sustain pulses, ensuring the power switch remains
on. The one-shot width is programmed via the OSHTWTH bits. The PWM-chopper submodule can be fully
disabled (bypassed) via the CHPEN bit.
Pulse transformer-based gate drive designs need to comprehend the magnetic properties or
characteristics of the transformer and associated circuitry. Saturation is one such consideration. To assist
the gate drive designer, the duty cycles of the second and subsequent pulses have been made
programmable. These sustaining pulses ensure the correct drive strength and polarity is maintained on the
power switch gate during the on period, and hence a programmable duty cycle allows a design to be
tuned or optimized via software control.
Figure 37 shows the duty cycle control that is possible by programming the CHPDUTY bits. One of seven
possible duty ratios can be selected ranging from 12.5% to 87.5%.
Figure 37. PWM-Chopper Submodule Waveforms Showing the Pulse Width (Duty Cycle) Control of
Figure 38 shows how the trip-zone (TZ) submodule fits within the ePWM module.
Each ePWM module is connected to six TZn signals (TZ1 to TZ6) that are sourced from the GPIO MUX.
These signals indicate external fault or trip conditions, and the ePWM outputs can be programmed to
respond accordingly when faults occur.
ePWM Submodules
Figure 38. Trip-Zone Submodule
2.7.1Purpose of the Trip-Zone Submodule
The key functions of the Trip-Zone submodule are:
•Trip inputs TZ1 to TZ6 can be flexibly mapped to any ePWM module.
•Upon a fault condition, outputs EPWMxA and EPWMxB can be forced to one of the following:
– High
– Low
– High-impedance
– No action taken
•Support for one-shot trip (OSHT) for major short circuits or over-current conditions.
•Support for cycle-by-cycle tripping (CBC) for current limiting operation.
•Each trip-zone input pin can be allocated to either one-shot or cycle-by-cycle operation.
•Interrupt generation is possible on any trip-zone pin .
•Software-forced tripping is also supported.
•The trip-zone submodule can be fully bypassed if it is not required.
2.7.2Controlling and Monitoring the Trip-Zone Submodule
The trip-zone submodule operation is controlled and monitored through the following registers:
Table 18. Trip-Zone Submodule Registers
Register NameAddress offsetShadowedDescription
TZSEL0x0012NoTrip-Zone Select Register
reserved0x0013
TZCTL0x0014NoTrip-Zone Control Register
TZEINT0x0015NoTrip-Zone Enable Interrupt Register
TZFLG0x0016NoTrip-Zone Flag Register
TZCLR0x0017NoTrip-Zone Clear Register
TZFRC0x0018NoTrip-Zone Force Register
(1)
All trip-zone registers are EALLOW protected and can be modified only after executing the EALLOW instruction. For more
information, see the device-specific version of the System Control and Interrupts Reference Guide listed in Section 1.
2.7.3Operational Highlights for the Trip-Zone Submodule
The following sections describe the operational highlights and configuration options for the trip-zone
submodule.
The trip-zone signals at pins TZ1 to TZ6 (also collectively referred to as TZn) are active low input signals.
When one of these pins goes low, it indicates that a trip event has occurred. Each ePWM module can be
individually configured to ignore or use each of the trip-zone pins . Which trip-zone pins are used by a
particular ePWM module is determined by the TZSEL register for that specific ePWM module. The
trip-zone signals may or may not be synchronized to the system clock (SYSCLKOUT) and digitally filtered
within the GPIO MUX block. A minimum 1 SYSCLKOUT low pulse on TZn inputs is sufficient to trigger a
fault condition in the ePWM module. The asynchronous trip makes sure that if clocks are missing for any
reason, the outputs can still be tripped by a valid event present on TZn inputs , providing the GPIO is
appropriately configured . For more information, see the GPIO section of the device-specific version of the
System Control and Interrupts Reference Guide listed in Related Documentation From Texas Instruments.
Each TZn input can be individually configured to provide either a cycle-by-cycle or one-shot trip event for
an ePWM module. This configuration is determined by the TZSEL[CBCn], and TZSEL[OSHTn] control bits
(where n corresponds to the trip pin) respectively.
•Cycle-by-Cycle (CBC):
When a cycle-by-cycle trip event occurs, the action specified in the TZCTL register is carried out
immediately on the EPWMxA and/or EPWMxB output. Table 19 lists the possible actions. In addition,
the cycle-by-cycle trip event flag (TZFLG[CBC]) is set and a EPWMx_TZINT interrupt is generated if it
is enabled in the TZEINT register and PIE peripheral.
The specified condition on the pins is automatically cleared when the ePWM time-base counter
reaches zero (TBCTR = 0x0000) if the trip event is no longer present. Therefore, in this mode, the trip
event is cleared or reset every PWM cycle. The TZFLG[CBC] flag bit will remain set until it is manually
cleared by writing to the TZCLR[CBC] bit. If the cycle-by-cycle trip event is still present when the
TZFLG[CBC] bit is cleared, then it will again be immediately set.
•One-Shot (OSHT):
When a one-shot trip event occurs, the action specified in the TZCTL register is carried out
immediately on the EPWMxA and/or EPWMxB output. Table 19 lists the possible actions. In addition,
the one-shot trip event flag (TZFLG[OST]) is set and a EPWMx_TZINT interrupt is generated if it is
enabled in the TZEINT register and PIE peripheral. The one-shot trip condition must be cleared
manually by writing to the TZCLR[OST] bit.
The action taken when a trip event occurs can be configured individually for each of the ePWM output
pins by way of the TZCTL[TZA] and TZCTL[TZB] register bits fields. One of four possible actions, shown
in Table 19, can be taken on a trip event.
0,0High-ImpedanceTripped
0,1Force to High StateTripped
1,0Force to Low StateTripped
1,1No ChangeDo Nothing.
No change is made to the output.
Example 8. Trip-Zone Configurations
Scenario A:
A one-shot trip event on TZ1 pulls both EPWM1A, EPWM1B low and also forces EPWM2A and EPWM2B
high.
•Configure the ePWM1 registers as follows:
– TZSEL[OSHT1] = 1: enables TZ1 as a one-shot event source for ePWM1
– TZCTL[TZA] = 2: EPWM1A will be forced low on a trip event.
– TZCTL[TZB] = 2: EPWM1B will be forced low on a trip event.
•Configure the ePWM2 registers as follows:
– TZSEL[OSHT1] = 1: enables TZ1 as a one-shot event source for ePWM2
– TZCTL[TZA] = 1: EPWM2A will be forced high on a trip event.
– TZCTL[TZB] = 1: EPWM2B will be forced high on a trip event.
Scenario B:
A cycle-by-cycle event on TZ5 pulls both EPWM1A, EPWM1B low.
A one-shot event on TZ1 or TZ6 puts EPWM2A into a high impedance state.
•Configure the ePWM1 registers as follows:
– TZSEL[CBC5] = 1: enables TZ5 as a one-shot event source for ePWM1
– TZCTL[TZA] = 2: EPWM1A will be forced low on a trip event.
– TZCTL[TZB] = 2: EPWM1B will be forced low on a trip event.
•Configure the ePWM2 registers as follows:
– TZSEL[OSHT1] = 1: enables TZ1 as a one-shot event source for ePWM2
– TZSEL[OSHT6] = 1: enables TZ6 as a one-shot event source for ePWM2
– TZCTL[TZA] = 0: EPWM2A will be put into a high-impedance state on a trip event.
– TZCTL[TZB] = 3: EPWM2B will ignore the trip event.
2.7.4Generating Trip Event Interrupts
Figure 39 and Figure 40 illustrate the trip-zone submodule control and interrupt logic, respectively.
The key functions of the event-trigger submodule are:
•Receives event inputs generated by the time-base and counter-compare submodules
•Uses the time-base direction information for up/down event qualification
•Uses prescaling logic to issue interrupt requests and ADC start of conversion at:
– Every event
– Every second event
– Every third event
•Provides full visibility of event generation via event counters and flags
•Allows software forcing of Interrupts and ADC start of conversion
The event-trigger submodule manages the events generated by the time-base submodule, the
counter-compare submodule, and the digital-compare submodule to generate an interrupt to the CPU
and/or a start of conversion pulse to the ADC when a selected event occurs. Figure 41 illustrates where
the event-trigger submodule fits within the ePWM system.
ePWM Submodules
2.8.1Operational Overview of the Event-Trigger Submodule
Each ePWM module has one interrupt request line connected to the PIE and two start of conversion
signals (one for each sequencer) connected to the ADC module. As shown in Figure 42, ADC start of
conversion for all ePWM modules are ORed together and hence multiple modules can initiate an ADC
start of conversion. If two requests occur on one start of conversion line, then only one will be recognized
by the ADC.
Figure 42. Event-Trigger Submodule Inter-Connectivity of ADC Start of Conversion
www.ti.com
The event-trigger submodule monitors various event conditions (the left side inputs to event-trigger
submodule shown in Figure 43) and can be configured to prescale these events before issuing an
Interrupt request or an ADC start of conversion. The event-trigger prescaling logic can issue Interrupt
requests and ADC start of conversion at:
The key registers used to configure the event-trigger submodule are shown in Table 20:
ePWM Submodules
Figure 43. Event-Trigger Submodule Showing Event Inputs and Prescaled Outputs
Table 20. Event-Trigger Submodule Registers
Register NameAddress offsetShadowedDescription
ETSEL0x0019NoEvent-trigger Selection Register
ETPS0x001ANoEvent-trigger Prescale Register
ETFLG0x001BNoEvent-trigger Flag Register
ETCLR0x001CNoEvent-trigger Clear Register
ETFRC0x001DNoEvent-trigger Force Register
•ETSEL—This selects which of the possible events will trigger an interrupt or start an ADC conversion
•ETPS—This programs the event prescaling options mentioned above.
•ETFLG—These are flag bits indicating status of the selected and prescaled events.
•ETCLR—These bits allow you to clear the flag bits in the ETFLG register via software.
•ETFRC—These bits allow software forcing of an event. Useful for debugging or s/w intervention.
A more detailed look at how the various register bits interact with the Interrupt and ADC start of
conversion logic are shown in Figure 44, Figure 45, and Figure 46.
Figure 44 shows the event-trigger's interrupt generation logic. The interrupt-period (ETPS[INTPRD]) bits
specify the number of events required to cause an interrupt pulse to be generated. The choices available
are:
•Do not generate an interrupt.
•Generate an interrupt on every event
•Generate an interrupt on every second event
•Generate an interrupt on every third event
Which event can cause an interrupt is configured by the interrupt selection (ETSEL[INTSEL]) bits. The
event can be one of the following:
•Time-base counter equal to zero (TBCTR = 0x0000).
•Time-base counter equal to period (TBCTR = TBPRD).
•Time-base counter equal to the compare A register (CMPA) when the timer is incrementing.
•Time-base counter equal to the compare A register (CMPA) when the timer is decrementing.
•Time-base counter equal to the compare B register (CMPB) when the timer is incrementing.
•Time-base counter equal to the compare B register (CMPB) when the timer is decrementing.
The number of events that have occurred can be read from the interrupt event counter (ETPS[INTCNT])
register bits. That is, when the specified event occurs the ETPS[INTCNT] bits are incremented until they
reach the value specified by ETPS[INTPRD]. When ETPS[INTCNT] = ETPS[INTPRD] the counter stops
counting and its output is set. The counter is only cleared when an interrupt is sent to the PIE.
When ETPS[INTCNT] reaches ETPS[INTPRD] the following behaviors will occur:
•If interrupts are enabled, ETSEL[INTEN] = 1 and the interrupt flag is clear, ETFLG[INT] = 0, then an
interrupt pulse is generated and the interrupt flag is set, ETFLG[INT] = 1, and the event counter is
cleared ETPS[INTCNT] = 0. The counter will begin counting events again.
•If interrupts are disabled, ETSEL[INTEN] = 0, or the interrupt flag is set, ETFLG[INT] = 1, the counter
stops counting events when it reaches the period value ETPS[INTCNT] = ETPS[INTPRD].
•If interrupts are enabled, but the interrupt flag is already set, then the counter will hold its output high
until the ENTFLG[INT] flag is cleared. This allows for one interrupt to be pending while one is serviced.
Writing to the INTPRD bits will automatically clear the counter INTCNT = 0 and the counter output will be
reset (so no interrupts are generated). Writing a 1 to the ETFRC[INT] bit will increment the event counter
INTCNT. The counter will behave as described above when INTCNT = INTPRD. When INTPRD = 0, the
counter is disabled and hence no events will be detected and the ETFRC[INT] bit is also ignored.
The above definition means that you can generate an interrupt on every event, on every second event, or
on every third event. An interrupt cannot be generated on every fourth or more events.
www.ti.com
Figure 44. Event-Trigger Interrupt Generator
66
Figure 45 shows the operation of the event-trigger's start-of-conversion-A (SOCA) pulse generator. The
ETPS[SOCACNT] counter and ETPS[SOCAPRD] period values behave similarly to the interrupt generator
except that the pulses are continuously generated. That is, the pulse flag ETFLG[SOCA] is latched when a
pulse is generated, but it does not stop further pulse generation. The enable/disable bit ETSEL[SOCAEN]
stops pulse generation, but input events can still be counted until the period value is reached as with the
interrupt generation logic. The event that will trigger an SOCA and SOCB pulse can be configured
separately in the ETSEL[SOCASEL] and ETSEL[SOCBSEL] bits. The possible events are the same
events that can be specified for the interrupt generation logic .
An ePWM module has all the local resources necessary to operate completely as a standalone module or
to operate in synchronization with other identical ePWM modules.
3.1Overview of Multiple Modules
Previously in this user's guide, all discussions have described the operation of a single module. To
facilitate the understanding of multiple modules working together in a system, the ePWM module
described in reference is represented by the more simplified block diagram shown in Figure 47. This
simplified ePWM block shows only the key resources needed to explain how a multiswitch power topology
is controlled with multiple ePWM modules working together.
Figure 47. Simplified ePWM Module
www.ti.com
3.2Key Configuration Capabilities
The key configuration choices available to each module are as follows:
•Options for SyncIn
– Load own counter with phase register on an incoming sync strobe—enable (EN) switch closed
– Do nothing or ignore incoming sync strobe—enable switch open
– Sync flow-through - SyncOut connected to SyncIn
– Master mode, provides a sync at PWM boundaries—SyncOut connected to CTR = PRD
– Master mode, provides a sync at any programmable point in time—SyncOut connected to CTR =
CMPB
– Module is in standalone mode and provides No sync to other modules—SyncOut connected to X
(disabled)
•Options for SyncOut
– Sync flow-through - SyncOut connected to SyncIn
– Master mode, provides a sync at PWM boundaries—SyncOut connected to CTR = PRD
– Master mode, provides a sync at any programmable point in time—SyncOut connected to CTR =
CMPB
– Module is in standalone mode and provides No sync to other modules—SyncOut connected to X
(disabled)
For each choice of SyncOut, a module may also choose to load its own counter with a new phase value
on a SyncIn strobe input or choose to ignore it, i.e., via the enable switch. Although various combinations
are possible, the two most common—master module and slave module modes—are shown in Figure 48.
Figure 48. EPWM1 Configured as a Typical Master, EPWM2 Configured as a Slave
3.3Controlling Multiple Buck Converters With Independent Frequencies
One of the simplest power converter topologies is the buck. A single ePWM module configured as a
master can control two buck stages with the same PWM frequency. If independent frequency control is
required for each buck converter, then one ePWM module must be allocated for each converter stage.
Figure 49 shows four buck stages, each running at independent frequencies. In this case, all four ePWM
modules are configured as Masters and no synchronization is used. Figure 50 shows the waveforms
generated by the setup shown in Figure 49; note that only three waveforms are shown, although there are
four stages.
//=====================================================================
// (Note: code for only 3 modules shown)
// Initialization Time
//========================
// EPWM Module 1 config
EPwm1Regs.TBPRD = 1200;// Period = 1201 TBCLK counts
EPwm1Regs.TBPHS.half.TBPHS = 0;// Set Phase register to zero
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;// Asymmetrical mode
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;// Phase loading disabled
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm1Regs.AQCTLA.bit.PRD = AQ_CLEAR;
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
// EPWM Module 2 config
EPwm2Regs.TBPRD = 1400;// Period = 1401 TBCLK counts
EPwm2Regs.TBPHS.half.TBPHS = 0;// Set Phase register to zero
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;// Asymmetrical mode
EPwm2Regs.TBCTL.bit.PHSEN = TB_DISABLE;// Phase loading disabled
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;
EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm2Regs.AQCTLA.bit.PRD = AQ_CLEAR;
EPwm2Regs.AQCTLA.bit.CAU = AQ_SET;
// EPWM Module 3 config
EPwm3Regs.TBPRD = 800;// Period = 801 TBCLK counts
EPwm3Regs.TBPHS.half.TBPHS = 0;// Set Phase register to zero
EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm3Regs.TBCTL.bit.PHSEN = TB_DISABLE;// Phase loading disabled
EPwm3Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;
EPwm3Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm3Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm3Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm3Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;// load on CTR=Zero
EPwm3Regs.AQCTLA.bit.PRD = AQ_CLEAR;
EPwm3Regs.AQCTLA.bit.CAU = AQ_SET;
//
// Run Time (Note: Example execution of one run-time instant)
//=========================================================
EPwm1Regs.CMPA.half.CMPA = 700;// adjust duty for output EPWM1A
EPwm2Regs.CMPA.half.CMPA = 700;// adjust duty for output EPWM2A
EPwm3Regs.CMPA.half.CMPA = 500;// adjust duty for output EPWM3A
3.4Controlling Multiple Buck Converters With Same Frequencies
If synchronization is a requirement, ePWM module 2 can be configured as a slave and can operate at
integer multiple (N) frequencies of module 1. The sync signal from master to slave ensures these modules
remain locked. Figure 51 shows such a configuration; Figure 52 shows the waveforms generated by the
configuration.
EPwm1Regs.TBPRD = 600;// Period = 1200 TBCLK counts
EPwm1Regs.TBPHS.half.TBPHS = 0;// Set Phase register to zero
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;// Master module
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;// Sync down-stream module
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;// set actions for EPWM1A
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
EPwm1Regs.AQCTLB.bit.CBU = AQ_SET;// set actions for EPWM1B
EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR;
// EPWM Module 2 config
EPwm2Regs.TBPRD = 600;// Period = 1200 TBCLK counts
EPwm2Regs.TBPHS.half.TBPHS = 0;// Set Phase register to zero
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;// Slave module
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;// sync flow-through
EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm2Regs.AQCTLA.bit.CAU = AQ_SET;// set actions for EPWM2A
EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR;
EPwm2Regs.AQCTLB.bit.CBU = AQ_SET;// set actions for EPWM2B
EPwm2Regs.AQCTLB.bit.CBD = AQ_CLEAR;
//
// Run Time (Note: Example execution of one run-time instance)
//===========================================================
EPwm1Regs.CMPA.half.CMPA = 400;// adjust duty for output EPWM1A
EPwm1Regs.CMPB = 200;// adjust duty for output EPWM1B
EPwm2Regs.CMPA.half.CMPA = 500;// adjust duty for output EPWM2A
EPwm2Regs.CMPB = 300;// adjust duty for output EPWM2B
EPwm3Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;// Active Hi complementary
EPwm3Regs.DBFED = 50;// FED = 50 TBCLKs
EPwm3Regs.DBRED = 50;// RED = 50 TBCLKs
// Run Time (Note: Example execution of one run-time instant)
//=========================================================
EPwm1Regs.CMPA.half.CMPA = 500;// adjust duty for output EPWM1A
EPwm2Regs.CMPA.half.CMPA = 600;// adjust duty for output EPWM2A
EPwm3Regs.CMPA.half.CMPA = 700;// adjust duty for output EPWM3A
Figure 58. Timing Waveforms Associated With Phase Control Between 2 Modules
3.8Controlling a 3-Phase Interleaved DC/DC Converter
A popular power topology that makes use of phase-offset between modules is shown in Figure 59. This
system uses three PWM modules, with module 1 configured as the master. To work, the phase
relationship between adjacent modules must be F = 120°. This is achieved by setting the slave TBPHS
registers 2 and 3 with values of 1/3 and 2/3 of the period value, respectively. For example, if the period
register is loaded with a value of 600 counts, then TBPHS (slave 2) = 200 and TBPHS (slave 3) = 400.
Both slave modules are synchronized to the master 1 module.
This concept can be extended to four or more phases, by setting the TBPHS values appropriately. The
following formula gives the TBPHS values for N phases:
TBPHS(N,M) = (TBPRD/N) x (—1)
Where:
N = number of phases
M = PWM module number
For example, for the 3-phase case (N=3), TBPRD = 600,
TBPHS(3,2) = (600/3) x (2-1) = 200 (i.e., Phase value for Slave module 2)
TBPHS(3,3) = 400 (i.e., Phase value for Slave module 3)
Figure 60 shows the waveforms for the configuration in Figure 59.
3.9Controlling Zero Voltage Switched Full Bridge (ZVSFB) Converter
The example given in Figure 61 assumes a static or constant phase relationship between legs (modules).
In such a case, control is achieved by modulating the duty cycle. It is also possible to dynamically change
the phase value on a cycle-by-cycle basis. This feature lends itself to controlling a class of power
topologies known as phase-shifted full bridge, or zero voltage switched full bridge. Here the controlled
parameter is not duty cycle (this is kept constant at approximately 50 percent); instead it is the phase
relationship between legs. Such a system can be implemented by allocating the resources of two PWM
modules to control a single power stage, which in turn requires control of four switching elements.
Figure 62 shows a master/slave module combination synchronized together to control a full H-bridge. In
this case, both master and slave modules are required to switch at the same PWM frequency. The phase
is controlled by using the slave's phase register (TBPHS). The master's phase register is not used and
therefore can be initialized to zero.
This chapter includes the register layouts and bit description for the submodules.
4.1Time-Base Submodule Registers
Figure 63 through Figure 67 and Table 21 through Table 25 provide the time-base register definitions.
Figure 63. Time-Base Period Register (TBPRD)
150
TBPRD
R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 21. Time-Base Period Register (TBPRD) Field Descriptions
BitsNameValue Description
15-0TBPRD0000- These bits determine the period of the time-base counter. This sets the PWM frequency.
FFFFh
Shadowing of this register is enabled and disabled by the TBCTL[PRDLD] bit. By default this register
is shadowed.
• If TBCTL[PRDLD] = 0, then the shadow is enabled and any write or read will automatically go to
the shadow register. In this case, the active register will be loaded from the shadow register
when the time-base counter equals zero.
• If TBCTL[PRDLD] = 1, then the shadow is disabled and any write or read will go directly to the
active register, that is the register actively controlling the hardware.
• The active and shadow registers share the same memory map address.
Figure 64. Time-Base Phase Register (TBPHS)
150
TBPHS
R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 22. Time-Base Phase Register (TBPHS) Field Descriptions
Bits NameValueDescription
15-0 TBPHS0000-FFFF These bits set time-base counter phase of the selected ePWM relative to the time-base that is
supplying the synchronization input signal.
• If TBCTL[PHSEN] = 0, then the synchronization event is ignored and the time-base counter is
not loaded with the phase.
• If TBCTL[PHSEN] = 1, then the time-base counter (TBCTR) will be loaded with the phase
(TBPHS) when a synchronization event occurs. The synchronization event can be initiated by
the input synchronization signal (EPWMxSYNCI) or by a software forced synchronization.
Figure 65. Time-Base Counter Register (TBCTR)
150
TBCTR
R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 23. Time-Base Counter Register (TBCTR) Field Descriptions
Bits NameValueDescription
15-0 TBCTR0000-Reading these bits gives the current time-base counter value.
FFFF
Writing to these bits sets the current time-base counter value. The update happens as soon as the
write occurs; the write is NOT synchronized to the time-base clock (TBCLK) and the register is not
shadowed.
Table 24. Time-Base Control Register (TBCTL) Field Descriptions (continued)
BitFieldValueDescription
6SWFSYNCSoftware Forced Synchronization Pulse
0Writing a 0 has no effect and reads always return a 0.
1Writing a 1 forces a one-time synchronization pulse to be generated.
This event is ORed with the EPWMxSYNCI input of the ePWM module.
SWFSYNC is valid (operates) only when EPWMxSYNCI is selected by SYNCOSEL = 00.
5:4SYNCOSELSynchronization Output Select. These bits select the source of the EPWMxSYNCO signal.
00EPWMxSYNC:
01CTR = zero: Time-base counter equal to zero (TBCTR = 0x0000)
10CTR = CMPB : Time-base counter equal to counter-compare B (TBCTR = CMPB)
11Disable EPWMxSYNCO signal
3PRDLDActive Period Register Load From Shadow Register Select
0The period register (TBPRD) is loaded from its shadow register when the time-base counter,
TBCTR, is equal to zero.
A write or read to the TBPRD register accesses the shadow register.
1Load the TBPRD register immediately without using a shadow register.
A write or read to the TBPRD register directly accesses the active register.
2PHSENCounter Register Load From Phase Register Enable
0Do not load the time-base counter (TBCTR) from the time-base phase register (TBPHS)
1Load the time-base counter with the phase register when an EPWMxSYNCI input signal occurs or
when a software synchronization is forced by the SWFSYNC bit
1:0CTRMODECounter Mode
The time-base counter mode is normally configured once and not changed during normal operation.
If you change the mode of the counter, the change will take effect at the next TBCLK edge and the
current counter value shall increment or decrement from the value before the mode change.
These bits set the time-base counter mode of operation as follows:
00Up-count mode
01Down-count mode
10Up-down-count mode
11Stop-freeze counter operation (default on reset)
Figure 68 through Figure 70 and Table 26 through Table 28 illustrate the counter-compare submodule
control and status registers.
Figure 68. Counter-Compare A Register (CMPA)
150
CMPA
R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 26. Counter-Compare A Register (CMPA) Field Descriptions
BitsNameDescription
15-0CMPAThe value in the active CMPA register is continuously compared to the time-base counter (TBCTR). When
the values are equal, the counter-compare module generates a "time-base counter equal to counter
compare A" event. This event is sent to the action-qualifier where it is qualified and converted it into one
or more actions. These actions can be applied to either the EPWMxA or the EPWMxB output depending
on the configuration of the AQCTLA and AQCTLB registers. The actions that can be defined in the
AQCTLA and AQCTLB registers include:
• Do nothing; the event is ignored.
• Clear: Pull the EPWMxA and/or EPWMxB signal low
• Set: Pull the EPWMxA and/or EPWMxB signal high
• Toggle the EPWMxA and/or EPWMxB signal
Shadowing of this register is enabled and disabled by the CMPCTL[SHDWAMODE] bit. By default this
register is shadowed.
• If CMPCTL[SHDWAMODE] = 0, then the shadow is enabled and any write or read will automatically
go to the shadow register. In this case, the CMPCTL[LOADAMODE] bit field determines which event
will load the active register from the shadow register.
• Before a write, the CMPCTL[SHDWAFULL] bit can be read to determine if the shadow register is
currently full.
• If CMPCTL[SHDWAMODE] = 1, then the shadow register is disabled and any write or read will go
directly to the active register, that is the register actively controlling the hardware.
• In either mode, the active and shadow registers share the same memory map address.
www.ti.com
Figure 69. Counter-Compare B Register (CMPB)
150
CMPB
R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 27. Counter-Compare B Register (CMPB) Field Descriptions
BitsNameDescription
15-0CMPBThe value in the active CMPB register is continuously compared to the time-base counter (TBCTR). When
the values are equal, the counter-compare module generates a "time-base counter equal to counter
compare B" event. This event is sent to the action-qualifier where it is qualified and converted it into one
or more actions. These actions can be applied to either the EPWMxA or the EPWMxB output depending
on the configuration of the AQCTLA and AQCTLB registers. The actions that can be defined in the
AQCTLA and AQCTLB registers include:
• Do nothing. event is ignored.
• Clear: Pull the EPWMxA and/or EPWMxB signal low
• Set: Pull the EPWMxA and/or EPWMxB signal high
• Toggle the EPWMxA and/or EPWMxB signal
Shadowing of this register is enabled and disabled by the CMPCTL[SHDWBMODE] bit. By default this
register is shadowed.
• If CMPCTL[SHDWBMODE] = 0, then the shadow is enabled and any write or read will automatically
go to the shadow register. In this case, the CMPCTL[LOADBMODE] bit field determines which event
will load the active register from the shadow register:
• Before a write, the CMPCTL[SHDWBFULL] bit can be read to determine if the shadow register is
currently full.
• If CMPCTL[SHDWBMODE] = 1, then the shadow register is disabled and any write or read will go
directly to the active register, that is the register actively controlling the hardware.
• In either mode, the active and shadow registers share the same memory map address.
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 28. Counter-Compare Control Register (CMPCTL) Field Descriptions
BitsNameValue Description
15-10 ReservedReserved
9SHDWBFULLCounter-compare B (CMPB) Shadow Register Full Status Flag
This bit self clears once a load-strobe occurs.
0CMPB shadow FIFO not full yet
1Indicates the CMPB shadow FIFO is full; a CPU write will overwrite current shadow value.
8SHDWAFULLCounter-compare A (CMPA) Shadow Register Full Status Flag
The flag bit is set when a 32-bit write to CMPA:CMPAHR register or a 16-bit write to CMPA
register is made. A 16-bit write to CMPAHR register will not affect the flag.
This bit self clears once a load-strobe occurs.
0CMPA shadow FIFO not full yet
1Indicates the CMPA shadow FIFO is full, a CPU write will overwrite the current shadow
value.
7ReservedReserved
6SHDWBMODECounter-compare B (CMPB) Register Operating Mode
0Shadow mode. Operates as a double buffer. All writes via the CPU access the shadow
register.
1Immediate mode. Only the active compare B register is used. All writes and reads directly
access the active register for immediate compare action.
5ReservedReserved
4SHDWAMODECounter-compare A (CMPA) Register Operating Mode
0Shadow mode. Operates as a double buffer. All writes via the CPU access the shadow
register.
1Immediate mode. Only the active compare register is used. All writes and reads directly
access the active register for immediate compare action
3-2LOADBMODEActive Counter-Compare B (CMPB) Load From Shadow Select Mode
This bit has no effect in immediate mode (CMPCTL[SHDWBMODE] = 1).
00Load on CTR = Zero: Time-base counter equal to zero (TBCTR = 0x0000)
01Load on CTR = PRD: Time-base counter equal to period (TBCTR = TBPRD)
10Load on either CTR = Zero or CTR = PRD
11Freeze (no loads possible)
1-0LOADAMODEActive Counter-Compare A (CMPA) Load From Shadow Select Mode.
This bit has no effect in immediate mode (CMPCTL[SHDWAMODE] = 1).
00Load on CTR = Zero: Time-base counter equal to zero (TBCTR = 0x0000)
01Load on CTR = PRD: Time-base counter equal to period (TBCTR = TBPRD)
10Load on either CTR = Zero or CTR = PRD
11Freeze (no loads possible)
Figure 71. Compare A High Resolution Register (CMPAHR)
158
CMPAHR
R/W-0
70
Reserved
R-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 29. Compare A High Resolution Register (CMPAHR) Field Descriptions
BitFieldValueDescription
15-8CMPAHR00-FFh These 8-bits contain the high-resolution portion (least significant 8-bits) of the counter-compare A
value. CMPA:CMPAHR can be accessed in a single 32-bit read/write.
Shadowing is enabled and disabled by the CMPCTL[SHDWAMODE] bit as described for the CMPA
register.
7-0ReservedReserved for TI Test
4.3Action-Qualifier Submodule Registers
Figure 72 through Figure 75 and Table 30 through Table 33 provide the action-qualifier submodule
register definitions.
Registers
Figure 72. Action-Qualifier Output A Control Register (AQCTLA)
1512111098
ReservedCBDCBU
R-0R/W-0R/W-0
76543210
CADCAUPRDZRO
R/W-0R/W-0R/W-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 30. Action-Qualifier Output A Control Register (AQCTLA) Field Descriptions
BitsNameValue Description
15-12ReservedReserved
11-10CBDAction when the time-base counter equals the active CMPB register and the counter is
9-8CBUAction when the counter equals the active CMPB register and the counter is incrementing.
7-6CADAction when the counter equals the active CMPA register and the counter is decrementing.
decrementing.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
Table 30. Action-Qualifier Output A Control Register (AQCTLA) Field Descriptions (continued)
BitsNameValue Description
5-4CAUAction when the counter equals the active CMPA register and the counter is incrementing.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
3-2PRDAction when the counter equals the period.
Note: By definition, in count up-down mode when the counter equals period the direction is defined
as 0 or counting down.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
1-0ZROAction when counter equals zero.
Note: By definition, in count up-down mode when the counter equals 0 the direction is defined as 1
or counting up.
00Do nothing (action disabled)
01Clear: force EPWMxA output low.
10Set: force EPWMxA output high.
11Toggle EPWMxA output: low output signal will be forced high, and a high signal will be forced low.
Figure 73. Action-Qualifier Output B Control Register (AQCTLB)
1512111098
ReservedCBDCBU
R-0R/W-0R/W-0
76543210
CADCAUPRDZRO
R/W-0R/W-0R/W-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 31. Action-Qualifier Output B Control Register (AQCTLB) Field Descriptions
BitsNameValue Description
15-12Reserved
11-10CBDAction when the counter equals the active CMPB register and the counter is decrementing.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
9-8CBUAction when the counter equals the active CMPB register and the counter is incrementing.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
7-6CADAction when the counter equals the active CMPA register and the counter is decrementing.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
Table 31. Action-Qualifier Output B Control Register (AQCTLB) Field Descriptions (continued)
BitsNameValue Description
5-4CAUAction when the counter equals the active CMPA register and the counter is incrementing.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
3-2PRDAction when the counter equals the period.
Note: By definition, in count up-down mode when the counter equals period the direction is defined
as 0 or counting down.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
1-0ZROAction when counter equals zero.
Note: By definition, in count up-down mode when the counter equals 0 the direction is defined as 1
or counting up.
00Do nothing (action disabled)
01Clear: force EPWMxB output low.
10Set: force EPWMxB output high.
11Toggle EPWMxB output: low output signal will be forced high, and a high signal will be forced low.
Figure 74. Action-Qualifier Software Force Register (AQSFRC)
158
Reserved
R-0
76543210
RLDCSFOTSFBACTSFBOTSFAACTSFA
R/W-0R/W-0R/W-0R/W-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 32. Action-Qualifier Software Force Register (AQSFRC) Field Descriptions
BitFieldValueDescription
15:8Reserved
7:6RLDCSFAQCSFRC Active Register Reload From Shadow Options
00Load on event counter equals zero
01Load on event counter equals period
10Load on event counter equals zero or counter equals period
11Load immediately (the active register is directly accessed by the CPU and is not loaded from the
shadow register).
5OTSFBOne-Time Software Forced Event on Output B
0Writing a 0 (zero) has no effect. Always reads back a 0
This bit is auto cleared once a write to this register is complete, i.e., a forced event is initiated.)
This is a one-shot forced event. It can be overridden by another subsequent event on output B.
Note: This action is not qualified by counter direction (CNT_dir)
Figure 75. Action-Qualifier Continuous Software Force Register (AQCSFRC)
158
Reserved
R-0
743210
ReservedCSFBCSFA
R-0R/W-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
www.ti.com
Table 33. Action-qualifier Continuous Software Force Register (AQCSFRC) Field Descriptions
BitsNameValue Description
15-4ReservedReserved
3-2CSFBContinuous Software Force on Output B
In immediate mode, a continuous force takes effect on the next TBCLK edge.
In shadow mode, a continuous force takes effect on the next TBCLK edge after a shadow load into
the active register. To configure shadow mode, use AQSFRC[RLDCSF].
00Forcing disabled, i.e., has no effect
01Forces a continuous low on output B
10Forces a continuous high on output B
11Software forcing is disabled and has no effect
1-0CSFAContinuous Software Force on Output A
In immediate mode, a continuous force takes effect on the next TBCLK edge.
In shadow mode, a continuous force takes effect on the next TBCLK edge after a shadow load into
the active register.
00Forcing disabled, i.e., has no effect
01Forces a continuous low on output A
10Forces a continuous high on output A
11Software forcing is disabled and has no effect