Search code examples
linuxbashgpio

Using GPIO from bash: read only "1"


I'd like to set up an interrupt management on a NXP i.MX6 processor on GPIO1_16.

But before that, I wanted to verify that I can control this GPIO correctly.

So I can read and write on this GPIO with this following commands:

Read commands:

echo 16 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio16/direction
cat /sys/class/gpio/gpio16/value

Write commands:

echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
echo 1 > /sys/class/gpio/gpio16/value
echo 0 > /sys/class/gpio/gpio16/value

My problem is that when I do read commands, I only get the value 1 (whether the cable connected to this GPIO is set to GND or VCC). Also, my write commands don't seem to work because the LED connected to this GPIO never toggle.

This is very strange because these commands were working a few days ago.

Can you help me?


Solution

  • If we look at the following table of the i.XM6's datasheet, GPIO1_IO16 which corresponds to the power group of NVCC_SD1 works between 1.65V and 3.6V.

    enter image description here

    This IO problem could come from a power supply error.