Getting Started with the C2000 ePWM Module
This presentation is a technical introductory overview of the basic functional operation of the C2000 ePWM module. The key purpose of this presentation is to help new users get started and minimize the learning curve associated with reading the Technical Reference Manual. This presentation is based on the type-4 ePWM module and not all features are available on previous e-PWM module types.
Resources
Hello, my name is Ken Schachter, and welcome to Getting Started with the C2000 ePWM module. This presentation is a technical introductory overview of the basic functional operation of the ePWM module. The key purpose of this presentation is to help new users get started and minimize the learning curve associated with reading the technical reference manual. This presentation is based on the type 4 ePWM module. And not all features are available on previous ePWM module types.
The enhanced Pulse Width Modulator module, referred to as the ePWM module, is highly programmable, extremely flexible and easy to use while being capable of generating complex pulse width waveforms with minimal CPU overhead or intervention. Each ePWM module has two PWM outputs, ePWMxA and ePWMxB where the x is the ePWM module number.
These outputs are selected by the GPIO multiplexer. Additionally, the ePWM module can generate an interrupt or a trip zone interrupt to the peripheral interrupt expansion block and generate a start of conversion signal to the analog to digital converter. Inputs to the ePWM module include signals from the input cross-bar, selected trip zone signals, and signals from the ePWM cross-bar.
All ePWM modules in the C2000 device are identical. And multiple modules can be synchronized to operate together as required by the system application design. While not discussed in this presentation, the available high resolution PWM features can significantly increase the time resolution capabilities over the standard conventionally derived digital PWM with a time step accuracy on the order of 150 picoseconds.
The ePWM module consists of eight submodules, time-base, counter compare, action qualifier, dead band, PWM chopper, trip zone, digital compare, and event trigger. Each submodule will now be explained in further detail.
The time-base submodule consists of a dedicated 16-bit counter along with built-in synchronization logic to allow multiple ePWM modules to work together as a single system. A clock prescaler divides the ePWM clock to the counter. And a period register is used to control the frequency and period of the generated waveform.
The period register has a shadow register, which acts like a buffer to allow the register updates to be synchronized with the counter, thus avoiding corruption or spurious operation from the register being modified asynchronously by software. Also all of the ePWM module shadow registers support simultaneous global load, which avoids partial loads from the shadow registers to the active registers.
The time-base counter operates in three modes-- up count, down count, and up/down count. In up count mode, the time-base counter starts counting from zero and increments until it reaches the period register value. Then the time-base counter resets to zero. And the count sequence starts again. In down count mode, the time-base counter starts counting from the period register value and decrements until it reaches zero. Then the time-base counter is loaded with the period register value. And the count sequence starts again.
In up/down count mode, the time-base counter starts counting from zero and increments until it reaches the period register value. Then the time-base counter decrements until it reaches zero. And the count sequence repeats. The up count and down count modes are used to generate asymmetrical waveforms. And the up/down count mode is used to generate symmetrical waveforms.
The counter compare submodule continuously compares the time-base count value to four counter compare registers-- Compare A, Compare B, Compare C, and Compare D. This generates four independent compare events. When the time-base counter equals a compare register value, the compare event is fed to the action qualifier and event trigger submodules.
The counter compare registers are shadowed to prevent corruption or glitches during the active PWM cycle. Typically, compare A and compare B are used to control the duty cycle of the generated PWM waveform.
And all four compare registers can be used to start an ADC conversion or generate an ePWM interrupt. For the up count and down count modes, the count matches or occur only once per cycle. However, for the up/down count mode, a count match occurs twice per cycle, since there is a match on the up count and down count.
The action qualifier submodule is the key element in the ePWM module which is responsible for constructing and generating the switched PWM waveforms. It utilizes match events from the time-base and counter compare submodules for performing actions on the ePWMxA and ePWMxB output pins.
These actions are do nothing to the pin, clear the pin low, set the pin high, or toggle the pin based independently on count up and count down time-base match events. The match events are when the time based counter equals zero, the time-base counter equals Compare A, the time-base counter equals Compare B, the time-base counter equals the period register value, or a trigger event T1 and T2 based on a comparator, trip, or synchronization signal.
Note that zero and period actions are fixed in time, whereas Compare A and Compare B actions are movable in time by programming their respective registers. Actions are configured independently for each output using shadowed registers. And any or all events can be configured to generate actions on either output.
As an example, this figure shows how the action qualifier settings based on compare matches are used to modulate the output pins. Note that the output pins for ePWMxA and ePWMxB are completely independent. Also there are different output actions on the up count and down count using a single compare register. The ePWMxA and ePWMxB outputs are being set high on the Compare A and Compare B up count matches and cleared low on the Compare A and Compare B down count matches.
The dead band submodule provides a classical approach for delaying the switching action of a power device. Since power switching devices turn on faster than they turn off, a delay is needed to prevent having a momentary short circuit path from supply rail to ground. This submodule supports independently programmable rising edge and falling edge delays with various options for generating the appropriate signal outputs on ePWMxA and ePWMxB.
The PWM chopper submodule modulates a high frequency carrier signal with the PWM waveform that is generated by the action qualifier and dead band submodules. Its purpose is to control the power switching elements used with pulse transformer-based gate drivers. The high frequency carrier signal is logically ended with the ePWM outputs. And programmable options are available to support the magnetic properties and characteristics of the transformer and associated circuitry.
The trip zone submodule provides a protection mechanism to protect the output pins from abnormalities, such as overvoltage, overcurrent, and excessive temperature rise. A fast clock-independent logic mechanism is utilized to quickly handle fault conditions by forcing the ePWMxA and ePWMxB outputs to a safe state, such as high, low, or high impedance, thus avoiding any interrupt latency that may not protect the hardware when responding to overcurrent conditions or short circuits through interrupt service routine software.
It supports one shot trips for major short circuits or overcurrent conditions and cycle by cycle trips for current limiting or peak current mode control type applications. The trip zone signals can be generated externally from any GPIO pin which is mapped through the input cross-bar, internally from an eQEP error signal, system clock failure, or emulation stop output from the CPU. Additionally, numerous trip zone source signals can be generated from the digital compare submodule.
The digital compare submodule expands the capabilities of the trip zone submodule by comparing signals external to the ePWM module, such as a signal from the comparator subsystem analog comparators, to directly generate PWM events or actions which are then used by the time-base, event trigger, and trip zone submodules.
These compare events along with the submodules shown on the right side of this figure can generate PWM synchronization, generate an ADC start of conversion, trip the output, or generate a trip interrupt. A compare event is generated when one or more of its inputs are either high or low. The signals can originate from any external GPIO pin which is mapped through the input cross-bar and from various internal peripherals which are mapped through the ePWM cross-bar. Additionally, an optional blanking function can be used to temporarily disable the compare action in alignment with the PWM when switching to eliminate noise effects.
The event triggers submodule manages the events generated by the time-base, counter compare, and digital compare submodules for generating an interrupt to the CPU and/or a start of conversion pulse to the ADC when selected events occur. These event triggers can occur when the time-base counter equals zero, period, zero or period, the up or down count match of a Compare A, B, C, or D register.
Recall that the digital compare submodule can also generate an ADC start of conversion based on one or more compare events. The event trigger submodule incorporates prescaling logic to issue an interrupt request or ADC start of conversion at every event or up to every 15th event.
Additional information about the ePWM module and the C2000 device family can be found at www.TI.com/C2000. The data sheet contains electrical characteristics and timing specifications. And the silicon errata document contains deviations from the original specifications as well as revision history. The technical reference manual contains architectural descriptions and register/bit definitions. For hands-on training, please refer to the workshop materials.
Thank you for watching. And I hope this presentation has been beneficial to you.
This video is part of a series
-
Delfino™ premium performance MCUs
video-playlist (14 videos) -
C2000™ MCUs - Overview
video-playlist (52 videos)