Skip to content
View in the app

A better way to browse. Learn more.

Learn more

GPIO pin numbering, old vs new

Featured Replies

So using the old sysfs (/sys/class/gpio/) interface, you "export" a gpio by spitting the gpio number into /sys/class/gpio/export.  The GPIO number depends on the board and relevant documentation.

 

Having once found that I need GPIO number 76, I'm migrating code to the new "gpio character device" interface (/dev/gpiochipn) on my Rock64.  However, "gpioinfo" shows that hardly any gpios have useful labels, and Google searches always turn up Raspberry Pi results.

 

So, can I just calculate the new gpio identify?  Old gpio is 76, all /dev/gpiochips have 32 lines, 76/32 = 2 rem 12, so old gpio 76 is now /dev/gpiochip2 line 12?

 

Edit: I tried this, and it was correct.  Is this anywhere documented to be correct in all/most/many/some cases?

 

Edited by richardk
Tried it.

Guest
This topic is now closed to further replies.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.