AnsweredAssumed Answered

How To Access GPIO Pins From Linux User Space On LS1021A

Question asked by Patrick Morrow on Apr 20, 2015
Latest reply on Apr 21, 2015 by Patrick Morrow

We've managed to get a yocto Linux build up and running on a custom board populated with a LS1021A utilizing the 1.7 sdk.  We've also managed to run some simple programs on our board that we've built using Codewarrior, mostly baby steps like hello world type stuff that will print out to the terminal, just to make sure that we can.  Now we're ready to try something a little more in depth, namely wiggling GPIO pins, but we can't seem to find any information that would tell us the absolute addresses of the pins we wish to drive.


We've found documentation, both within these forums and elsewhere on the internet, telling us that in order to drive a GPIO pin from Linux user space we need to navigate to /sys/class/gpio, which we do, and then: echo XX > export, where XX would be the address of the pin that we want to establish a connection to (we're aware that what was just written is terminal based, but for the sake of removing all possible things that can cause an issue, we've decided to attempt a terminal solution before translating it into something that can be run from a C program).  Our goal is to drive pins GPIO3[3], GPIO3[4] and GPIO3[5], but we get stuck trying to find some kind of conversion that will give us absolute values for those 3 pins.


When we list the contents of the /sys/class/gpio directory we notice that there are sub directories labeled gpiochip128, gpiochip160, gpiochip192, and gpiochip224.  Do those correspond to the different GPIO ports and associated pins?