10.3.2
Interrupt Control
The interrupt capabilities of each GPIO port are controlled by a set of seven registers. These registers
are used to select the source of the interrupt, its polarity, and the edge properties. When one or
more GPIO inputs cause an interrupt, a single interrupt output is sent to the interrupt controller for
the entire GPIO port. For edge-triggered interrupts, software must clear the interrupt to enable any
further interrupts. For a level-sensitive interrupt, the external source must hold the level constant
for the interrupt to be recognized by the controller.
Three registers define the edge or sense that causes interrupts:
■
GPIO Interrupt Sense (GPIOIS)
register (see page 761)
■
GPIO Interrupt Both Edges (GPIOIBE)
register (see page 762)
■
GPIO Interrupt Event (GPIOIEV)
register (see page 763)
Interrupts are enabled/disabled via the
GPIO Interrupt Mask (GPIOIM)
register (see page 764).
When an interrupt condition occurs, the state of the interrupt signal can be viewed in two locations:
the
GPIO Raw Interrupt Status (GPIORIS)
and
GPIO Masked Interrupt Status (GPIOMIS)
registers
(see page 765 and page 767). As the name implies, the
GPIOMIS
register only shows interrupt
conditions that are allowed to be passed to the interrupt controller. The
GPIORIS
register indicates
that a GPIO pin meets the conditions for an interrupt, but has not necessarily been sent to the
interrupt controller.
For a GPIO level-detect interrupt, the interrupt signal generating the interrupt must be held until
serviced. Once the input signal deasserts from the interrupt generating logical sense, the
corresponding
RIS
bit in the
GPIORIS
register clears. For a GPIO edge-detect interrupt, the
RIS
bit in the
GPIORIS
register is cleared by writing a ‘1’ to the corresponding bit in the
GPIO Interrupt
Clear (GPIOICR)
register (see page 769). The corresponding
GPIOMIS
bit reflects the masked value
of the
RIS
bit.
When programming the interrupt control registers (
GPIOIS
,
GPIOIBE
, or
GPIOIEV
), the interrupts
should be masked (
GPIOIM
cleared). Writing any value to an interrupt control register can generate
a spurious interrupt if the corresponding bits are enabled.
10.3.2.1
Interrupts Per Pin
Each pin of GPIO Port P and Port Q can trigger an interrupt. Each pin has a dedicated interrupt
vector and can be handled by a separate interrupt handler. The
PP0
and
PQ0
interrupts serve as a
master interrupt and provide a legacy aggregated interrupt version. For interrupt assignments, see
Table 2-9 on page 116.
Note:
The OR'ed summary interrupt occurs on bit 0 of the
GPIORIS
register. For summary interrupt
mode, software should set the
GPIOIM
register to 0xFF and mask the port pin interrupts 1
through 7 in the
Interrupt Clear Enable (DISn)
register (see “NVIC Register
Descriptions” on page 153). When servicing this interrupt, write a 1 to the corresponding bit
in the
UNPENDn
register to clear the pending interrupt in the NVIC and clear the
GPIORIS
register pin interrupt bits by setting the
IC
field of the
GPIOICR
register to 0xFF.
10.3.2.2
ADC Trigger Source
Any GPIO pin can be configured to be an external trigger for the ADC using the
GPIO ADC Control
(GPIOADCCTL)
register. If any GPIO is configured as a non-masked interrupt pin (the appropriate
bit of
GPIOIM
is set), and an interrupt for that port is generated, a trigger signal is sent to the ADC.
If the
ADC Event Multiplexer Select (ADCEMUX)
register is configured to use the external trigger,
June 18, 2014
750
Texas Instruments-Production Data
General-Purpose Input/Outputs (GPIOs)