General Purpose Input/Output
   HOME

TheInfoList



OR:

A general-purpose input/output (GPIO) is an uncommitted digital signal pin on an
integrated circuit An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuits on one small flat piece (or "chip") of semiconductor material, usually silicon. Large numbers of tiny ...
or electronic circuit (e.g. MCUs/ MPUs ) board which may be used as an input or output, or both, and is controllable by software. GPIOs have no predefined purpose and are unused by default. If used, the purpose and behavior of a GPIO is defined and implemented by the designer of higher assembly-level circuitry: the circuit board designer in the case of integrated circuit GPIOs, or system integrator in the case of board-level GPIOs.


Integrated circuit GPIOs

Integrated circuit (IC) GPIOs are implemented in a variety of ways. Some ICs provide GPIOs as a primary function whereas others include GPIOs as a convenient "accessory" to some other primary function. Examples of the former include the Intel 8255, which interfaces 24 GPIOs to a
parallel communication In data transmission, parallel communication is a method of conveying multiple binary digits ( bits) simultaneously using multiple conductors. This contrasts with serial communication, which conveys only a single bit at a time; this distinction ...
bus, and various GPIO ''expander'' ICs, which interface GPIOs to
serial communication In telecommunication and data transmission, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits a ...
buses such as
I²C I2C (Inter-Integrated Circuit, ), alternatively known as I2C or IIC, is a synchronous, multi-controller/multi-target (master/slave), packet switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors. It is wid ...
and SMBus. An example of the latter is the
Realtek Realtek Semiconductor Corp () is a fabless semiconductor company situated in the Hsinchu Science Park, Hsinchu, Taiwan. Realtek was founded in October 1987 and subsequently listed on the Taiwan Stock Exchange in 1998. Realtek currently manufa ...
ALC260 IC, which provides eight GPIOs along with its main function of
audio codec An audio codec is a device or computer program capable of encoding or decoding a digital data stream (a codec) that encodes or decodes audio. In software, an audio codec is a computer program implementing an algorithm that compresses and decompres ...
.
Microcontroller A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs ( processor cores) along with memory and programmabl ...
ICs usually include GPIOs. Depending on the application, a microcontroller's GPIOs may comprise its primary interface to external circuitry or they may be just one type of I/O used among several, such as
analog signal An analog signal or analogue signal (see spelling differences) is any continuous signal representing some other quantity, i.e., ''analogous'' to another quantity. For example, in an analog audio signal, the instantaneous signal voltage varies ...
I/O, counter/timer, and serial communication. In some ICs, particularly microcontrollers, a GPIO pin may be capable of other functions than GPIO. Often in such cases it is necessary to configure the pin to operate as a GPIO (vis-á-vis its other functions) in addition to configuring the GPIO's behavior. Some microcontroller devices (e.g., Microchip dsPIC33 family) incorporate internal signal routing circuitry that allows GPIOs to be programmatically mapped to device pins.
Field-programmable gate array A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturinghence the term ''Field-programmability, field-programmable''. The FPGA configuration is generally specifi ...
s (FPGA) extend this ability by allowing GPIO pin mapping, instantiation and architecture to be programmatically controlled. File:Ic-photo-Intel--D8255.JPG, Parallel bus interface to 24 GPIOs ( Intel 8255) File:Rockwell R6522P Versatile Interface Adapter.jpg, A "versatile interface adapter", which combines 20 GPIOs with other general-purpose interfaces ( MOS Technology 6522) File:PIC18F8720.jpg, A PIC microcontroller with 29 remappable GPIOs ( Microchip Technology PIC24FJ256)


Board-level GPIOs

Many circuit boards expose board-level GPIOs to external circuitry through integrated electrical connectors. Usually, each such GPIO is accessible via a dedicated connector pin. Like IC-based GPIOs, some boards merely include GPIOs as a convenient, auxiliary resource that augments the board's primary function, whereas in other boards the GPIOs are the central, primary function of the board. Some boards, which are classified usually as multi-function I/O boards, are a combination of both; such boards provide GPIOs along with other types of general-purpose I/O. GPIOs are also found on embedded controller boards such as
Arduino Arduino () is an open-source hardware and software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardware products are licensed under ...
, BeagleBone, and Raspberry Pi. Board-level GPIOs are often given abilities which IC-based GPIOs usually lack. For example, Schmitt-trigger inputs, high-current output drivers,
optical isolator An optical isolator, or optical diode, is an optical component which allows the transmission of light in only one direction. It is typically used to prevent unwanted feedback into an optical oscillator, such as a laser cavity. The operation ...
s, or combinations of these, may be used to buffer and condition the GPIO signals and to protect board circuitry. Also, higher-level functions are sometimes implemented, such as input debounce, input
signal edge In electronics, a signal edge is a transition of a digital signal from low to high or from high to low: * A rising edge (or positive edge) is the low-to-high transition. * A falling edge (or negative edge) is the high-to-low transition. In the ...
detection, and
pulse-width modulation Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a method of reducing the average power delivered by an electrical signal, by effectively chopping it up into discrete parts. The average value of voltage (and current) fed ...
(PWM) output. File:BPI-R1-GPIO.jpg, Network router with three GPIOs (Banana Pi R1) File:HP 82940A GPIO Interface interior.jpg, GPIO interface for Hewlett-Packard Series 80 computers (HP 82940A) File:48 GPIO Ethernet interface.jpg, Ethernet interface to 48 GPIOs (Sensoray 2410)


