SPI1 has no waveform signal on any function pins

1,HardWare:Jetson Xavier NX moules; SoftWareVersion:R35.4.1; Restraint: don’t use jetson-io.py
2,Change the pinmux《xxx_pin_configure template v1.06.xlsm》 as below:

|SPI0_SCK|91|SPI1_SCK|Output|Drive 1||Master|
|SPI0_MISO|93|SPI1_DIN|Input|Int PU||Master|
|SPI0_MOSI|89|SPI1_DOUT|Output|Drive 0||Master|
|SPI0_CS0*|95|SPI1_CS0|Output|Drive 1|No|Master|
|SPI0_CS1*|97|SPI1_CS1|Output|Drive 1|No|Master|

3,modify the context in tegra194-p3668-0001-p3509-0000.dts

spi@3210000{ /* SPI1 in 40 pin conn */
		status = "okay";
		spi@0 { /* chip select 0 */
			compatible = "stm32,spi_slaver";
			reg = <0x0>;
			spi-max-frequency = <50000000>;
			controller-data {
				nvidia,enable-hw-based-cs;
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x0>;
			};
		};
	};

4,My driver code can match the node of the devices-tree,but i can’t get the correct waveform signal on any pins belong spi1(pin 19 21 23 24 26),the using api function is spi_async().
5, The info below is return after exec cmd “sudo cat /sys/kernel/debug/pinctrl/2430000.pinmux/pinmux-pins |grep PZ”

pin 157 (UART5_CTS_PZ0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 158 (USB_VBUS_EN0_PZ1): (MUX UNCLAIMED) tegra194-gpio:493
pin 159 (USB_VBUS_EN1_PZ2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 160 (SPI1_SCK_PZ3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 161 (SPI1_MISO_PZ4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 162 (SPI1_MOSI_PZ5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 163 (SPI1_CS0_PZ6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 164 (SPI1_CS1_PZ7): (MUX UNCLAIMED) (GPIO UNCLAIMED)

6,The context below is the busybox debug info:

fs@jetson:~$ sudo busybox devmem 0x0243d040
0x00001400
fs@jetson:~$ sudo busybox devmem 0x0243d020
0x00001458
fs@jetson:~$ sudo busybox devmem 0x0243d058
0x00001400
fs@jetson:~$ sudo busybox devmem 0x0243d010
0x00001400
fs@jetson:~$ sudo busybox devmem 0x0243d050
0x00001400

Now I’m so sad that the signal is not expected, I need some guiding idea.

Hi skyun2012,

Are you using the devkit or custom board for Xavier NX?

Could you refer to the following thread to use spidev and verify SPI loopback test first? (you could start from Step4)
Jetson Nano SPI Bus Not Working - #10 by KevinFFF

spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  |HelloWorld123456789abcdef|
RX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  |HelloWorld123456789abcdef|

1,the url cannot access,i get spidev_test.c from spidev_test.c - tools/spi/spidev_test.c - Linux source code (v5.10.120) - Bootlin
2,resolve the compiling error.
3,open the /dev/spidev0.1 (there is no node /dev/spidev0.0),get the return upon.
so what I need to do is diff difference between the driver source code spidev.c and my own driver code?

spidev0.0 means SPI but 0 with CS0
spidev0.1 means SPI bus 0 with CS1

Please share the result of the following command on your board.

ls -l /dev/spi*

It seems the SPI loopback test working and it means the pinmux for SPI pins are configured correct.

You could modify compatible to match your driver and check the dmesg.

1,I modified back the compatible of spi@0 in the device-tree, and checked devices, the below info is return when “ls -l /dev/spi*”:

fs@jetson:~$ ls -l /dev/spi*
crw-rw---- 1 root gpio 153, 0 1月  30 14:09 /dev/spidev0.0
crw-rw---- 1 root gpio 153, 1 1月  30 14:09 /dev/spidev0.1
crw-rw---- 1 root gpio 153, 2 1月  30 14:09 /dev/spidev2.0
crw-rw---- 1 root gpio 153, 3 1月  30 14:09 /dev/spidev2.1

2,Now I’m checking the difference between the spidev.c and my driver code, then modify it for my slaver on CS0.
Thank you very much!

Hi,
Now I connect the slaver a chip of which the work voltage is 3.3V, the wave will be disordered in the clk gate.
I think there are two possible distant causes:
1,The wire between the module pin and slaver is too long.
2,The pinmux pull-down-up config is not suitable.
Is the cause 2 possible?

It might be the possible.

pinmux should be correct since you’ve verified loopback test successfully.

Please just check if there’s any error message when you are probing your driver.

Please note and check if your SPI device meet the requirement of 40-pin header pins as listed in below doc.
Jetson Nano Developer Kit 40-Pin Expansion Header GPIO Usage Considerations Applications Note

Hi KevinFFF,
1,When I cut the wire shorter, the waveform is much better, but the signal is not well enough.
2,Finaly, I found that the voltage of pin2(VCC5.0V, supply the power for the slaver) is less than 3V, the slaver is lack of power.
3,when I use electricity from other device, the waveform is well now.
so the problem is resolved. Thank you!

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