GPIO03 neither working as input, nor as output

Hi,

I am trying to use GPIO03 (ball name: SPI2_SCK, GPIO: GPIO3_PCC.00) as an input for a rotary encoder. As this is a very easy electrical component, I was surprised, that it wasn’t working. To test the GPIO, I put GND and 1,8V at the pin and read the value → It alway reads 0. If I use the pin as an output, the voltage at the pin is always 0V. While doing these tests, there is nothing connected at the pin. After some further investigation, I tried different pinmux settings according to the TRM (default is 0x2):

sudo busybox devmem 0xc302048 16 0x55
sudo busybox devmem 0xc302048 16 0x52
sudo busybox devmem 0xc302048 16 0x42

To test, that the changing of the value is working, I ran the following command.

jetson@jetson:~/logicJet$  sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep "sck"
Bank: 1 Reg: 0x0c302048 Val: 0x00000052 -> spi2_sck_pcc0

But all these tests were unsuccessful.

Other information:
JetPack 4.6
Script to test GPIO:

jetson@jetson:~/logicJet$ sudo su
root@jetson:/home/jetson/logicJet# echo 304 > /sys/class/gpio/export
root@jetson:/home/jetson/logicJet# echo in > /sys/class/gpio/gpio304/direction
root@jetson:/home/jetson/logicJet# cat /sys/class/gpio/gpio304/value 
0

Is there something that I have overlooked? Is there something special with this pin? I am using a lot of other pins, but two aren’t working (on several boards).

Any help is appreciated.

Greetings,
Fabio

hello fabio.manz,

you’re having incorrect GPIO numbering.
this pin, GPIO3_PCC.00 it is AON GPIO, which allocated from 248 to 287,
according to the formula, it should be… GPIO3_PCC.00 = 248 + 2 * 8 + 0 = 264.

1 Like

hello JerryChang,

this was my mistake. Thank you for helping me with this problem.

Greetings,
Fabio

Btw. I have made an open-source script to calculate the Linux GPIO Number from the Jetson Xavier NX pin names for everybody that also is slightly annoyed by needing to calculate the pins themselves :D

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.