Forums - GPIO Access

4 posts / 0 new
Last post
GPIO Access
christopher.gage
Join Date: 3 Sep 20
Posts: 3
Posted: Tue, 2020-12-22 08:30

Hello,

I am trying to access the GPIOs from the OEM OS, but I am not sure how the numbers in the Hardware User Manual are mapped in the OS. Is there a list somewhere that spells this out? For a concrete example, I am trying to make GPIO-II (GPIO_78) an output to enable a mezzanine board part. However, in /sys/class/gpio, it looks like I can only access GPIO 1056 up to GPIO 1100 or so.

 

Thank you,

Chris

  • Up0
  • Down0
christopher.gage
Join Date: 3 Sep 20
Posts: 3
Posted: Tue, 2020-12-22 08:54

From a little bit of testing, it looks like if you add 1100 to the target GPIO number that will get you the correct GPIO. For my example where I am looking for GPIO-78, the OS number is 1178.

Let me know if this is correct.

Thank you,

Chris

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Wed, 2020-12-23 16:22

Hi Chris,

The GPIO-II is mapped to GPIO78 in confiuration, it might be used for camera, I will checki it.

From dev list , these gpios could be used

sh-4.4# ls -l /dev/gpio*
crw------- 1 root root 254, 0 Jan 28 15:58 /dev/gpiochip0
crw------- 1 root root 254, 1 Jan 28 15:58 /dev/gpiochip1
crw------- 1 root root 254, 2 Jan 28 15:58 /dev/gpiochip2
crw------- 1 root root 254, 3 Jan 28 15:58 /dev/gpiochip3
crw------- 1 root root 254, 4 Jan 28 15:58 /dev/gpiochip4
crw------- 1 root root 254, 5 Jan 28 15:58 /dev/gpiochip5
crw------- 1 root root 254, 6 Jan 28 15:58 /dev/gpiochip6
sh-4.4# 
 
I will check these GPIO and Pin mapping, and give you update.
 
Thanks
Kevin
 

 

  • Up0
  • Down0
Re: GPIO Access Best Answer
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Wed, 2020-12-30 11:39

HI

sh-4.4# cd /sys/kernel/debug
sh-4.4# cat gpio

You will see these:

gpiochip0: GPIOs 1100-1279, parent: platform/f000000.pinctrl, f000000.pinctrl:
 gpio0   : in  low  func0 2mA pull down
 gpio1   : out low  func0 2mA pull down

The base address is 1100, so for gpio 78,  you can use 1178 to export it.

sh-4.4# echo  1178 > export
sh-4.4# ls -l
total 0
--w------- 1 root root 4096 Jan 28 15:59 export
lrwxrwxrwx 1 root root    0 Jan 28 15:59 gpio1178 -> ../../devices/platform/soc/f000000.pinctrl/gpiochip0/gpio/gpio1178

Please try it.

Thanks

Kevin

 



 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.