I tried to run several Python GPIO example programs on my VisionFive 2. I connected the required components to VisionFIVE’s GPIO pins as instructed but they don’t work. Even simply making as LED blink doesn’t work! A LED turns on when connected to the 5V pin but that’s about it.
Is there a some kind of test program to run in order to check whether the GPIO pins work? Where should I start troubleshooting?
Firmware’s at the latest version and the OS is Debian.
not Python, just command line
I suppose you have read VisionFive2_40-Pin_GPIO_Header_UG.pdf
user guide
4.1. Configuring GPIO
To configure GPIO, perform the following:
Execute the following command to configure GPIO44:
cd /sys/class/gpio
echo 44 > export
Locate to the GPIO44 directory:
cd gpio44
Note:
In this command, 44 represents the Sys number of the pin. For more information, see GPIO Pinout (on page 9).
Configure the direction of GPIO44 as in:
echo in > direction
Alternatively, configure the direction of GPIO44 as out:
echo out > direction
Configure the voltage level of GPIO44 as high:
echo 1 > value
Tip:
You can use an oscilloscope to check the voltage level.
or connect a current limited led
Configure the voltage level of GPIO44 as low:
echo 0 > value
Tip:
You can use an oscilloscope to check the voltage level.
Connect the 3.3V Power pin with the GPIO44, and check the voltage level of GPIO44:
cat value
Connect the GND pin with the GPIO44, and check the voltage level of GPIO44:
cat value
Tested GPIO44 with an oscilloscope and there’s certainly something happening. Here’s what happens after typing echo 1 > value: PXL-20241003-171055615-MP.jpg
Your cro is setup AC coupling, change it to DC
use 10X for higher impedance
I should have tested before posting,
but have now tested and it definitely works,
exactly as is in the StarFive documentation I posted.
Test setup - serial terminal, volt meter
first step setting up gpio44 on pin 40
cd /sys/class/gpio
echo 44 > export
cd gpio44
documentation missed a step, probably not good practice to drive the pin as output when connected to a voltage
echo in > direction
before applying an external voltage and reading pin value
using a jumper to 3v3
cat value
1
jumper to gnd
cat value
0
disconnect jumper
echo out > direction
echo 0 > value
cat value
0
volt meter 0v
echo 1 > value
cat value
1
volt meter 3v3
setting up a second pin
cd /sys/class/gpio
echo 60 > export
cd gpio60
now you can also work with gpio60 on pin 37