By default, the general purpose input/output pins, GPIO[n], are set as input with weak pull-down. GPIO is supplied by the VDDIO pin.

The number of GPIOs varies with product variant and package. See Pin assignments for more information about the number of supported GPIOs.

GPIO has the following configurable features:
  • General purpose input
  • Control input
  • Output
  • BUCK control
  • LOADSW control
Note: Events may occur when GPIO configuration is changed on the fly.

Pull-down is prioritized if both pull-up and pull-down are activated on a GPIO pin at the same time.

The following figure shows BUCK control.

Figure 1. GPIO concept
GPIO concept

Pins LED0, LED1, and LED2 can be used as open-drain outputs, see LEDDRV — LED drivers.

Pin configuration

The GPIO peripheral implements up to 5 pins, GPIO[0...4]. Each of these pins can be individually configured in the GPIOMODE[n] registers.

General purpose input

GPIO can be used as a general purpose input to monitor the input logic level. Debounce is set in register GPIO.DEBOUNCE[n]. Set GPI.INPUT to use GPIO[n] without setting an event.

It can also be used as an input to trigger an event. Set bit GPI.RISING.EVENT to generate an event on the rising edge. To generate an event on a falling edge, set bit GPI.FALLING.EVENT. The events are visible in the register EVENTSGPIOSET.

To override GPIO input states, set bit GPI.LOGIC[n].

Control input

For a pin to function as a control input, write 0 in bit GPI.INPUT. Debounce is set in register GPIO.DEBOUNCE[n]. The following components can be controlled through GPIO once enabled in the corresponding register.

Output

The GPIO outputs can be configured as logic outputs or open drain outputs in register GPIO.OPEN.DRAIN[n].

When setting a GPIO as output, the host software disables any pull-up or pull-down on that GPIO. After a reset, the default is for pull-down to be enabled.

GPIO can be used as a general purpose output by setting bit GPO.LOGIC[n].

GPIO can be used as an interrupt by setting one or more from the following registers:

GPIO can indicate a watchdog event when the watchdog expires. Select bit GPO.RESET to enable watchdog events.

An imminent power failure warning can be set by selecting bit GPO.PLW.

Drive strength can be selected in register GPIODRIVE[0]. Weak pull-up and pull-down resistors are available in the following registers:

Electrical specification

Table 1. GPIO electrical specification
Symbol Description Min. Typ. Max. Unit
VIH Input high voltage 0.7 x VDDIO VDDIO V
VIL Input low voltage AVSS 0.3 x VDDIO V
PUGPIO Weak pull-up resistor 500
PDGPIO Weak pull-down resistor 500
DBGPIO Input debounce time (DEBOUNCE1=1) 20 ms

Registers

Instances

Instance Base address Description
GPIOS 0x00000600

GPIO Registers

GPIOS register map

Register overview

Register Offset Description
GPIOMODE[0] 0x0

GPIO mode configuration

GPIOMODE[1] 0x1

GPIO mode configuration

GPIOMODE[2] 0x2

GPIO mode configuration

GPIOMODE[3] 0x3

GPIO mode configuration

GPIOMODE[4] 0x4

GPIO mode configuration

GPIODRIVE[0] 0x5

GPIO drive strength configuration

GPIODRIVE[1] 0x6

GPIO drive strength configuration

GPIODRIVE[2] 0x7

GPIO drive strength configuration

GPIODRIVE[3] 0x8

GPIO drive strength configuration

GPIODRIVE[4] 0x9

GPIO drive strength configuration

GPIOPUEN[0] 0xA

GPIO pull up enable configuration

GPIOPUEN[1] 0xB

GPIO pull up enable configuration

GPIOPUEN[2] 0xC

GPIO pull up enable configuration

GPIOPUEN[3] 0xD

GPIO pull up enable configuration

GPIOPUEN[4] 0xE

GPIO pull up enable configuration

GPIOPDEN[0] 0xF

GPIO pull down enable configuration

GPIOPDEN[1] 0x10

GPIO pull down enable configuration

GPIOPDEN[2] 0x11

GPIO pull down enable configuration

GPIOPDEN[3] 0x12

GPIO pull down enable configuration

GPIOPDEN[4] 0x13

GPIO pull down enable configuration

GPIOOPENDRAIN[0] 0x14

GPIO open drain configuration

GPIOOPENDRAIN[1] 0x15

GPIO open drain configuration

GPIOOPENDRAIN[2] 0x16

GPIO open drain configuration

GPIOOPENDRAIN[3] 0x17

GPIO open drain configuration

GPIOOPENDRAIN[4] 0x18

GPIO open drain configuration

GPIODEBOUNCE[0] 0x19

GPIO debounce configuration

GPIODEBOUNCE[1] 0x1A

GPIO debounce configuration

GPIODEBOUNCE[2] 0x1B

GPIO debounce configuration

GPIODEBOUNCE[3] 0x1C

GPIO debounce configuration

GPIODEBOUNCE[4] 0x1D

