Maximum samples per second for SPI communication on Jetson

I attempted to connect an AD board supporting up to 4 MSPS to the Jetson AGX Orin Developer Kit via SPI and tested the communication. However, even under an RT kernel, I was only able to achieve a speed of approximately 3 KSPS.

If there is any information available regarding the maximum performance achievable with SPI communication on Jetson devices, I would greatly appreciate it if you could share it.

Jetson AGX Orin
Jetpack 6.1 RT-KERNEL

Hi go.s,

Are you using the devkit or custom board for AGX Orin?

Is your issue specific to RT-Kernel? Or have you’ve also verified with default BSP package?
What do you mean about KSPS? sampling rate?
How do you configure the SPI frequency?

Thank you for your response, KevinFFF.

I am using the Developer Kit for testing.
I also conducted verification with the default BSP, and the behavior was exactly the same.
Incidentally, I tested with the Orin Nano under the default BSP as well, and there was no significant difference compared to the AGX Orin.

KSPS stands for kilosamples per second. The meaning is the same as sampling rate

For the SPI settings, I used Python’s spidev, set to mode 2 and a frequency of 23,999,999 Hz.
When the frequency exceeds 24 MHz, the values could no longer be obtained correctly.

By the way, the AD board being used is the AD7386, which supports 4 MSPS and a maximum clock speed of 80 MHz.

I would like to know the design’s maximum speed(samples per second) specification to determine whether further investigation is necessary.

Is your requirement to use SPI clock requency with 80MHz?

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

$ cat /sys/kernel/debug/bpmp/debug/clk/spi1/parent
$ cat /sys/kernel/debug/bpmp/debug/clk/spi1/max_rate

And the exact command you run with spidev in the loopback test.

This is the information you requested.

sudo cat /sys/kernel/debug/bpmp/debug/clk/spi1/parent
pllp_out0
sudo cat /sys/kernel/debug/bpmp/debug/clk/spi1/max_rate
81600000

loopback test code

import spidev

spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 40799999 # max speed

response = spi.xfer([0x01])
print(“Received:”, response)

spi.close()

Even with a loopback test, it seems the maximum achievable frequency is only 40,799,999 Hz.
I prioritize sampling rate over the clock. If there is a way to achieve 4 MSPS, please let me know.

Could you run the following command to check if it can help for your case?

$ sudo su
# echo 81600000 > /sys/kernel/debug/bpmp/debug/clk/spi1/rate

Please run the following command and start your test again.

Based on various tests, I found that while the SPI pins on the Jetson Orin are theoretically designed for 81,600,000 Hz, due to noise and other factors, the actual upper limit of achievable speed is around 40 MHz (in loopback mode).
To achieve a high sampling rate such as 4 MSPS, it is necessary to consider noise countermeasures and the use of DMA simultaneously.

In particular, the AD7386 used in this test requires issuing a communication command every time a value is acquired, so the speed ended up being only around 3 KSPS at best. If I had used an AD board that can continuously acquire values with a single communication command, I might have been able to set a higher sampling rate, even if there was a slight deviation.

If you happen to know of any partners who specialize in speeding up interfaces like SPI, I would greatly appreciate an introduction.