General-Purpose Input/Output (GPIO)
344
SPRUH22I – April 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
General-Purpose Input/Output (GPIO)
4.1.3.3
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
•
GPIO Interrupt Both Edges (GPIOIBE) register
•
GPIO Interrupt Event (GPIOIEV) register
Interrupts are enabled/disabled via 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 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.
Interrupts are cleared by writing a 1 to the appropriate bit of the GPIO Interrupt Clear (GPIOICR) register.
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.
4.1.3.4
Mode Control
The GPIO pins can be controlled by either software or hardware. Software control is the default for most
signals and corresponds to the GPIO mode, where the GPIODATA register is used to read or write the
corresponding pins. When hardware control is enabled via the GPIO Alternate Function Select
(GPIOAFSEL) register, the pin state is controlled by its alternate function (that is, the peripheral).
Further pin muxing options are provided through the GPIO Port Control (GPIOPCTL) register which
selects one of several peripheral functions for each GPIO.
4.1.3.5
Commit Control
The GPIO commit control registers provide a layer of protection against accidental programming of critical
hardware peripherals. Protection is provided for the NMI pin (PB7). Writes to protected bits of the GPIO
Alternate Function Select (GPIOAFSEL) register, GPIO Pull Up Select (GPIOPUR) register, GPIO Core
Select (GPIOCSEL) register, and GPIO Digital Enable (GPIODEN) register are not committed to storage
unless the GPIO Lock (GPIOLOCK) register has been unlocked and the appropriate bits of the GPIO
Commit (GPIOCR) register have been set.
4.1.3.6
Pad Control
The pad control registers allow software to configure the GPIO pads based on the application
requirements. The pad control registers include the GPIOODR, GPIOPUR and GPIODEN registers. These
registers control open-drain configuration, pull-up resistors, and digital input enable for each GPIO.
4.1.3.7
Identification
The identification registers configured at reset allow software to detect and identify the module as a GPIO
block. The identification registers include the GPIOPeriphID0-GPIOPeriphID7 registers as well as the
GPIOPCellID0-GPIOPCellID3 registers.