ePWM Submodules
733
SPRUHE8E – October 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
C28 Enhanced Pulse Width Modulator (ePWM) Module
A more detailed look at how the various register bits interact with the Interrupt and ADC start of
conversion logic are shown in
, and
.
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
On ePWM type 2, in order to enable event generation capability up to 15 events the following changes
have been made. The selection made on ETPS[INTPSSEL] bit determines whether ETINTPS register,
INTCNT2 and INTPRD2 bit fields determine frequency of events (interrupt once every 0-15 events).
Which event can cause an interrupt is configured by the interrupt selection (ETSEL[INTSEL]) and
(ETSEL[INTSELCMP]) bits. The event can be one of the following:
•
Time-base counter equal to zero (TBCTR = 0x00).
•
Time-base counter equal to period (TBCTR = TBPRD).
•
Time-base counter equal to zero or period (TBCTR = 0x00 || 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.
•
Time-base counter equal to the compare C register (CMPC) when the timer is incrementing.
•
Time-base counter equal to the compare C register (CMPC) when the timer is decrementing.
•
Time-base counter equal to the compare D register (CMPD) when the timer is incrementing.
•
Time-base counter equal to the compare D register (CMPD) when the timer is decrementing.
The number of events that have occurred can be read from the interrupt event counter ETPS[INTCNT] or
ETINTPS[INTCNT2] register bits based off of the selection made using ETPS[INTPSSEL]. That is, when
the specified event occurs the ETPS[INTCNT] or ETINTPS[INTCNT2] bits are incremented until they
reach the value specified by ETPS[INTPRD] or ETINTPS[INTPRD2] determined again by the selection
made in ETPS[INTPSSEL]. 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 behavior will occur [The below behavior is
also applicable to ETINTPS[INTCNT2] & ETINTPS[INTPRD2] :
•
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 in different situations will cause the following results:
•
Writing an INTPRD value that is GREATER or equal to the current counter value will reset the INTCNT
= 0
•
Writing an INTPRD value that is equal to the current counter value will trigger an interrupt if it is
enabled and the status flag is cleared (and INTCNT will also be cleared to 0)
•
Writing an INTPRD value that is LESS than the current counter value will result in undefined behavior
(that is, INTCNT stops counting because INTPRD is below INTCNT, and interrupt will never fire).