GPIO debounce configuration

GPIOSTATUS 0x1E

GPIO status

GPIOMODE[0]

Address offset: 0x0

GPIO mode configuration

Bit number 7 6 5 4 3 2 1 0
ID A A A A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOMODE

GPIO mode selection

GPIINPUT

0

Input

GPILOGIC1

1

Input, internally driven high

GPILOGIC0

2

Input, internally driven low

GPIEVENTRISE

3

Input, event from rising edge

GPIEVENTFALL

4

Input, event from falling edge

GPOIRQ

5

Interrupt output

GPORESET

6

Reset output

GPOPLW

7

Power failure warning output

GPOLOGIC1

8

Output, pin driven high

GPOLOGIC0

9

Output, pin driven low

GPIOMODE[1]

Address offset: 0x1

GPIO mode configuration

Bit number 7 6 5 4 3 2 1 0
ID A A A A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOMODE

GPIO mode selection

GPIINPUT

0

Input

GPILOGIC1

1

Input, internally driven high

GPILOGIC0

2

Input, internally driven low

GPIEVENTRISE

3

Input, event from rising edge

GPIEVENTFALL

4

Input, event from falling edge

GPOIRQ

5

Interrupt output

GPORESET

6

Reset output

GPOPLW

7

Power failure warning output

GPOLOGIC1

8

Output, pin driven high

GPOLOGIC0

9

Output, pin driven low

GPIOMODE[2]

Address offset: 0x2

GPIO mode configuration

Bit number 7 6 5 4 3 2 1 0
ID A A A A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOMODE

GPIO mode selection

GPIINPUT

0

Input

GPILOGIC1

1

Input, internally driven high

GPILOGIC0

2

Input, internally driven low

GPIEVENTRISE

3

Input, event from rising edge

GPIEVENTFALL

4

Input, event from falling edge

GPOIRQ

5

Interrupt output

GPORESET

6

Reset output

GPOPLW

7

Power failure warning output

GPOLOGIC1

8

Output, pin driven high

GPOLOGIC0

9

Output, pin driven low

GPIOMODE[3]

Address offset: 0x3

GPIO mode configuration

Bit number 7 6 5 4 3 2 1 0
ID A A A A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOMODE

GPIO mode selection

GPIINPUT

0

Input

GPILOGIC1

1

Input, internally driven high

GPILOGIC0

2

Input, internally driven low

GPIEVENTRISE

3

Input, event from rising edge

GPIEVENTFALL

4

Input, event from falling edge

GPOIRQ

5

Interrupt output

GPORESET

6

Reset output

GPOPLW

7

Power failure warning output

GPOLOGIC1

8

Output, pin driven high

GPOLOGIC0

9

Output, pin driven low

GPIOMODE[4]

Address offset: 0x4

GPIO mode configuration

Bit number 7 6 5 4 3 2 1 0
ID A A A A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOMODE

GPIO mode selection

GPIINPUT

0

Input

GPILOGIC1

1

Input, internally driven high

GPILOGIC0

2

Input, internally driven low

GPIEVENTRISE

3

Input, event from rising edge

GPIEVENTFALL

4

Input, event from falling edge

GPOIRQ

5

Interrupt output

GPORESET

6

Reset output

GPOPLW

7

Power failure warning output

GPOLOGIC1

8

Output, pin driven high

GPOLOGIC0

9

Output, pin driven low

GPIODRIVE[0]

Address offset: 0x5

GPIO drive strength configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODRIVE

GPIO drive strength

1MA

0

1 mA

6MA

1

6 mA

GPIODRIVE[1]

Address offset: 0x6

GPIO drive strength configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODRIVE

GPIO drive strength

1MA

0

1 mA

6MA

1

6 mA

GPIODRIVE[2]

Address offset: 0x7

GPIO drive strength configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODRIVE

GPIO drive strength

1MA

0

1 mA

6MA

1

6 mA

GPIODRIVE[3]

Address offset: 0x8

GPIO drive strength configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODRIVE

GPIO drive strength

1MA

0

1 mA

6MA

1

6 mA

GPIODRIVE[4]

Address offset: 0x9

GPIO drive strength configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODRIVE

GPIO drive strength

1MA

0

1 mA

6MA

1

6 mA

GPIOPUEN[0]

Address offset: 0xA

GPIO pull up enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOPUEN

GPIO pull up enable

PULLUP0

0

Pull up disable

PULLUP1

1

Pull up enable

GPIOPUEN[1]

Address offset: 0xB

GPIO pull up enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOPUEN

GPIO pull up enable

PULLUP0

0

Pull up disable

PULLUP1

1

Pull up enable

GPIOPUEN[2]

Address offset: 0xC

GPIO pull up enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOPUEN

GPIO pull up enable

PULLUP0

0

Pull up disable

PULLUP1

1

Pull up enable

GPIOPUEN[3]

Address offset: 0xD

GPIO pull up enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOPUEN

GPIO pull up enable

PULLUP0