Usage

GPIOs are used in a diverse variety of applications, limited only by the electrical and timing specifications of the GPIO interface and the ability of software to interact with GPIOs in a sufficiently timely manner. GPIOs usually employ standard logic levels and cannot supply significant current to output loads. When followed by an appropriate high-current output buffer (or mechanical or solid-state relay), a GPIO may be used to control high-power devices such as lights, solenoids, heaters, and motors (e.g., fans and blowers). Similarly, an input buffer, relay or opto-isolator is often used to translate an otherwise incompatible signal (e.g., high voltage) to the logic levels required by a GPIO. Integrated circuit GPIOs are commonly used to control or monitor other circuitry (including other ICs) on a board. Examples of this include enabling and disabling the operation of (or power to) other circuitry, reading the states of on-board switches and configuration shunts, and driving
light-emitting diode A light-emitting diode (LED) is a semiconductor Electronics, device that Light#Light sources, emits light when Electric current, current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy i ...
(LED) status indicators. In the latter case, a GPIO can, in many cases, supply enough output current to directly power an LED without using an intermediate buffer. Multiple GPIOs are sometimes used together as a bit banging communication interface. For example, two GPIOs may be used to implement a serial communication bus such as Inter-Integrated Circuit (
I²C I2C (Inter-Integrated Circuit, ), alternatively known as I2C or IIC, is a synchronous, multi-controller/multi-target (master/slave), packet switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors. It is wid ...
), and four GPIOs can be used to implement a
Serial Peripheral Interface The Serial Peripheral Interface (SPI) is a synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. The interface was developed by Motorola in the mid-1980s and has become a ...
(SPI) bus; these are usually used to facilitate serial communication with ICs and other devices which have compatible serial interfaces, such as sensors (e.g., temperature sensors, pressure sensors,
accelerometer An accelerometer is a tool that measures proper acceleration. Proper acceleration is the acceleration (the rate of change of velocity) of a body in its own instantaneous rest frame; this is different from coordinate acceleration, which is acce ...
s) and motor controllers. Taken to the extreme, this method may be used to implement an entire parallel bus, thus allowing communication with bus-oriented ICs or circuit boards. Although GPIOs are fundamentally digital in nature, they are often used to control linear processes. For example, a GPIO may be used to control motor speed, light intensity, or temperature. Usually, this is done via PWM, in which the duty cycle of the GPIO output signal determines the effective magnitude of the process control signal. For example, when controlling light intensity, the light may be dimmed by reducing the GPIO duty cycle. Some linear processes require a linear control voltage. In such cases, it may be feasible to connect a GPIO, which is operated as a PWM output, to an RC filter to create a simple, low cost
digital-to-analog converter In electronics, a digital-to-analog converter (DAC, D/A, D2A, or D-to-A) is a system that converts a digital signal into an analog signal. An analog-to-digital converter (ADC) performs the reverse function. There are several DAC archit ...
.


Implementation

GPIO interfaces vary widely. In some cases, they are simple—a group of pins that can switch as a group to either input or output. In others, each pin can be set up to accept or source different logic voltages, with configurable drive strengths and pull ups/downs. Input and output voltages are usually, but not always, limited to the supply voltage of the device with the GPIOs, and may be damaged by greater voltages. A GPIO pin's state may be exposed to the software developer through one of a number of different interfaces, such as a
memory-mapped I/O Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) are two complementary methods of performing input/output (I/O) between the central processing unit (CPU) and peripheral devices in a computer. An alternative approach is using dedicated I/O pr ...
peripheral, or through dedicated IO port instructions. Some GPIOs have 5 V tolerant inputs: even when the device has a low supply voltage (such as 2 V), the device can accept 5 V without damage. A GPIO port is a group of GPIO pins (often 8 pins, but it may be less) arranged in a group and controlled as a group. GPIO abilities may include: * GPIO pins can be configured to be input or output * GPIO pins can be enabled/disabled * Input values are readable (usually high or low) * Output values are writable/readable * Input values can often be used as IRQs (usually for wakeup events)


See also

* Programmed input/output * SGPIO * Special input/output


References


External links


GPIO framework for FreeBSD

FreeBSD gpio(3) API manual

FreeBSD gpioctl(8) manual

FreeBSD gpio(4) manual



Linux Kernel Doc on GPIO

LinuxTV GPIO Pins Info
{{DEFAULTSORT:General Purpose Input Output Computer buses Integrated circuits