Which Khadas SBC do you use?
VIM 3 Pro
Which system do you use? Android, Ubuntu, OOWOW or others?
OOWOW with Ubuntu server 22.04 installed.
Which version of system do you use? Khadas official images, self built images, or others?
Official Ubuntu server 22.04 image installed via OOWOW
Please describe your issue below:
Trying to get any of the GPIO pins to work in Output mode and toggling them High or Low.
Post a console log of your issue below:
First get the status of all GPIO pins.
$ gpio readall
+------+-----+----------+------+---+----+-- Model Khadas VIM3/3L --+----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
| | | 5V | | | | | 1 || 21 | | | | | GND | | |
| | | 5V | | | | | 2 || 22 | DSBLD | | 1 | ALT1 | PIN.A15 | 6 | 475 |
| | | USB_DM | | | | | 3 || 23 | DSBLD | | 1 | ALT1 | PIN.A14 | 7 | 474 |
| | | USB_DP | | | | | 4 || 24 | | | | | GND | | |
| | | GND | | | | | 5 || 25 | DSBLD | | 1 | ALT0 | PIN.AO2 | 8 | 498 |
| | | MCU3V3 | | | | | 6 || 26 | DSBLD | | 1 | ALT0 | PIN.AO3 | 9 | 499 |
| | | MCUNRST | | | | | 7 || 27 | | | | | 3V3 | | |
| | | MCUSWIM | | | | | 8 || 28 | | | | | GND | | |
| | | GND | | | | | 9 || 29 | DSBLD | | 0 | ALT0 | PIN.A1 | 10 | 461 |
| | 18 | ADC0 | | | | | 10 || 30 | DSBLD | | 0 | ALT0 | PIN.A0 | 11 | 460 |
| | | 1V8 | | | | | 11 || 31 | DSBLD | | 0 | ALT0 | PIN.A3 | 12 | 463 |
| | 19 | ADC1 | | | | | 12 || 32 | DSBLD | | 0 | ALT0 | PIN.A2 | 13 | 462 |
| 506 | 1 | PIN.AO10 | IN | 1 | | P/U | 13 || 33 | P/D | | 0 | IN | PIN.A4 | 14 | 464 |
| | | GND3 | | | | | 14 || 34 | | | | | GND | | |
| 433 | 2 | PIN.H6 | ALT1 | 0 | | DSBLD | 15 || 35 | P/D | | 0 | IN | PWM-F | 15 | 432 |
| 434 | 3 | PIN.H7 | ALT1 | 1 | | DSBLD | 16 || 36 | | | | | RTC | | |
| | | GND | | | | | 17 || 37 | P/D | | 0 | IN | PIN.H4 | 16 | 431 |
| 497 | 4 | PIN.AO1 | ALT0 | 0 | | DSBLD | 18 || 38 | | | | | MCU-FA1 | | |
| 496 | 5 | PIN.AO0 | ALT0 | 1 | | DSBLD | 19 || 39 | P/D | | 0 | IN | PIN.Z15 | 17 | 426 |
| | | 3V3 | | | | | 20 || 40 | | | | | GND | | |
+------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
I have tried many, but will use physical GPIO Pin number 37 and set this as output.
echo 431 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio431/direction
echo 1 > /sys/class/gpio/gpio431/value
Then check the status again
$ gpio readall
+------+-----+----------+------+---+----+-- Model Khadas VIM3/3L --+----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
| | | 5V | | | | | 1 || 21 | | | | | GND | | |
| | | 5V | | | | | 2 || 22 | DSBLD | | 1 | ALT1 | PIN.A15 | 6 | 475 |
| | | USB_DM | | | | | 3 || 23 | DSBLD | | 1 | ALT1 | PIN.A14 | 7 | 474 |
| | | USB_DP | | | | | 4 || 24 | | | | | GND | | |
| | | GND | | | | | 5 || 25 | DSBLD | | 1 | ALT0 | PIN.AO2 | 8 | 498 |
| | | MCU3V3 | | | | | 6 || 26 | DSBLD | | 1 | ALT0 | PIN.AO3 | 9 | 499 |
| | | MCUNRST | | | | | 7 || 27 | | | | | 3V3 | | |
| | | MCUSWIM | | | | | 8 || 28 | | | | | GND | | |
| | | GND | | | | | 9 || 29 | DSBLD | | 0 | ALT0 | PIN.A1 | 10 | 461 |
| | 18 | ADC0 | | | | | 10 || 30 | DSBLD | | 0 | ALT0 | PIN.A0 | 11 | 460 |
| | | 1V8 | | | | | 11 || 31 | DSBLD | | 0 | ALT0 | PIN.A3 | 12 | 463 |
| | 19 | ADC1 | | | | | 12 || 32 | DSBLD | | 0 | ALT0 | PIN.A2 | 13 | 462 |
| 506 | 1 | PIN.AO10 | IN | 1 | | P/U | 13 || 33 | P/D | | 0 | IN | PIN.A4 | 14 | 464 |
| | | GND3 | | | | | 14 || 34 | | | | | GND | | |
| 433 | 2 | PIN.H6 | ALT1 | 0 | | DSBLD | 15 || 35 | P/D | | 0 | IN | PWM-F | 15 | 432 |
| 434 | 3 | PIN.H7 | ALT1 | 1 | | DSBLD | 16 || 36 | | | | | RTC | | |
| | | GND | | | | | 17 || 37 | P/D | | 0 | IN | PIN.H4 | 16 | 431 |
| 497 | 4 | PIN.AO1 | ALT0 | 0 | | DSBLD | 18 || 38 | | | | | MCU-FA1 | | |
| 496 | 5 | PIN.AO0 | ALT0 | 1 | | DSBLD | 19 || 39 | P/D | | 0 | IN | PIN.Z15 | 17 | 426 |
| | | 3V3 | | | | | 20 || 40 | | | | | GND | | |
+------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
The Mode and Value columns in the above output still show Pin 37 as being set to Input and Value=0 even after changing them.
The Device Tree Overlay is the default
overlays=uart3 pwm_f i2c3 i2s os08a10 watchdog
So how do we get the GPIO pins to go to output Mode and toggle High and Low?