Hi,
I connected a green LED and a 600ohm resistor between pin 18 and 2 of the 40pin GPIO connector.
The LED lights up at startup but if I change the gpio state (/sys/class/gpio51) to 0 the LED is still
on. I checked the pins several times... no idea.
I use arch linux 2.6.35-8-ARCH+ without modifications.
Quote from: Hellgringo on October 30, 2012, 05:38:12 PM
The LED lights up at startup but if I change the gpio state (/sys/class/gpio51) to 0 the LED is still
on.
To help you beter, we need to know your sequence to change state. If pin is defined in kernel as GPIO ,try this sequence:
Export and set direction:
echo 51 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio51/direction
Change value on pin 51:
echo 0 > /sys/class/gpio/gpio51/value
echo 1 > /sys/class/gpio/gpio51/value
echo 0 > /sys/class/gpio/gpio51/value
Regards
Fadil Berisha
I tried it this way which worked for the onboard led
echo out > /sys/class/gpio/gpio65/direction
echo 0 > /sys/class/gpio/gpio65/value
echo 1 > /sys/class/gpio/gpio65/value
echo 0 > /sys/class/gpio/gpio65/value
the same thing for gpio51 didn't work.
The following command results in an error
echo 51 > /sys/class/gpio/export
-bash: echo: write error: Device or resource busy
Regards
Holger
Sorry, my fault.
There was a short circuit...
I have another question, what would be the fastest way to read the gpios values with in a C program?
I thought of opening the gpios as files, read the content and close. But I think this won't be very
fast cause of the usage of open() close() sys calls.
Thx
http://olimex.wordpress.com/2012/09/11/imx233-olinuxino-gpios-faster-and-faster/ using /dev/mem is the fastest