3

My aim is to control the GPIO pins in Peppermint 4 Linux (Kernel version 3.8.0) on an Intel motherboard (NM70 chipset with C1037U processor).

How can you check whether your kernel supports GPIO on your hardware?

Background

  • Motherboard: Intel with NM70 chipset
  • Processor: C1037U processor
  • OS: Peppermint 4 Linux
  • Kernel version: 3.8.0
  • GPIO interface: sysfs

I'm attempting to use the sysfs interface, which allows GPIO pins to be accessed from userspace through the filesystem.

I’ve successfully followed the "Alternate Build Method: The Old-Fashioned Debian Way" section of https://help.ubuntu.com/community/Kernel/Compile to recompile the kernel in order to expose GPIO access in user space and to turn on debug mode for GPIO:

Once the new kernel was compiled, I was able to see the GPIO folder in /sys/class/gpio for the first time. Then, in theory, it should be a case of being able to turn GPIO ports ON/OFF by writing to the filesystem. This approach is outlined at http://falsinsoft.blogspot.co.uk/2012/11/access-gpio-from-linux-user-space.html.

When attempting to export pins 0 to 255 by

echo XX > /sys/class/gpio/export

for XX from 0 to 255, I get the following error message

echo: write error: No such device

When attempting to export pins outside the range 0 to 255 by

echo XX > /sys/class/gpio/export

I get the following error message

echo: write error: Invalid argument

The tutorial suggests this could be because the GPIO ports are reserved for another program and that, if so, the debug file (/sys/kernel/debug/gpio) would be able to show where they are reserved.

However, /sys/kernel/debug/gpio is empty.

I can see and control the GPIO pins in the BIOS (change pins to be input or output HIGH/LOW).

Related questions

Under what conditions would /sys/kernel/debug/gpio be empty?

writing to /sys/class/gpio/export failing

Community
  • 1
  • 1
CalumJEadie
  • 189
  • 4
  • 12
  • 1
    The easiest way is if you have the *.config* file. See: [GPIO Kconfig](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/gpio/Kconfig?h=linux-3.8.y), which defines the variables that might be set from your board. I think you have built it yourself. The output of `grep GPIO .config` might be helpful. I guess that something might be trying to recognize the hardware and load a module. So, even this output may not be the complete story. As well as the *gpio driver*, there will be some setup code. – artless noise Jun 10 '14 at 16:59
  • Yea, we've built a 3.8.0 kernel to include sysfs support. I'll update the description with more background for other readers. Excellent, we'll investigate that. – CalumJEadie Jun 10 '14 at 17:07
  • Possible duplicate of [Under what conditions would /sys/kernel/debug/gpio be empty?](http://stackoverflow.com/questions/24087761/under-what-conditions-would-sys-kernel-debug-gpio-be-empty) – Ezequiel Garcia May 20 '16 at 00:34

0 Answers0