3
\$\begingroup\$

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
PD14
PG6, PG7, PG8, PG9

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

Are these all references to GPIO pins?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ My first thought is it is similar to how Arduino has PORTB, PORTC, and PORTD like in this image: peterbeard.co/postimages/digitalwrite/atmega168-pins.png \$\endgroup\$ Commented Oct 2, 2018 at 15:23
  • 2
    \$\begingroup\$ @solve that's really how every microcontroller and other ics are, not just arduino \$\endgroup\$
    – Passerby
    Commented Oct 2, 2018 at 19:10

1 Answer 1

4
\$\begingroup\$

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

\$\endgroup\$

Your Answer

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

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