The event-trigger submodule monitors
various event conditions (shown as inputs on the left side of Figure 15-35) 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:
- Every event
- Every second event
- Up to every seventh
event
- ETSEL - This selects which of the
possible events trigger events ET1 or ET2.
- ETPERIOD - This programs the
event prescaling options mentioned above.
- ETCNT - This indicates how many
events have occurred if the prescaling feature is used.
- INTEN - This enables interrupt
sources for the MCPWM.
- INTFLAG - These are flag bits
indicating whether an E1x or trip event has occurred.
- INTCLR - These bits allow
clearing the flag bits in the INTFLAG register using software.
- INTFRC - These bits allow
software forcing of an event. Useful for debugging or software
intervention.
- SOCEN - This enables ADC start of
conversion events.
- SOCSEL - This selects the trigger
sources for the ADC start of conversion events.
- SOCPERIOD - This programs the
event prescaling options for SOC events.
- SOCCNT - This indicates how many
SOC events have been generated when using the prescaling feature.
- SOCFLAG - This indicates which
SOC events have been generated.
- SOCCLR - This clears the SOCFLAG
bits when written to using software.
A more detailed look at how the
various register bits interact with the interrupt and ADC start-of-conversion logic
are shown in Figure 15-36 and Figure 15-37.
Figure 15-36 shows the event-trigger interrupt generation logic. The interrupt-period
(ETPERIOD[ETx_PERIOD]) 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 up
to every seventh event.
The event that can cause an interrupt
is configured by the interrupt enable(INTEN) register and event trigger selection
(ETSEL) register. 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.
- One-shot trip event.
- Cycle-by-cycle trip
event.
The number of events that have
occurred can be read from the interrupt event counter ETCNT[ETx_CNT] register bits
based off of the selection made using ETSEL. The specified event increments the
ETCNT[ETx_CNT] bits until the bits reach the value specified by
ETPERIOD[ETx_PERIOD]. When ETPS[INTCNT] = ETPS[INTPRD], the counter stops counting
and the counter output is set. The counter is cleared when an INTFLAG[ETx] event is
generated.
When ETCNT[ETx_CNT]
reaches ETPERIOD[ETx_PERIOD], the following behavior occurs:
If interrupts are
enabled, INTEN[ETx] = 1 and the interrupt flag is clear,INTFLAG[ETx] = 0, then an
interrupt pulse is generated and the interrupt flag is set, INTFLAG[ETx] = 1. The
counter is reset and begins counting events again
- If interrupts are disabled,
INTEN[ETx] = 0, or the interrupt flag is set, INTFLAG[ETx] = 1, the counter
stops counting events when the counter reaches the period value ETCNT[ETx_CNT] =
ETPERIOD[ETx_PERIOD].
- If interrupts are enabled, but
the interrupt flag is already set, then the counter holds the output high until
the INTFLAG[ETx] flag is cleared. This allows for one interrupt to be pending
while one is serviced.
Writing a 0 or a value that is
less than the current ETCNT value to the ETPERIOD bits results in the counter going
to an undefined state.
The
previous definition means that an interrupt on every event up to 7 events if using
the ETCNT and ETPERIOD can be generated.
ETINTMIX, ETSOCAMIX and ETSOCBMIX
Signals
The
event-trigger submodule can generate and use ETINTMIX, ETSOCAMIX, and ETSOCBMIX
signals:
- ETINTMIX: This signal is a
generated from the ORed combination of the sources enabled in the ETINTMIXEN
register. The ETINTMIX signal can be used as a source for the PWMx
interrupt.
- ETSOCAMIX: This signal is
a generated from the ORed combination of the sources enabled in the ETSOCAMIXEN
register. The ETSOCAMIX signal can be used as a source for the PWMxSOCA trigger
signal.
- ETSOCBMIX: This signal is
a generated from the ORed combination of the sources enabled in the ETSOCBMIXEN
register. The ETSOCBMIX signal can be used as a source for the PWMxSOCB trigger
signal
Figure 15-37 shows the operation of the event-trigger's start-of-conversion (SOCx) pulse
generator. The SOCCNT[SOCx_CNT] counters and SOCPERIOD[SOCx_PERIOD] period values
behave similarly to the interrupt generator except that the pulses are continuously
generated. That is, the pulse flag SOCFLAG[SOCx] is latched when a pulse is
generated, but the interrupt generator does not stop further pulse generation. The
enable and disable bit SOCEN[SOCx_ENABLE] 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 triggers an SOCx pulse can be configured separately
in the SOCSEL[SOCx_SEL] bits. The possible events are the same events that can be
specified for the interrupt generation logic.
Note: SOCC and SOCD events are only
available on 6-channel MCPWM. For 2-channel MCPWM, only SOCA and SOCB are
available.