3

I have tried to enable the GPIO pins for my system through the Kernel but I am not able to get them to work. When I try this:

echo 1 > /sys/class/gpio/export

The terminal window just closes. When using a different number such as 30, the terminal just hangs and I cannot ctrl-C it. According to everything I read, if GPIO is enabled through the kernel correctly, you should be able to export a GPIO port in sysfs and then you will see each GPIO port in /sys/class/gpio. Example /sys/class/gpio/gpio0 and then you should be able to send it values. I am using Debian 3.11.4.

Jodka Lemon
  • 3,143
  • 13
  • 42
ejo4041
  • 31
  • 4
  • If the `/sys/class/gpio` files are there then the kernel driver is loaded. The hang on write is a little disheartening, but also a little ambiguous since it sound like you don't actually have anything attached to the pins. To test it properly, you'd have to do that, I think. How do you know what's really going on otherwise? – goldilocks Oct 28 '13 at 11:56
  • 1
    I put an Oscilloscope on some of the pins but observed no signal on these lines. echo 1 should just enable port 1, then you should be able to export an actual value. Something is not correct. Everything I read online just says to export the port number and then you can choose input/output and set a value. – ejo4041 Oct 28 '13 at 12:13
  • Is it an embedded system, or do you use some kind of vendor specific kernel? In my experience these can have some weird quirks... – Kotte Oct 28 '13 at 14:00
  • Embedded system. Just a regular Debian kernel. – ejo4041 Oct 28 '13 at 14:23
  • This sounds tricky. Have you checked your board file so the pins are muxed right? Do you know if there could be any kernel module already using the GPIOs? Try mounting debugfs and check GPIO status (`mount -t debugfs debugfs /sys/kernel/debug && cat /sys/kernel/debug/gpio`). If none of the above gives any result then you should probably consider diving into the kernel source code. – Kotte Oct 29 '13 at 10:55
  • Tried that too, there was nothing in there, gave no output. There was some sort of event trigger in the debugfs though. I did something like ls -LR /sys/kernel/debug | grep gpio and saw some event things which were not helpful either. Kernel source sounds like fun...not. I believe some of the GPIO are being used already, but can't find out which ones. – ejo4041 Oct 29 '13 at 15:53

0 Answers0