Power & Source of Big Ideas

Pins 6 and 7

Moderators: chensy, FATechsupport

What Linux GPIO numbers do single row Pins 6 and 7 correspond to?

6 GPIOL11/IR-RX - Linux GPIO # ?
7 SPDIF-OUT/GPIOA17 - Linux GPIO # ?
tadvi wrote:
What Linux GPIO numbers do single row Pins 6 and 7 correspond to?

6 GPIOL11/IR-RX - Linux GPIO # ?
7 SPDIF-OUT/GPIOA17 - Linux GPIO # ?


Hello,
Accessing the GPIO pins through sysfs with mainline kernel The GPIO pins can be accessed from user space using sysfs. To enabled this you need the following kernel option enabled: CONFIG_GPIO_SYSFS

Device Drivers ---> GPIO Support ---> /sys/class/gpio/... (sysfs interface)
To access a GPIO pin you first need to export it with

echo XX > /sys/class/gpio/export
with XX being the number of the desired pin. To obtain the correct number you have to calculate it from the pin name (like PH18)[1]:

(position of letter in alphabet - 1) * 32 + pin number
E.g for PH18 this would be ( 8 - 1) * 32 + 18 = 224 + 18 = 242 (since 'h' is the 8th letter).

After you have successfully exported the pin you can access it through /sys/class/gpio/gpio*NUMBER* (in case of PH18 it's /sys/class/gpio/gpio242).

With /sys/class/gpio/gpio*NUMBER*/direction you can set the pin to out or in using

echo "out" > /sys/class/gpio/gpio*NUMBER*/direction
and you can read/write the value with /sys/class/gpio/gpio*NUMBER*/value.

When you are done unexport the pin with

echo XX > /sys/class/gpio/unexport
Good question, the Neo Wiki does only provide Linux GPIO numbers for the double row connections:
http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO#Layout
Thank you "jjm" for very detailed answer.

Based on it pin 7 GPIOA17 should be Linux PIN 17. Unfortunately this does not work. I have just tried it by connecting relay to it. Other GPIO pins work (pins on two rows) and switch the relay ON/OFF but not PIN 17.

Based on calculation pin 6 GPIOL11 should be Linux PIN 363 which is calculated as (11*32)+11. Please confirm.

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 2865 on Sun Nov 10, 2019 5:27 am

Users browsing this forum: No registered users and 9 guests