All the package are installed.
This is gpioinfo output with Mikrobus driver enabled:
gpiochip3 - 88 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: "SPE_RSTN" "PHY reset" output active-low [used]
line 6: "SPE_INTN" unused input active-high
line 7: "MIKROBUS_GPIO1_7" "mikrobus" output active-high [used]
line 8: "MIKROBUS_GPIO1_8" "mikrobus" output active-high [used]
line 9: "MIKROBUS_GPIO1_9" "mikrobus" output active-high [used]
line 10: "MIKROBUS_GPIO1_10" "mikrobus" output active-high [used]
line 11: "MIKROBUS_GPIO1_11" "mikrobus" output active-high [used]
line 12: "MIKROBUS_GPIO1_12" "mikrobus" output active-high [used]
line 13: "MIKROBUS_W1_GPIO0" "w1-gpio.0" output active-high [used open-drain]
line 14: "MIKROBUS_GPIO1_14" "mikrobus" output active-high [used]
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: "VDD_3V3_SD" "regulator-4" output active-high [used]
line 20: unnamed unused input active-high
line 21: unnamed unused input active-high
line 22: "MIKROBUS_GPIO1_22" "mikrobus" output active-high [used]
line 23: "MIKROBUS_GPIO1_23" "mikrobus" output active-high [used]
line 24: "MIKROBUS_GPIO1_24" "mikrobus" output active-high [used]
line 25: "MIKROBUS_GPIO1_25" "mikrobus" output active-high [used]
Now if I try to access MIKROBUS_GPIO1_7 pin I get an error:
root@BeaglePlay:/home/debian# echo 318 > /sys/class/gpio/gpiochip311/subsystem/export
bash: echo: write error: Device or resource busy
an it’s OK because it’s used by mikrobus layer.
Then I disable the Mikrobus layer as explained before by editing /boot/firmware/extlinux/extlinux.conf and reboot using reboot command without unplugging power from the board.
Now the output of gpioinfo is:
gpiochip3 - 88 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: "SPE_RSTN" "PHY reset" output active-low [used]
line 6: "SPE_INTN" unused input active-high
line 7: "MIKROBUS_GPIO1_7" unused input active-high
line 8: "MIKROBUS_GPIO1_8" unused input active-high
line 9: "MIKROBUS_GPIO1_9" unused input active-high
line 10: "MIKROBUS_GPIO1_10" unused input active-high
line 11: "MIKROBUS_GPIO1_11" unused input active-high
line 12: "MIKROBUS_GPIO1_12" unused input active-high
line 13: "MIKROBUS_W1_GPIO0" unused input active-high
line 14: "MIKROBUS_GPIO1_14" unused input active-high
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: "VDD_3V3_SD" "regulator-4" output active-high [used]
line 20: unnamed unused input active-high
line 21: unnamed unused input active-high
line 22: "MIKROBUS_GPIO1_22" unused input active-high
line 23: "MIKROBUS_GPIO1_23" unused input active-high
line 24: "MIKROBUS_GPIO1_24" unused input active-high
line 25: "MIKROBUS_GPIO1_25" unused input active-high
and the output indicates MIKROBUS_GPIO1_7 is unused (as expected).
Now I can access the GPIO:
root@BeaglePlay:/home/debian# echo 318 > /sys/class/gpio/gpiochip311/subsystem/export
root@BeaglePlay:/home/debian# echo out > /sys/class/gpio/gpiochip311/subsystem/gpio318/direction
root@BeaglePlay:/home/debian# cat /sys/class/gpio/gpiochip311/subsystem/gpio318/value
0
root@BeaglePlay:/home/debian# echo 1 > /sys/class/gpio/gpiochip311/subsystem/gpio318/value
root@BeaglePlay:/home/debian# cat /sys/class/gpio/gpiochip311/subsystem/gpio318/value
1
As you can see I can change the value and read it. And it works for every reboot using reboot command.
Now If I halt the board, unplug the power and restart it, GPIO stop responding:
root@BeaglePlay:/home/debian# echo 318 > /sys/class/gpio/gpiochip311/subsystem/export
root@BeaglePlay:/home/debian# echo out > /sys/class/gpio/gpiochip311/subsystem/gpio318/direction
root@BeaglePlay:/home/debian# cat /sys/class/gpio/gpiochip311/subsystem/gpio318/value
0
root@BeaglePlay:/home/debian# echo 1 > /sys/class/gpio/gpiochip311/subsystem/gpio318/value
root@BeaglePlay:/home/debian# cat /sys/class/gpio/gpiochip311/subsystem/gpio318/value
0
As you can see, even if I put value 1 on the GPIO, when I read it its value is still 0 .
To reenable GPIO I have to redo all the steps by enabling Mikrobus, disabling it and so on…
In my opinion there is some initialization the mikrobus layer do. That initialization resets when unplugging the board.
Any help is appreciated.
Thanks!