You are not logged in.

#1 2018-12-01 11:49:34

sophist_outsell_frogman
Member
Registered: 2018-12-01
Posts: 3

How to identify GPIO pin numbers? Is GPIO driver loaded?

Dear community,

I am trying to get the GPIO pins on my mainboard working but I don't know the numbers/descriptions of the pins and if a driver is loaded or not.

I found this guide (https://www.emcraft.com/stm32f429discov … user-space) where it says that I should echo the pin description and redirect the output into /sys/class/gpio/export

/sys/class/gpio # echo 0 > export

So I did. The /sys/class/gpio/ folder exists on my system and it contains the following:

[user@host ~]$ ls -l /sys/class/gpio/
total 0
--w------- 1 root root 4096 Nov 30 18:12 export
--w------- 1 root root 4096 Nov 30 18:12 unexport
[user@host ~]$ 

(By the way if I see this folder does it mean a driver is loaded?) 
Then I tried several pin names from the datasheet of my mainboard but I always get the following

[root@host gpio]# echo 31 > export 
echo: write error: Invalid argument
[root@host gpio]# 

I am using Arch Linux and my kernel version is 4.19.2-arch1-1-ARCH
The Mainboard I use is a Supermicro X10SBA. https://www.supermicro.com/products/mot … x10sba.cfm

The only thing I can find about GPIOs on the Motherboard is on Page 2-25 in the X10SBA Mainboard Datasheet :

1 +3.3V 
2 SOC_P3V3_GPIO_S5_31 
3 SOC_P3V3_GPIO_S5_32 
4 SOC_P3V3_GPIO_S5_33 
5 SOC_P3V3_GPIO_S5_34 
6 SOC_P3V3_GPIO_S5_35 
7 SOC_P3V3_GPIO_S5_36 
8 SOC_P3V3_GPIO_S5_37 
9 SOC_P3V3_GPIO_S5_38 
10 GND 

From my understanding it means the board has eight GPIOs.

So I tried to echo various different combinations into /sys/class/gpio/export like

echo SOC_P3V3_GPIO_S5_31 > export
echo 111 > export
echo 531 > export
echo S531 > export
echo S5_31 > export
...

And so on. Nothing helped. 
Am I doing something fundamentally wrong here? Where are the definitions of these GPIO names? Where does export get its information from? Do I have to make these definitions myself first? Maybe do I have to recompile my kernel?

I went on and tried to find out which chip is used for the GPIO headers.
 
Next to the GPIO Pin headers (JP1) on the board, there is a Chip NXP GTL2010 (Datasheet) and the pins are connected to it from D1 through to D8. I guess this chip is just doing some voltage translation to make the output 3.3V or 5V. So the signal must be coming from The S1-S8 pins. Unfortunately I could not find where these source pins  of the GTL2010 are connected to as the traces lead to vias on the board.

But I assume the pins go directly to the CPU. I'm not 100% sure on that. But its my assumption.

The CPU on board is an Intel Celeron J1900. But unfortunately I couln't find a datasheet or any information about it if it has GPIOs.

I am stuck and I would highly appreciate your help. Is there some possibility to list the GPIOs on board in Linux? How can I check if there is already some GPIO driver used on my system? If there is no driver, how can I make my own one? Do I have to use some configuration file and recompile the kernel?

Looking forward your answers! Thanks a lot.

Offline

#2 2018-12-01 13:39:30

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: How to identify GPIO pin numbers? Is GPIO driver loaded?

Welcome to the arch linux forums sophist_outsell_frogman. https://www.kernel.org/doc/html/latest/ … e-optional
Did you try echoing any values in the range 0-9 to /sys/class/gpio/export  ?  If the GPIO lines are connected what are you attempting to do exactly?

Offline

#3 2018-12-01 14:07:27

sophist_outsell_frogman
Member
Registered: 2018-12-01
Posts: 3

Re: How to identify GPIO pin numbers? Is GPIO driver loaded?

Thank you for your answer loqs. Yes I tried these values already. I want to switch a relay to control a circuit. I use the board as a server. I thought I could make use of the onboard GPIOs instead of using a Rapsberry Pi. An alternative would be to use a microcontroller which does the switching and talks to my board via serial. But I have GPIO pins already available on the mainboard so it would be nice to make use of it directly.

Offline

#4 2018-12-01 14:15:49

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: How to identify GPIO pin numbers? Is GPIO driver loaded?

If there are no nodes of the form /sys/class/gpio/gpiochipN/ from my understanding that would indicate the kernel has not detected any GPIO chips.

Offline

#5 2018-12-01 14:35:42

sophist_outsell_frogman
Member
Registered: 2018-12-01
Posts: 3

Re: How to identify GPIO pin numbers? Is GPIO driver loaded?

But how can I configure it? Do I need to create a configuration file for gpiolib or something like that? How would the kernel detect it automatically?

Offline

#6 2018-12-01 17:21:29

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: How to identify GPIO pin numbers? Is GPIO driver loaded?

Is there a gpiochip0 entry under /dev?   The sysfs interface is deprecated and modern usage calls for ioctl on the character device. 
Grab the kernel source and look under tools/gpio for examples.  I am using python at work using ctypes to link to the gpio-utils from the referenced directory.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB