npm1300

GPIO — General purpose input/output

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] and is available from 1 mA (default) to 6 mA. 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 from GPIO Pads

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

 

Config for GPIO mode selection

     

GPIINPUT

0

GPI Input

     

GPILOGIC1

1

GPI Logic1

     

GPILOGIC0

2

GPI Logic0

     

GPIEVENTRISE

3

GPI Rising Edge Event

     

GPIEVENTFALL

4

GPI Falling Edge Event

     

GPOIRQ

5

GPO Interrupt

     

GPORESET

6

GPO Reset

     

GPOPLW

7

GPO PwrLossWarn

     

GPOLOGIC1

8

GPO Logic1

     

GPOLOGIC0

9

GPO Logic0

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

 

Config for GPIO mode selection

     

GPIINPUT

0

GPI Input

     

GPILOGIC1

1

GPI Logic1

     

GPILOGIC0

2

GPI Logic0

     

GPIEVENTRISE

3

GPI Rising Edge Event

     

GPIEVENTFALL

4

GPI Falling Edge Event

     

GPOIRQ

5

GPO Interrupt

     

GPORESET

6

GPO Reset

     

GPOPLW

7

GPO PwrLossWarn

     

GPOLOGIC1

8

GPO Logic1

     

GPOLOGIC0

9

GPO Logic0

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

 

Config for GPIO mode selection

     

GPIINPUT

0

GPI Input

     

GPILOGIC1

1

GPI Logic1

     

GPILOGIC0

2

GPI Logic0

     

GPIEVENTRISE

3

GPI Rising Edge Event

     

GPIEVENTFALL

4

GPI Falling Edge Event

     

GPOIRQ

5

GPO Interrupt

     

GPORESET

6

GPO Reset

     

GPOPLW

7

GPO PwrLossWarn

     

GPOLOGIC1

8

GPO Logic1

     

GPOLOGIC0

9

GPO Logic0

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

 

Config for GPIO mode selection

     

GPIINPUT

0

GPI Input

     

GPILOGIC1

1

GPI Logic1

     

GPILOGIC0

2

GPI Logic0

     

GPIEVENTRISE

3

GPI Rising Edge Event

     

GPIEVENTFALL

4

GPI Falling Edge Event

     

GPOIRQ

5

GPO Interrupt

     

GPORESET

6

GPO Reset

     

GPOPLW

7

GPO PwrLossWarn

     

GPOLOGIC1

8

GPO Logic1

     

GPOLOGIC0

9

GPO Logic0

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

 

Config for GPIO mode selection

     

GPIINPUT

0

GPI Input

     

GPILOGIC1

1

GPI Logic1

     

GPILOGIC0

2

GPI Logic0

     

GPIEVENTRISE

3

GPI Rising Edge Event

     

GPIEVENTFALL

4

GPI Falling Edge Event

     

GPOIRQ

5

GPO Interrupt

     

GPORESET

6

GPO Reset

     

GPOPLW

7

GPO PwrLossWarn

     

GPOLOGIC1

8

GPO Logic1

     

GPOLOGIC0

9

GPO Logic0

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

 

Config for GPIO drive strength

     

1MA

0

1mA

     

6MA

1

6mA

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

 

Config for GPIO drive strength

     

1MA

0

1mA

     

6MA

1

6mA

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

 

Config for GPIO drive strength

     

1MA

0

1mA

     

6MA

1

6mA

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

 

Config for GPIO drive strength

     

1MA

0

1mA

     

6MA

1

6mA

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

 

Config for GPIO drive strength

     

1MA

0

1mA

     

6MA

1

6mA

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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for 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

 

Config for GPIO debounce

     

DEBOUNCE0

0

Debounce Disable

     

DEBOUNCE1

1

Debounce Enable

GPIOSTATUS

Address offset: 0x1E

GPIO Status from GPIO Pads

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

 

gpio0Status

     

LOW

0

Input Low

     

HIGH

1

Input High

B

R

GPIO1STATUS

 

gpio1Status

     

LOW

0

Input Low

     

HIGH

1

Input High

C

R

GPIO2STATUS

 

gpio2Status

     

LOW

0

Input Low

     

HIGH

1

Input High

D

R

GPIO3STATUS

 

gpio3Status

     

LOW

0

Input Low

     

HIGH

1

Input High

E

R

GPIO4STATUS

 

gpio4Status

     

LOW

0

Input Low

     

HIGH

1

Input High