Slow and irregular SPI communication in Jetson Xavier NX developer kit

I am using a modified spidev_test.c that transfers 31 two-byte messages without a delay.

With the same code, I built binaries, one for raspberry pi 4B and the other for Jetson Xavier NX.
Both can read the data correctly. But the interval of message is very different:

  • purple line: SPI Clock
  • blue line: SPI MISO
  • red circle is the zone of 2 bytes data transfer
  • clock rate: 1MHz

Q1: Why is the interval of NX data transfer longer than PI and irregular?
Q2: I am using the device that needs to set the clock polarity high. It is high in idle at PI, but it goes to low in NX. Why is that?

Thanks for your reported, we are checking it.

I run a custom built os based on open-embedded.
When I tested it with the original ubuntu-based os, it had similar pattern but it was worse:

It looks like that this problem is related to the configuration of device tree / pinmux.
Could you advise me which config can cause this problem if my guess is correct?

I got this info from the following command:
sys.kernel.debug.gpio.txt (8.7 KB)

cat /sys/kernel/debug/gpio 

How can I know if this is correct or not?

Usually we use jetson-io to configure the pins for XNX.

Thanks

I have installed SDK Manager and flash the new firmware jetpack 5.0.1 to the NX devkit.
I enabled spi pins in pin header using jetson-io.
Then run “sudo modprobe spidev” after rebooting.

Unfortunately, nothing is changed in the oscilloscope signal.

I found this link has the same problem: How can I reduce the spi access delay?

I am sorry it was version 5.0.2

From the research so far, I think this delay comes from not misconfiguration but latency of the function calls in tegra spi driver. Can you help me?

Sorry for the late response, is this still an issue to support? Thanks

I found this problem comes from the context switching time of Linux. So I decided to use the SPI hardware delay that spi-tegra114 kernel driver supports.

Thank you.

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