CS5376
CS output from SPI
Data bit
GP_PULL
GP_DATA
Pull Up
Logic
R
GPIO/CS
GP_DIR
Figure 58. GPIO Bi-directional Structure and Operation
14. GENERAL PURPOSE I/O PINS
The General Purpose I/O (GPIO) block provides 12
general purpose pins to interface with external
hardware. Each GPIO pin can be configured as an
input or an output, with an internal pull-up resistor
enabled or disabled. Several GPIO pins also double
as chip selects for the SPI 1 and SPI 2 ports. Fig-
ure 58 shows the structure of a bi-directional GPIO
pin with SPI chip select functionality.
Each GPIO pin is programmed by three bits in the
GPCFG0 or GPCFG1 registers. The input or output
data direction is selected by the GP_DIR bits, the
internal pull-ups are enabled or disabled by the
GP_PULL bits, and the data values are set by the
GP_DATA bits. After reset, the GPIO pins are de-
faulted as inputs with pull-up resistors enabled.
14.1 GPIO Input Mode
When reading a value from the GP_DATA bits, the
returned data reports the current state of the pins. If
a pin is externally driven high it reads a logical 1. It
also reads a logical 1 if the pin is not connected
with its pull-up resistor enabled. If a pin is external-
ly driven low it reads a logical 0. It also reads a log-
ical 0 if the pin is not connected with its pull-up
resistor disabled, due to leakage currents.
When a GPIO pin is used as an input, the pull-up
resistor should be disabled to save power if it isn’t
required.
14.2 GPIO Output Mode
When a GPIO pin is used as an output to an external
device, the reset configuration as an input with
pull-up resistors enabled results in a logic high out-
put to the external device until it is programmed.
When a GPIO pin is programmed as an output with
a data value of 0, the pin is driven low and the in-
ternal pull-up resistor is automatically disabled.
When programmed as an output with a data value
of 1, the pin is driven high and the pull-up resistor
is inconsequential.
Any GPIO pin can be used as an open-drain output
by setting the data value to 0, enabling the pull-up,
and using the GP_DIR direction bits to control the
pin value. This open-drain output configuration
uses the internal pull-up resistor to pull the pin high
when GP_DIR is set as an input, and drives the pin
low when GP_DIR is set as an output.
14.2.1 GPIO Read In Output Mode
Note that when read the GP_DATA value always
reports the current state of the pins, and a value
written in output mode does not necessarily read
back the same value. If a pin in output mode is writ-
ten as a logical 1, the CS5376 will drive the pin
high. If an external device then forces the pin low,
the read value will reflect the pin state and return a
logical 0. Similarly, if an output pin is written as a
logical 0 but forced high externally, the read value
will reflect the pin state and return a logical 1. In
DS256PP1
85