1
\$\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\$
  • 2
    \$\begingroup\$ GPIO == General Purpose I/O. PIO = Parallel I/O or Programmable I/O. \$\endgroup\$ – Janka Jul 18 at 16:09
  • 1
    \$\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 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 at 16:10
  • 5
    \$\begingroup\$ These acronyms do not have standardized definitions. They should always be defined the first time they are used in any document. \$\endgroup\$ – Elliot Alderson Jul 18 at 16:22
  • 1
    \$\begingroup\$ PIO is GPIO in low-G environments. wacka-wacka \$\endgroup\$ – Scott Seidman Jul 18 at 20:07
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\$
  • 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 at 16:23
  • \$\begingroup\$ I tried to address it in my answer. \$\endgroup\$ – Michel Keijzers Jul 18 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\$ – hacktastical Jul 18 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 at 17:22
  • \$\begingroup\$ @hacktastical Added definition of PIO from the document to my question. \$\endgroup\$ – imrich Jul 18 at 18:50
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Upvoted your answer too because of the explanation. \$\endgroup\$ – Michel Keijzers Jul 18 at 20:15
  • \$\begingroup\$ To me, PIO essentially means bit banging. \$\endgroup\$ – R.. Jul 19 at 4:57
0
\$\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\$
-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, privacy policy and cookie policy

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