Hello everyone,
I apologize if this is not in the right section, this is my first post.
I am trying to learn linux and embedded linux programming and I am playing with my newly arrived BBB.
After reading a bit I am trying to do a simple startup exercise by trying to control an LED by writing into /sys/class/gpio/gpiox/value ‘file’.
I have connected an LED and a resistor on pin #3 of P8 connector of my BBB.
According to the BBB usermanual pin#3 of P8 connector is gpio1_6 so, as I understand it the number of this GPIO in software(in the /sys/class/gpio folder should be 38: 1x32 + 6).
So I assumed this pin should be controlled by writing into the file located at /sys/class/gpio/gpio38/value
This is the output from the terminal(I am checking to see if the pin is configured as output then I am trying to write 1 and 0 into the value file to control the LED):
debian@BeagleBone:/sys/class/gpio/gpio38$ cat direction
out
debian@BeagleBone:/sys/class/gpio/gpio38$ echo 1 > value
debian@BeagleBone:/sys/class/gpio/gpio38$ cat value
1
debian@BeagleBone:/sys/class/gpio/gpio38$ echo 0 > value
debian@BeagleBone:/sys/class/gpio/gpio38$ cat value
0
debian@BeagleBone:/sys/class/gpio/gpio38$
From what I can tell everything fine here. However my LED stays on no matter what I do.
This is how I connected the LED on the board:
The green wire is connected on pin3 of P8 which I am trying to control as an output. Then goes into the resistor then into the anode of the Led. The white wire is connected on pin 2 of BBB which should be GND if I understood the schematic correctly and that goes into the anode of the LED.
Please help me understand why the LED is not being controlled as I expected.
Considering the hw wirings are correct, I am assuming I have done a mistake when trying to identify the number the kernel uses to refer to this pin? So when I am writing to pin 38 am not actually controlling gpio1[6] as I expected?
I assume that is the mistake but from what I understood from the materials I’ve read gpio1[6] should be 1x32+6 in software=38.
Please help me understand where I am wrong. Thank you!