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.

closed as unclear what you're asking by psusi, cuonglm, Anthon, Archemar, chaos Jul 14 '15 at 6:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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