I am trying to set GPIO pins to high and low state on an Orange Pi using the following command:

echo 0 > /sys/class/gpio_sw/PA1/data
echo 1 > /sys/class/gpio_sw/PA1/data

This turns the pin on and off.

The /sys/class/gpio_sw/ folder has locations labeled

PA0, PA1, PA10, PA13, PA14, PA2, PA21, PA3, PA6, PA7, PA8, PA9
PC4, PC7
PG6, PG7, PG8, PG9

Do the prefixes (PA, PC, PD, PG) have any meaning?

Are these all references to GPIO pins?


The Allwinner SoCs divide their I/O pins into banks, somewhat like many smaller MCUs do. In some Linux versions these designations are passed through in some cases, in others or at least other contexts they are simply re-numbered, probably starting with 0 for PA0, adding 32 for PB0, etc in order to yield a more usual /sys/class/gpio/gpio0 etc

Ultimately you'll have to consult the references (or source) of your particular operating system flavor, its device tree (if utilized, or legacy configuration if not) your board documentation, and possibly the relevant SoC datasheet.

One resource you probably want to consult is http://linux-sunxi.org/GPIO


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.