Raspberry Pi 5 IoT In C - GPIO Registers
Written by Harry Fairhead   
Tuesday, 04 March 2025
Article Index
Raspberry Pi 5 IoT In C - GPIO Registers
Registers
PAD
PAD Control

With this information we can now start to work with the GPIO registers:

 

Offset

Register Name

Description

0x000

GPIO0_STATUS

GPIO status

0x004

GPIO0_CTRL

GPIO control including function select and overrides

0x008

GPIO1_STATUS

GPIO status

0x00c

GPIO1_CTRL

GPIO control including function select and overrides

… and so on down to

0x0dc

GPIO29_CTRL

GPIO control including function select and overrides

You can see that there are two registers for each GPIO line from GPIO 0 to GPIO 27, one control register and one status register.

Each register has the same format for each GPIO line. For example, the status register is: 

 

 

Name

Description

Type

31:30

Reserved

 

-

-

29

IRQTOPROC

Interrupt to processors, after override applied

RO

0x0

28

IRQCOMBINED

Interrupt to processors, after masking

RO

0x0

27

EVENT_DB_LEVEL_HIGH

Debounced input pin is high

RO

0x0

26

EVENT_DB_LEVEL_LOW

Debounced input pin is low

RO

0x0

25

EVENT_F_EDGE_HIGH

Input pin has seen a filtered rising edge. Clear with ctrl_irqreset

RO

0x0

24

EVENT_F_EDGE_LOW

Input pin has seen a filtered falling edge. Clear with ctrl_irqreset

RO

0x0

23

EVENT_LEVEL_HIGH

Input pin is high

RO

0x0

22

EVENT_LEVEL_LOW

Input pin is low

RO

0x0

21

EVENT_EDGE_HIGH

Input pin has seen rising edge. Clear with ctrl_irqreset

RO

0x0

20

EVENT_EDGE_LOW

Input pin has seen falling edge. Clear with ctrl_irqreset

RO

0x0

19

INTOPERI

Input signal to peripheral, after override applied

RO

0x0

18

INFILTERED

Input signal from PAD, after filtering is applied but before override. Not valid if inisdirect=1

RO

0x0

17

INFROMPAD

Input signal from PAD before override applied

RO

0x0

16

INISDIRECT

Input signal from PAD without filtering or override

RO

0x0

15:14

Reserved

 

-

-

13

OETOPAD

Output enable to PAD, after override applied

RO

0x0

12

OEFROMPERI

Output enable from selected peripheral, before override applied

RO

0x0

11:10

Reserved

 

-

-

9

OUTTOPAD

Output signal to PAD after override applied

RO

0x0

8

OUTFROMPERI

Output signal from selected peripheral, before override applied

RO

0x0

7:0

Reserved

 

-

-

 

You can see that many of the 32 bits in the register are not used, but bit 9 is OUTTOPAD which is the final state of the GPIO line after register overrides have been applied.



Last Updated ( Tuesday, 04 March 2025 )