4
\$\begingroup\$

GPIO = digital + analog pins; PIO = only digital ?

EDIT: PIO defined in datasheet as "Programmable input/output, also known as general-purpose I/O"

\$\endgroup\$
11
  • 2
    \$\begingroup\$ GPIO == General Purpose I/O. PIO = Parallel I/O or Programmable I/O. \$\endgroup\$
    – Janka
    Jul 18, 2019 at 16:09
  • 2
    \$\begingroup\$ These things are pretty much unrelated to each other. GPIO is a General Purpose IO - meaning these are not connected to a specialized interface. PIO is Programmable IO, meaning that it can be connected to any interface present on the chip. The latter present mostly on FPGAs, while GPIO is on microcontrollers and such. \$\endgroup\$
    – Eugene Sh.
    Jul 18, 2019 at 16:09
  • 1
    \$\begingroup\$ @Janka Looks like we have different interpretations, meaning that we probably need to close this question :) \$\endgroup\$
    – Eugene Sh.
    Jul 18, 2019 at 16:10
  • 6
    \$\begingroup\$ These acronyms do not have standardized definitions. They should always be defined the first time they are used in any document. \$\endgroup\$ Jul 18, 2019 at 16:22
  • 1
    \$\begingroup\$ @ElliotAlderson Added the definition from the document \$\endgroup\$
    – imrich
    Jul 18, 2019 at 18:49

5 Answers 5

6
\$\begingroup\$

Any acronym used in a technical doc should be defined.

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, such as UART, SPI or I2C. That mode 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: Programmed I/O, Parallel I/O, Peripheral I/O, and as you note, Programmable I/O. Pretty overloaded, that acronym.

To figure it out you have to get it from context. There’s literature that uses it in each different way in 8048/8042, 8080, Z80, 6502 and even earlier with minicomputers and mainframes. I’ll leave it up to you, the reader, to unearth all these different variants of PIO.

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 software-driven CPU instructions to move data to or from a resource. It is the most basic kind of input and output for a computer, an idea that’s been around since the beginning of computers.

Nowadays, microcontroller / microcomputer CPUs use PIO to access slow peripherals like serial ports and I2C and GPIO pins.

To be clear, the ‘P’ in ‘PIO’ isn’t 'pin' in any context, but most especially in the computer science context. You can however define I/O pin sets to use PIO (Programmed I/O) to access them. A good, well-known example is the PC printer port, which is an 8-bit I/O port mapped to x86 I/O space. Its function is based on the Centronics printer port which dates back to... 1971.

It can then be said that the PC printer port is a Parallel I/O, mapped as a Peripheral I/O, accessed by Programmed Input / Output. Or ... a PIO that’s mapped as a PIO accessed by PIO. Confused? You should be.

Let’s get back to that earliest definition then. Computer science-y PIO (Programmed I/O) is differentiated from Direct Memory Access, or DMA, which uses dedicated hardware to efficiently move data without burdening the CPU. DMA is used for higher performance computer peripherals such as graphics, networking and storage.

Tying it all together, you would use PIO (software-driven CPU load/store) 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.

\$\endgroup\$
2
  • \$\begingroup\$ Upvoted your answer too because of the explanation. \$\endgroup\$ Jul 18, 2019 at 20:15
  • \$\begingroup\$ To me, PIO essentially means bit banging. \$\endgroup\$ Jul 19, 2019 at 4:57
5
\$\begingroup\$

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.

Summary:

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
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Good description of GPIO, basically what I was about to say. What about PIO? Is it just a subset of GPIO, or does it have its own specific characteristics? \$\endgroup\$
    – Mattman944
    Jul 18, 2019 at 16:23
  • \$\begingroup\$ I tried to address it in my answer. \$\endgroup\$ Jul 18, 2019 at 16:42
  • 1
    \$\begingroup\$ See my above comment about PIO, meaning programmed I/O as opposed to DMA. Regardless, in technical docs acronyms should be defined in their context. \$\endgroup\$ Jul 18, 2019 at 17:02
  • 1
    \$\begingroup\$ Are you talking about some particular family of parts? Microcontrollers or FPGAs or CPLDs or what? \$\endgroup\$
    – The Photon
    Jul 18, 2019 at 17:22
  • \$\begingroup\$ @hacktastical Added definition of PIO from the document to my question. \$\endgroup\$
    – imrich
    Jul 18, 2019 at 18:50
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

Raspberry Pi micro controllers have their own precise definition of PIO given at: https://www.raspberrypi.com/news/what-is-pio/ I am not sure exactly how much it it representative of usage by other vendors.

The video linked to on that page: https://www.youtube.com/watch?v=ODlB05xMg04 explains their definition well. Basically it is a way to offload bit banging to a dedicated on-chip signal generator in order to reduce load on the micro controller, as bit banging can require rather slow signaling timing which would mean many MC cycles wasted.

The Raspberry Pi Pico has some pins which are classified as PIO pins and can be used for this programmable output, and other pins classified as GPIO pins which cannot.

\$\endgroup\$
-1
\$\begingroup\$

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:-

ATmega328p

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.

AT89S51

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.