Hello,
All test failed like below.
manager@manager-desktop:~/Downloads$ ./spidev_test -D /dev/spidev0.0 -g 16 -s 11000000 -zzz
using device: /dev/spidev0.0
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 0
bits per word: 8 bytes per word: 1
max speed: 11000000 Hz (11000 KHz)
no. runs: 1
Using seed:0x6268e381
loop count = 0
using sequential pattern …
transfer bytes [16]
0000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
transfer: Return actual transfer length: 16
receive bytes [16]
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
mismatch index 1
^^^ 00 00 00 00 00 00 00 00 00 00 00 transfer: received packet size:16 len:16 stat:-6
/dev/spidev0.0: TEST FAILED !!! (status:-1)
====== Transfer stats ====
Transmit:
total: 16B (0KiB 0MiB)
total: 1P
ioerr: 0B (0KiB 0MiB)
ioerr: 0P
Rate:
wire total: -1B/s (0KB/s)
total: -1B/s (0KB/s)
wire total: -1P/s
total: -1P/s
Receive:
total: 16B (0KiB 0MiB)
total: 1P
good: 0B (0KiB 0MiB)
good: 0P
ioerr: 0P
dataerr: 1P
Rate:
good: -1B/s (0KB/s)
good: -1P/s
packet drop: -1/10000
Total time: 0.000646s
manager@manager-desktop:~/Downloads$ ./spidev_test -D /dev/spidev0.1 -g 16 -s 11000000 -zzz
using device: /dev/spidev0.1
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 0
bits per word: 8 bytes per word: 1
max speed: 11000000 Hz (11000 KHz)
no. runs: 1
Using seed:0x6268e3b1
loop count = 0
using sequential pattern …
transfer bytes [16]
0000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
transfer: Return actual transfer length: 16
receive bytes [16]
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
mismatch index 1
^^^ 00 00 00 00 00 00 00 00 00 00 00 transfer: received packet size:16 len:16 stat:-6
/dev/spidev0.1: TEST FAILED !!! (status:-1)
====== Transfer stats ====
Transmit:
total: 16B (0KiB 0MiB)
total: 1P
ioerr: 0B (0KiB 0MiB)
ioerr: 0P
Rate:
wire total: -1B/s (0KB/s)
total: -1B/s (0KB/s)
wire total: -1P/s
total: -1P/s
Receive:
total: 16B (0KiB 0MiB)
total: 1P
good: 0B (0KiB 0MiB)
good: 0P
ioerr: 0P
dataerr: 1P
Rate:
good: -1B/s (0KB/s)
good: -1P/s
packet drop: -1/10000
Total time: 0.000449s
manager@manager-desktop:~/Downloads$ ./spidev_test -D /dev/spidev1.0 -g 16 -s 11000000 -zzz
using device: /dev/spidev1.0
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 0
bits per word: 8 bytes per word: 1
max speed: 11000000 Hz (11000 KHz)
no. runs: 1
Using seed:0x6268e3c5
loop count = 0
using sequential pattern …
transfer bytes [16]
0000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
transfer: Return actual transfer length: 16
receive bytes [16]
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
mismatch index 1
^^^ 00 00 00 00 00 00 00 00 00 00 00 transfer: received packet size:16 len:16 stat:-6
/dev/spidev1.0: TEST FAILED !!! (status:-1)
====== Transfer stats ====
Transmit:
total: 16B (0KiB 0MiB)
total: 1P
ioerr: 0B (0KiB 0MiB)
ioerr: 0P
Rate:
wire total: -1B/s (0KB/s)
total: -1B/s (0KB/s)
wire total: -1P/s
total: -1P/s
Receive:
total: 16B (0KiB 0MiB)
total: 1P
good: 0B (0KiB 0MiB)
good: 0P
ioerr: 0P
dataerr: 1P
Rate:
good: -1B/s (0KB/s)
good: -1P/s
packet drop: -1/10000
Total time: 0.001006s
manager@manager-desktop:~/Downloads$ ./spidev_test -D /dev/spidev1.1 -g 16 -s 11000000 -zzz
using device: /dev/spidev1.1
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 0
bits per word: 8 bytes per word: 1
max speed: 11000000 Hz (11000 KHz)
no. runs: 1
Using seed:0x6268e3d0
loop count = 0
using sequential pattern …
transfer bytes [16]
0000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
transfer: Return actual transfer length: 16
receive bytes [16]
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
mismatch index 1
^^^ 00 00 00 00 00 00 00 00 00 00 00 transfer: received packet size:16 len:16 stat:-6
/dev/spidev1.1: TEST FAILED !!! (status:-1)
====== Transfer stats ====
Transmit:
total: 16B (0KiB 0MiB)
total: 1P
ioerr: 0B (0KiB 0MiB)
ioerr: 0P
Rate:
wire total: -1B/s (0KB/s)
total: -1B/s (0KB/s)
wire total: -1P/s
total: -1P/s
Receive:
total: 16B (0KiB 0MiB)
total: 1P
good: 0B (0KiB 0MiB)
good: 0P
ioerr: 0P
dataerr: 1P
Rate:
good: -1B/s (0KB/s)
good: -1P/s
packet drop: -1/10000
Total time: 0.000534s
Thank you.
Dump the GPIO status to confirm.
Also probe the MOSI/MISO to check.
sudo cat /sys/kernel/debug/tegra_gpio
1 Like
Hello,
Dump result is here:
manager@manager-desktop:~/Downloads$ sudo cat /sys/kernel/debug/tegra_gpio
[sudo] password for manager:
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
A: 0:0 64 40 40 24 00 00 000000
B: 0:1 f0 00 00 30 00 00 000000
C: 0:2 1f 00 00 00 00 00 000000
D: 0:3 00 00 00 00 00 00 000000
E: 1:0 40 00 00 00 00 00 000000
F: 1:1 00 00 00 00 00 00 000000
G: 1:2 0c 00 00 00 00 00 000000
H: 1:3 fd 99 00 60 00 00 000000
I: 2:0 07 07 03 00 00 00 000000
J: 2:1 f0 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 00 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 02 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 02 00 00 000000
Z: 6:1 0f 08 00 04 00 00 000400
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 00 00 00 000000
CC: 7:0 92 80 80 10 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000
Also probe the MOSI/MISO to check.
=> Are you talking about taking pictures with an oscilloscope?
Thank you.
Looks like the those pin enable as GPIO pin.
Did you using r32.6.1? This version should have problem or didn’t you add those pin under the gpio@6000d000? Remove the TEGRA_GPIO B an B to try
gpio: gpio@6000d000 {
gpio-init-names = "default";
gpio-init-0 = <&gpio_default>;
gpio_default: default {
gpio-input = <
TEGRA_GPIO(BB, 0)
TEGRA_GPIO(B, 4)
TEGRA_GPIO(B, 5)
TEGRA_GPIO(B, 6)
TEGRA_GPIO(B, 7)
TEGRA_GPIO(DD, 0)
TEGRA_GPIO(E, 6)
TEGRA_GPIO(S, 5)
...
... TEGRA_GPIO(C, 0)
TEGRA_GPIO(C, 1)
TEGRA_GPIO(C, 2)
TEGRA_GPIO(C, 3)
TEGRA_GPIO(C, 4)
1 Like
Hello, @ShaneCCC
manager@manager-desktop:~/yhlee/coding$ cat /etc/nv_tegra_release
R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t210ref, EABI: aarch64, DATE: Mon Jul 26 19:20:30 UTC 2021
Thank you.
Please apply the patch from below link for this version.
Apply this patch without the kernel GPIO patch and add the 40pin head SPI pin configure.
diff --git a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-a02.dtsi b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-a02.dtsi
index b520de5..56f9140 100644
--- a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-a02.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-a02.dtsi
@@ -1,6 +1,6 @@
-/*This dtsi file was generated by T210_P3448_SKU2_pinmux.xlsm Revision: 8 */…
1 Like
Hello, @ShaneCCC
Rather than providing a patched dtb file, do I need to read the above article and modify dts to build dtb and then apply it?
Do other Jetpack versions need patches?
Thank you.
The key point is remove those TEGRA_GPIO(BB, *) and TEGRA_GPIO(C, *) in your device tree.
1 Like
Hello, @ShaneCCC
I have used jp4.6.1.
cat /etc/nv_tegra_release
R32 (release), REVISION: 7.1, GCID: 29818004, BOARD: t210ref, EABI: aarch64, D
sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
[sudo] password for manager:
Bank: 1 Reg: 0x70003050 Val: 0x0000e015 -> spi1_mosi_pc0
Bank: 1 Reg: 0x70003054 Val: 0x0000e015 -> spi1_miso_pc1
Bank: 1 Reg: 0x70003058 Val: 0x0000e015 -> spi1_sck_pc2
Bank: 1 Reg: 0x7000305c Val: 0x0000e015 -> spi1_cs0_pc3
Bank: 1 Reg: 0x70003060 Val: 0x0000e015 -> spi1_cs1_pc4
Bank: 1 Reg: 0x70003064 Val: 0x00006016 -> spi2_mosi_pb4
Bank: 1 Reg: 0x70003068 Val: 0x00006016 -> spi2_miso_pb5
Bank: 1 Reg: 0x7000306c Val: 0x00006016 -> spi2_sck_pb6
Bank: 1 Reg: 0x70003070 Val: 0x00006016 -> spi2_cs0_pb7
Bank: 1 Reg: 0x70003074 Val: 0x00006015 -> 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 dtc -I fs -O dts -o extracted_proc_emmc_new.dts /proc/device-tree
extracted_proc_emmc_new.dts (321.5 KB)
and
apply nvidia,function = “spi1”.
forumuser:
spi1_mosi_pc0 {
nvidia,enable-input = <0x1>;
nvidia,pins = "spi1_mosi_pc0";
nvidia,tristate = <0x0>;
nvidia,function = "spi1";
nvidia,pull = <0x1>;
};
and compile dtb from extracted_proc_emmc_new.dts
dtc -I dts extracted_proc_emmc_new.dts -O dtb -o spi-emmc.dtb
and execute below command
sudo cp spi-emmc.dtb /boot/
sudo vi /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/spi_emmc.dtb or /boot/tegra210-p3448-0002-p3449-0000-b00.dtb
At this time,
Is it something wrong with my work?
Thank you.
Hello, @ShaneCCC
I have used R32.7.1.
ShaneCCC:
gpio: gpio@6000d000 {
gpio-init-names = "default";
gpio-init-0 = <&gpio_default>;
gpio_default: default {
gpio-input = <
TEGRA_GPIO(BB, 0)
TEGRA_GPIO(B, 4)
TEGRA_GPIO(B, 5)
TEGRA_GPIO(B, 6)
TEGRA_GPIO(B, 7)
TEGRA_GPIO(DD, 0)
TEGRA_GPIO(E, 6)
TEGRA_GPIO(S, 5)
...
... TEGRA_GPIO(C, 0)
TEGRA_GPIO(C, 1)
TEGRA_GPIO(C, 2)
TEGRA_GPIO(C, 3)
TEGRA_GPIO(C, 4)
I can’t find TEGRA_GPIO B an B.
Where can I find this?
extracted_proc_emmc_new.dts (321.5 KB)
Thank you.
The “nvidia,enable-input” and “nvidia,tristate” should be like below for all spi1_xxx pins
You need find the TEGRA_GPIO(B, *) in kernel source instead of device tree dump.
spi1_mosi_pc0 {
nvidia,enable-input = <0x1>;
nvidia,pins = "spi1_mosi_pc0";
nvidia,tristate = <0x0>;
nvidia,function = "spi1";
nvidia,pull = <0x1>;
};
1 Like
Hello, @ShaneCCC
Shouldn’t dtb compiled with dtc be applied using dts created from /proc/device-tree? Is this the wrong way?
Check the /boot directory in jp4.6.1 (l4t R32.7.1)
kernel_tegra210-p3448-0002-p3449-0000-b00.dtb
tegra210-p3448-0002-p3449-0000-b00.dtb
There are two, which of the two applies? Please confirm.
Thank you.
Use the dts source codes to check what ShaneCCC is asking.
Otherwise it is just hex value which is not human readable.
1 Like
Hello, @ShaneCCC
Thank you for your support.
ShaneCCC:
Modify those pins spi1_ _ to spi1 in “nvidia,function” like below.
spi1_mosi_pc0 {
nvidia,enable-input = <0x1>;
nvidia,pins = "spi1_mosi_pc0";
nvidia,tristate = <0x0>;
nvidia,function = "spi1";
nvidia,pull = <0x1>;
};
Should I change not only 1 but also 2 or 3?
The kernel source contains nvidia, enable-input = <TEGRA_PIN_DISABLE>
is set to 0.
Thank you.
Yes, need modify like below.
nvidia,pins = "spi1_mosi_pc0";
79 nvidia,function = "spi1";
80 nvidia,pin-label = "spi1_dout";
81 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
82 nvidia,tristate = <TEGRA_PIN_DISABLE>;
83 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
1 Like
Hello, @ShaneCCC
Do I need to add a pin label?
Thank you.
Thanks for the explain from @WayneWWW
If able know the hex value you can use dtc instead of touch the source.
1 Like
Hello, @ShaneCCC
ShaneCCC:
nvidia,pins = "spi1_mosi_pc0";
79 nvidia,function = "spi1";
80 nvidia,**pin-label** = "spi1_dout";
81 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
82 nvidia,tristate = <TEGRA_PIN_DISABLE>;
83 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
There is no pin label in the original kernel source. should i add it?
Thank you.
No need to add the pin label.
1 Like
Hello,
I’m in a bit of a hurry, can you watch with me for a moment?
tegra210-porg-pinmux-p3448-0002-b00.dtsi (38.1 KB)
I changed everything as instructed and applied dtb as FDT in extlinux.conf.
Thank you.