I’m working on a ROS robot which uses a Jetson NANO eMMC card. The problem I have is that I’m unsure on how to enable spi. I have read many different ways to do it, some say to use jetson-io.py, but that isn’t supported on the eMMC card. Others say to flash the OS, but there is a lot of proprietary configuration from the suppliers of the robot, so this isn’t really an option either as I’m guessing flashing would cause a need to reconfigure the OS. Is there anyway I can enable spi on the robot itself without using an external computer?
Sorry if this doesn’t make much sense, I’m quite new to all of this and I’ve found it quite confusing and badly documented.
For context the card is currently running with L4T R32.5.1.
Hi callum.gram,
It seems you are using the custom carrier board for Jetson Nano so that you could not use Jetson-IO to configure pinmux.
You could use commands to write pinmux register for SPI and also decompile the dtb and modify it to remove the GPIO usage for SPI pins.
Please share the result of the following command on your board.
$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
$ sudo cat /sys/kernel/debug/tegra_gpio
Hi Kevin,
I ran the commands, here is my output
$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
Bank: 1 Reg: 0x70003050 Val: 0x0000e045 → spi1_mosi_pc0
Bank: 1 Reg: 0x70003054 Val: 0x0000e045 → spi1_miso_pc1
Bank: 1 Reg: 0x70003058 Val: 0x0000e045 → spi1_sck_pc2
Bank: 1 Reg: 0x7000305c Val: 0x0000e049 → spi1_cs0_pc3
Bank: 1 Reg: 0x70003060 Val: 0x0000e049 → spi1_cs1_pc4
Bank: 1 Reg: 0x70003064 Val: 0x00006046 → spi2_mosi_pb4
Bank: 1 Reg: 0x70003068 Val: 0x00006046 → spi2_miso_pb5
Bank: 1 Reg: 0x7000306c Val: 0x00006046 → spi2_sck_pb6
Bank: 1 Reg: 0x70003070 Val: 0x00006046 → spi2_cs0_pb7
Bank: 1 Reg: 0x70003074 Val: 0x00006045 → spi2_cs1_pdd0
Bank: 1 Reg: 0x70003078 Val: 0x0000e015 → spi4_mosi_pc7
Bank: 1 Reg: 0x7000307c Val: 0x0000e015 → spi4_miso_pd0
Bank: 1 Reg: 0x70003080 Val: 0x0000e015 → spi4_sck_pc5
Bank: 1 Reg: 0x70003084 Val: 0x0000e015 → spi4_cs0_pc6
Bank: 1 Reg: 0x70003088 Val: 0x00002015 → qspi_sck_pee0
Bank: 1 Reg: 0x7000308c Val: 0x00002015 → qspi_cs_n_pee1
Bank: 1 Reg: 0x70003090 Val: 0x00002015 → qspi_io0_pee2
Bank: 1 Reg: 0x70003094 Val: 0x00002015 → qspi_io1_pee3
Bank: 1 Reg: 0x70003098 Val: 0x00002015 → qspi_io2_pee4
Bank: 1 Reg: 0x7000309c Val: 0x00002015 → qspi_io3_pee5
Bank: 0 Reg: 0x70000b70 Val: 0x00000001 → drive_qspi_comp_control
Bank: 0 Reg: 0x70000b78 Val: 0x00000001 → drive_qspi_lpbk_control
Bank: 0 Reg: 0x70000a78 Val: 0x00808000 → drive_qspi_comp
$ sudo cat /sys/kernel/debug/tegra_gpio
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
A: 0:0 64 40 40 04 00 00 000000
B: 0:1 f0 00 00 f0 00 00 000000
C: 0:2 1f 00 00 1f 00 00 000000
D: 0:3 00 00 00 00 00 00 000000
E: 1:0 40 00 00 40 00 00 000000
F: 1:1 00 00 00 00 00 00 000000
G: 1:2 0c 00 00 0c 00 00 000000
H: 1:3 fd 99 00 60 00 40 404000
I: 2:0 07 07 03 00 00 00 000000
J: 2:1 00 00 00 00 00 00 000000
K: 2:2 00 00 00 00 00 00 000000
L: 2:3 00 00 00 00 00 00 000000
M: 3:0 00 00 00 00 00 00 000000
N: 3:1 00 00 00 00 00 00 000000
O: 3:2 00 00 00 00 00 00 000000
P: 3:3 00 00 00 00 00 00 000000
Q: 4:0 00 00 00 00 00 00 000000
R: 4:1 00 00 00 00 00 00 000000
S: 4:2 a0 80 00 20 00 00 000000
T: 4:3 01 01 00 00 00 00 000000
U: 5:0 00 00 00 00 00 00 000000
V: 5:1 03 00 00 03 00 00 000000
W: 5:2 00 00 00 00 00 00 000000
X: 5:3 78 08 08 70 00 60 606000
Y: 6:0 06 00 00 06 00 00 000000
Z: 6:1 0f 08 00 05 00 04 000400
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 00 00 00 00 00 00 000000
CC: 7:0 92 80 80 10 00 12 121200
DD: 7:1 01 00 00 01 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000
Please run the following command to configure pinmux for SPI usage.
SPI1
$ sudo busybox devmem 0x70003050 w 0x0000e044
$ sudo busybox devmem 0x70003054 w 0x0000e044
$ sudo busybox devmem 0x70003058 w 0x0000e044
$ sudo busybox devmem 0x7000305c w 0x0000e048
$ sudo busybox devmem 0x70003060 w 0x0000e048
SPI2:
$ sudo busybox devmem 0x70003064 w 0x0000e044
$ sudo busybox devmem 0x70003068 w 0x0000e044
$ sudo busybox devmem 0x7000306c w 0x0000e044
$ sudo busybox devmem 0x70003070 w 0x0000e048
$ sudo busybox devmem 0x70003074 w 0x0000e048
and run the command again to check if it has been configured correctly.
$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
============================================================
For GPIO usage, please refer to the following steps to configure
1. Find your dtb in /boot/dtb/XXXX.dtb on your board
2. Dissemble the dtb to dts
$ dtc -I dtb -O dts -o temp.dts XXXX.dtb
3. Modify the following line
- gpio-input = <0xd8 0xc 0xd 0xe 0xf 0xe8 0x26 0x95 0x5 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xc8 0xca 0x4d 0x4e 0x4c 0x4f 0x32 0x33 0x10 0x11 0x12 0x13 0x14 0x3a 0x3d 0x3e 0x41 0xe4>;
+ gpio-input = <0xd8 0x26 0x95 0x5 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xc8 0xca 0x4d 0x4e 0x4c 0x4f 0x32 0x33 0x3a 0x3d 0x3e 0x41 0xe4>;
4. Assemble the dts back to dtb
$ dtc -I dts -O dtb -o XXXX.dtb temp.dts
and run the command again to check GPIO usage:
$ sudo cat /sys/kernel/debug/tegra_gpio
Hi again,
Editing the GPIO-line fixed the issue by itself.
Thanks for the help!
1 Like
system
Closed
November 8, 2023, 1:25pm
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.