User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 386
UG585 (v1.11) September 27, 2016
Chapter 14: General Purpose I/O (GPIO)
14.3 Programming Guide
The GPIO Controller has four banks, two each for MIO and EMIO. Each GPIO pin can be programmed
individually. Multiple pins can be programmed with a single write as described in section
14.2.1 GPIO Control of Device Pins.
14.3.1
Start-up Sequence
Main Example: Start-up Sequence
1. Resets: The reset options are described in section
14.4.2 Resets.
2. Clocks: The clocks are described in section
14.4.1 Clocks.
3. GPIO Pin Configurations: Configure pin as input/output is described in section
14.3.2 GPIO Pin
Configurations
.
4. Write Data to GPIO Output pin: Refer to example in section
14.3.3 Writing Data to GPIO
Output Pins.
5. Read Data from GPIO Input pin: Refer to example in section
14.3.4 Reading Data from GPIO
Input Pins .
6. Set GPIO pin as wake-up event: Refer to example in section GPIO as Wake-up Event.
14.3.2
GPIO Pin Configurations
Each individual GPIO pin can be configured as input/output. However, bank0 [8:7] pins must be
configured as outputs. Refer to section
14.2.3 Bank0, Bits[8:7] are Outputs
for further details.
Example: Configure MIO pin 10 as an output
1.
Set the direction as output: Write 0x0000_0400 to the gpio.DIRM_0 register.
2.
Set the output enable: Write 0x0000_0400 to the gpio.OEN_0 register.
Note:
The output enable has significance only when the GPIO pin is configured as an output.
Table 14-1: GPIO Interrupt Trigger Settings
Type gpio.INT_TYPE_0 gpio.INT_POLARITY_0 gpio.INT_ANY_0
Rising edge-sensitive
110
Falling edge-sensitive
100
Both rising- and falling edge-sensitive
1
X
1
Level sensitive, asserted High
01X
Level sensitive, asserted Low
00X