SPI CS doesn't work

I am trying to connect a IMU sensor to Jetson development kit using 40 extension headers.
I inserted spidev module manually.

When I connect SPI miso and mosi, it works fine by spidev_test command.
But it doesn’t work with the IMU sensor.
Through the scope, I found the SPI CS is not changing at all.
I think the signal itself is not stable.
This is the the CS and SCK when there is no signal:

This is the one in SPI traffic:

This is the os version:

ykim@ubuntu:~$ uname -a
Linux ubuntu 5.10.104-tegra #1 SMP PREEMPT Wed Aug 10 20:17:07 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux
ykim@ubuntu:~$ cat /etc/nv_tegra_release 
# R35 (release), REVISION: 1.0, GCID: 31250864, BOARD: t186ref, EABI: aarch64, DATE: Thu Aug 11 03:40:29 UTC 2022
ykim@ubuntu:~$ cat /etc/os-release 
VERSION="20.04.4 LTS (Focal Fossa)"
PRETTY_NAME="Ubuntu 20.04.4 LTS"
ykim@ubuntu:~$ lsmod | grep spi
spidev                 28672  0
qspi_mtd               28672  0
mtd                    69632  4 cmdlinepart,qspi_mtd,ofpart
spi_tegra114           32768  0
spi_tegra210_qspi      28672  0

In 40-pin expansion header, there is SPI1 and SPI3. Which one do oyu use in your use-case? And not sure if you use developer kit or your own custom board. For using developer kit, you can generate the device tree enabling SPI1/SPI3 through jetson-io.py


I am using SPI1.
DOUT: 19
DIN: 21
SCK: 23
CS0: 24

They were enabled by default for me:

I am using the devkit!

The default setting for SPI1and also SPI3) is

			controller-data {
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x0>;

Please try to tune the setting and see if there is improvement. May try rx-clk-tap-delay = 0xF or 0x11, tx-clk-tap-delay = 0x1 or 0x2. And may remove enable-hw-based-cs for a try.

Hi, I need to use the nvidia,cs-inactive-cycles option, which means I have to enable enable-hw-based-cs. I think your advice is not an option for me.

This is what I did to find out the pin problem:

  • SPI0_SCK: gpio491, SPI0_CS0: gpio494
  • export two gpio ports by this command:
# echo 491 > /sys/class/gpio/export
# echo 494 > /sys/class/gpio/export
# cd /sys/class/gpio/export
  • set them to output
# cd gpio491
# echo out > direction
# cd ../gpio494
# echo out > direction
  • write 0 and 1 to value of each gpio then check the signal in the scope
    • I can see the change for SPI0_SCK
    • but I can’t see it for SPI0_CS0

Here are the output of the scope:
[Both are 0]

[Both are 1]

Can you help me?

The pins may not work properly if you configure them as SPI pins and GPIO pins at the same time. Could you also try to set the properties:


And check if you can see signals in CS0 and SCK pins when communicating with the IMU sensor.

If there is still no signals, please connect miso and mosi and then run

$ ./spidev_test -D /dev/spidev0.0 -v

You have confirmed this test works. Please check if there is signals in CS0 and SCK pins in the test.

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