www.ti.com
Interrupt Control
159
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
General-Purpose Input/Outputs (GPIOs)
5.3 Interrupt Control
The interrupt capabilities of each GPIO port are controlled by a set of seven registers (see Section 5.5).
These registers 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.
Three registers define the edge or sense that causes interrupts:
• GPIO Interrupt Sense (GPIOIS) register
• GPIO Interrupt Both Edges (GPIOIBE) register
• GPIO Interrupt Event (GPIOIEV) register
Interrupts are enabled or disabled through the GPIO Interrupt Mask (GPIOIM) register.
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. As the
name implies, the GPIOMIS register only shows interrupt conditions that are allowed to pass 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 1 to the corresponding bit in the GPIO Interrupt Clear (GPIOICR) register. 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.
5.3.1 µDMA Trigger Source
Any GPIO pin can be configured as an external trigger for the µDMA, using the Apps GPIO Trigger Enable
(APPS_GPIO_TRIG_EN) register. If the µDMA is configured to start a transfer based on the GPIO signal,
a transfer is initiated.
5.4 Initialization and Configuration
To configure the GPIO pins of a particular port:
1. Enable the clock to the port by setting the appropriate bits in the GPIO0CLKEN, GPIO1CLKEN,
GPIO2CLKEN, GPIO3CLKEN, and GPIO4CLKEN registers.
2. Set the direction of the GPIO port pins by programming the GPIODIR register. Writing 1 indicates
output, and writing 0 indicates input.
3. Configure the GPIO_PAD_CONFIG_# register to program each bit as a GPIO or other peripheral
function. The GPIODMACTL register can program a GPIO pin as a µDMA trigger.
4. Program the GPIOIS, GPIOIBE, GPIOEV, and GPIOIM registers to configure the type, event, and
mask of the interrupts for each port.
5. Perform the following steps to prevent false interrupts when reconfiguring GPIO edge and interrupt
sense registers:
a. Mask the corresponding port by clearing the IME field in the GPIOIM register.
b. Configure the IS field in the GPIOIS register and the IBE field in the GPIOIBE register.
c. Clear the GPIORIS register.
d. Unmask the port by setting the IME field in the GPIOIM register.
Use the DATA register to drive the required value on the GPIO pin (when DIR = 1) or to read a value on
the GPIO pin (when DIR = 0).
Table 5-1 provides GPIO pad configuration examples, and Table 5-2 provides GPIO interrupt configuration
examples.