GPIO = digital + analog pins; PIO = only digital ?
EDIT: PIO defined in datasheet as "Programmable input/output, also known as general-purpose I/O"
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
GPIO means General Purpose Input/Output.
These pins can be used for general purposes (e.g. LEDs, on/off functionality or anything).
Some GPIO pins can be used for specific functionality, mostly for peripherals, e.g. SPI, UART etc.
I have not seen a pin that is for such specific functionality that cannot be used as a GPIO pin, but I can imagine there are.
Of course there are pins for VCC, GND etc, but those are not I/O pins.
For PIO pins, I think Eugene Sh. gives a good comment. A PIO pin can be programmed and thus can be attached to any peripheral, and also be used as a GPIO pin. So a PIO pin is more versatile than a GPIO pin, since it can be programmed to be connected to any peripheral, while a GPIO pin has a hardwired connection to one or more (but not all) peripherals.
Pin Type Can be attached to Type MCU FPGA ------------ -------------------------------------------- ---------- --- --- GPIO I/O, optionally to subset of peripheral(s) Hardwired x x(?) (non GP)IO I/O, only to subset of peripheral(s) Hardwired ? ? PIO I/O, any peripheral(s) Programmable x non (GP)IO VCC, GND, VBat, VIn etc; not used for I/O Hardwired x x
Any acronym used in a technical doc should be defined. Now, that said...
GPIO means ‘General Purpose Input / Output’. For microcontrollers this customarily means a pin which can be configured through registers by the host to be an input, output, or bidirectional pin.
Sometimes GPIO pins are also shared with other functions. That selection is also by a host register.
Not much ambiguity with GPIO, then.
‘PIO’ on the other hand... can mean several things. Just to name a few: Programmable I/O, Parallel I/O, Peripheral I/O. So you have to get it from context. There’s literature that uses it in each different way, going back to the 8048/8042, 8080, Z80, 6502 and others and even earlier. I’ll leave it up to you, the reader, to unearth all these different variants.
Anyway, back to this decade and century. What does PIO mean? Let’s try for the earliest, most general concept we can find.
PIO, in the context of computer system architecture, is an abstract concept that means ‘Programmed Input / Output’. It means using CPU instructions to move data to or from a resource, purely by software. It is the most basic kind of input and output for a computer. It’s an idea that’s been around since the beginning of computers.
Nowadays, microcontroller/microcomputer CPU access to slow peripherals like serial ports and I2C usually use PIO. Same for GPIO pins.
PIO isn't a 'pin' per se in this computer-science context, but you can define I/O pin sets that uses PIO to access them. A good example is the PC printer port, an 8-bit bidirectional I/O port mapped to x86 I/O space, derived from the Centronics port which dates back to.. 1971. Coincidentally, PC printer port is also a Parallel Input/Output, or ... PIO. Confused? You should be.
Computer-science-y PIO is differentiated from DMA, or Direct Memory Access, which uses dedicated hardware to move data to/from a resource. DMA is used in higher performance computer peripherals such as graphics, networking and storage.
Tying it all together, you would use PIO to set up the GPIO registers to do the desired function: input, output, bidirectional, or a special function that's shared with the pin. You would also use PIO to set up a DMA unit to perform a block transfer to or from Ethernet or to a hard disk. Got an old printer? You might use PIO to talk to... PIO.
General-Purpose Input/Output (GPIO) pins are so-named to distinguish them from peripheral I/O pins.
Each GPIO pin can be configured as a software-readable digital input or a software-writable latched digital output. Occasionally they have a fixed direction, or a direction only programmable for groups of pins, but the term GPIO sticks.
Peripheral I/O pins have specific functions for a specific peripheral, such as a UART transmitter or receiver, an SPI interface, an I2C controller, a timer, an ADC input or a DAC output.
Many devices have I/O pins that can be programmed to be GPIO or a peripheral I/O pin.
The term PIO is much less common than GPIO but I have seen it as a similar, alternate term to GPIO.
PIO can mean 'programmed I/O' where a port is controlled directly by the CPU as opposed to being accessed via DMA (particularly in reference to IDE hard drives and printer ports on PCs).
It can also mean 'Parallel I/O' where data is sent as a group of bits in parallel over several wires at once as opposed to serially over a single wire. One example of this is the Z80 PIO and SIO peripheral chips. The Z80 SIO sends and receives serial data on two dedicated pins, and has other I/O pins which are dedicated to control and status signals. The Z80 PIO has two ports which can each send or receive data 8 bits at a time, or they can be used as individual pins programmed to output or input a single bit (eg. to operate a relay or read the state of a toggle switch).
Early microcontrollers often consisted simply of a CPU and peripheral devices stuck together on a single chip, so they came in large packages with a lot of pins. Modern microcontrollers have shrunk down the number of pins by sharing them with different peripherals, and provide many more functions such as analog to digital converters (ADC), pulse width modulators (PWM), etc.
When a pin is internally connected to a dedicated device such as a UART or ADC it is generally called a 'peripheral' pin, and when connected to a parallel port internally it is called a GPIO or 'general purpose I/O' pin. However it might be just be described as a 'digital' pin, or one bit of a 'port'. Some examples:-
Ports as General Digital I/O The ports are bi-directional I/O ports with optional internal pull-ups. Figure 14-2 shows a functional description of one I/O-port pin, here generically called Pxn.
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs.