GPIO Technology Guide

Discusses GPIO technology as specified for implementation as a platform service.

Purpose

GPIO (General Purpose Input/Output) is a communication interface between microprocessor components. GPIOs consist of binary inputs/outputs called pins, arranged in groups called modules, typically of up to 32 pins in a module. GPIO is often used to implement hardware interrupts and CPU wakeup and also to control peripherals.

The GPIO interface defines a single static exported class GPIO for device drivers to use to access the GPIO hardware on the device. The platform service does not provide an implementation of the class. When you implement a board support package for device hardware with GPIO hardware, you should provide an implementation of the class in a variant-specific component.

Key concepts

Certain terms have a specific meaning in the context of GPIO.

module

A group of pins which can be mapped on to a register.

function

The purpose for which the pins and modules are used. GPIO is one such purpose: serial bus line signals are an example of a different function.

state

Electrical states as mapped on to mode, direction and logical state.

configuration

The current configuration of all the pins on a module: their direction, electrical and logical state, interrupt and wakeup enablement status.

Design features

The GPIO interface reserves most decisions about implementation design for the hardware implementers. However, certain design features are implicit in the interface provided.

These are the main features of the GPIO interface:

  • The interface is supplied as a single static exported interface to be implemented as a variant specific component.

  • The access APIs are specified at pin level. There are no module level APIs.

  • The pin IDs are defined in a single enumeration with values to be determined at build time.

  • Bidirectional input/output is not supported.

  • Electrical states intermediate between High and Low are not supported.

  • It is strongly recommended that debouncing should be implemented in software if it is not provided with the hardware.

  • There is limited support for extensions to the functionality within the framework of the static interface.