Unable to read GPIO pin


I just want to read a GPIO pin but it seems not to work.
I’m using the GPIO2_IO01 in this way:

echo 33 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio33/direction
cat /sys/class/gpio/gpio33/value

The voltage is changing from 3.3V to 0V, but there are no changes in the pin value, it always shows 0.
I know this pis is configured as SD1_DATA5 in the device tree for ixora v1.1 board, but the have removed the SD card slot from our board and I have deactivated this functionality, so there are no errors during the initialization.
What could be the reason for such behavior?


My experience tell me that you need to add the pin to IOMUX as gpio, even though you removed it form its main use.

Check ixora dtsi and look for the apalis_gpio initializations and do the same for the pin you want

  • Create a pinctrl for that pin
  • Add it to IOMUX

Hope this helps

Hello, thank you for the reply.
I’ve had the same idea and have already added the pin to dts as gpio. But it doesn’t work anyway :frowning:


Did you try with the “official” Ixora gpios on X27 extender? If you can, try to do the same tests with one of those. If it also fails, at least the .dts definition problem is knocked out.

Yes, I have tested standard gpios of ixora board, they are Ok, the problem is to set any other pin, it seems to be something with multiplexing and I can’t find anything describing this problem.

I guess this is the most I can get into helping :frowning:

Next step for me would be checking all dts files for the pin definition and pinctrl users, making sure it’s only defined in 1 pinctrl and being used on the gpio section of the dts.

I have already done it, but thanks anyway :slight_smile:

Hello Joao!
You were right! I’ve initialized the pin with the false name, there are a set of names for every pin, but it seems to be only one right name. For the GPIO2_IO01 it should be the MX6QDL_PAD_NANDF_D1__GPIO2_IO01, not the MX6QDL_PAD_NANDF_D1__SD1_DATA5.
It’s the same pin, but different name has probably different parameters (Alt state).
Now it works perfectly!
Thank you once more!

Glad I could help!