0

Pull up disable

PULLUP1

1

Pull up enable

GPIOPUEN[4]

Address offset: 0xE

GPIO pull up enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOPUEN

GPIO pull up enable

PULLUP0

0

Pull up disable

PULLUP1

1

Pull up enable

GPIOPDEN[0]

Address offset: 0xF

GPIO pull down enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x01 0 0 0 0 0 0 0 1
ID R/W Field Value ID Value Description
A

RW

GPIOPDEN

GPIO pull down enable

PULLDOWN0

0

Pull down disable

PULLDOWN1

1

Pull down enable

GPIOPDEN[1]

Address offset: 0x10

GPIO pull down enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x01 0 0 0 0 0 0 0 1
ID R/W Field Value ID Value Description
A

RW

GPIOPDEN

GPIO pull down enable

PULLDOWN0

0

Pull down disable

PULLDOWN1

1

Pull down enable

GPIOPDEN[2]

Address offset: 0x11

GPIO pull down enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x01 0 0 0 0 0 0 0 1
ID R/W Field Value ID Value Description
A

RW

GPIOPDEN

GPIO pull down enable

PULLDOWN0

0

Pull down disable

PULLDOWN1

1

Pull down enable

GPIOPDEN[3]

Address offset: 0x12

GPIO pull down enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x01 0 0 0 0 0 0 0 1
ID R/W Field Value ID Value Description
A

RW

GPIOPDEN

GPIO pull down enable

PULLDOWN0

0

Pull down disable

PULLDOWN1

1

Pull down enable

GPIOPDEN[4]

Address offset: 0x13

GPIO pull down enable configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x01 0 0 0 0 0 0 0 1
ID R/W Field Value ID Value Description
A

RW

GPIOPDEN

GPIO pull down enable

PULLDOWN0

0

Pull down disable

PULLDOWN1

1

Pull down enable

GPIOOPENDRAIN[0]

Address offset: 0x14

GPIO open drain configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOOPENDRAIN

GPIO open drain

OPENDRAIN0

0

Open drain disable

OPENDRAIN1

1

Open drain enable

GPIOOPENDRAIN[1]

Address offset: 0x15

GPIO open drain configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOOPENDRAIN

GPIO open drain

OPENDRAIN0

0

Open drain disable

OPENDRAIN1

1

Open drain enable

GPIOOPENDRAIN[2]

Address offset: 0x16

GPIO open drain configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOOPENDRAIN

GPIO open drain

OPENDRAIN0

0

Open drain disable

OPENDRAIN1

1

Open drain enable

GPIOOPENDRAIN[3]

Address offset: 0x17

GPIO open drain configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOOPENDRAIN

GPIO open drain

OPENDRAIN0

0

Open drain disable

OPENDRAIN1

1

Open drain enable

GPIOOPENDRAIN[4]

Address offset: 0x18

GPIO open drain configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIOOPENDRAIN

GPIO open drain

OPENDRAIN0

0

Open drain disable

OPENDRAIN1

1

Open drain enable

GPIODEBOUNCE[0]

Address offset: 0x19

GPIO debounce configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODEBOUNCE

GPIO debounce

DEBOUNCE0

0

Debounce disable

DEBOUNCE1

1

Debounce enable

GPIODEBOUNCE[1]

Address offset: 0x1A

GPIO debounce configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODEBOUNCE

GPIO debounce

DEBOUNCE0

0

Debounce disable

DEBOUNCE1

1

Debounce enable

GPIODEBOUNCE[2]

Address offset: 0x1B

GPIO debounce configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODEBOUNCE

GPIO debounce

DEBOUNCE0

0

Debounce disable

DEBOUNCE1

1

Debounce enable

GPIODEBOUNCE[3]

Address offset: 0x1C

GPIO debounce configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODEBOUNCE

GPIO debounce

DEBOUNCE0

0

Debounce disable

DEBOUNCE1

1

Debounce enable

GPIODEBOUNCE[4]

Address offset: 0x1D

GPIO debounce configuration

Bit number 7 6 5 4 3 2 1 0
ID A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

RW

GPIODEBOUNCE

GPIO debounce

DEBOUNCE0

0

Debounce disable

DEBOUNCE1

1

Debounce enable

GPIOSTATUS

Address offset: 0x1E

GPIO status

Bit number 7 6 5 4 3 2 1 0
ID E D C B A
Reset 0x00 0 0 0 0 0 0 0 0
ID R/W Field Value ID Value Description
A

R

GPIO0STATUS

GPIO0 status

LOW

0

Low

HIGH

1

High

B

R

GPIO1STATUS

GPIO1 status

LOW

0

Low

HIGH

1

High

C

R

GPIO2STATUS

GPIO2 status

LOW

0

Low

HIGH

1

High

D

R

GPIO3STATUS

GPIO3 status

LOW

0

Low

HIGH

1

High

E

R

GPIO4STATUS

GPIO4 status

LOW

0

Low

HIGH

1

High