Spi data becomes broken when spi frequency is faster than 500kHz

I am currently trying to do a SPI communication with my orin agx dev kit and a spi slave board I have.

I have done the jetson-io.py to turn on the spi functioning.

My spi communication works fine with the spi frequency with 0.5MHz, but the communication is too slow(about 5ms communication time) for my application target communication time of 500us. But when I increase the spi frequency higher than 0.5MHz, the spi communication becomes weird(the packets received seems to be broken). What is the problem? and how can I fix this problem? I also tried the same code in my upboard, but it works fine with 5MHz spi frequency, so it seems to be a hw problem or kernel driver problem of the orin agx dev kit I use.
I am sure that the wiring is not the issue since my spi slave board is is directly connected through the gpio 40 pin connector.

I tried JP6, JP5.1.3, JP5.1.2, but only JP5.1.2 seems to work fine about the SPI communication with large packets so I am sticking to this version. I also found some forums saying that the 5.10 kernel spi driver has some delays, so try using the 4.9 kernel’s spi-tegra114.c instead. But even with that my problem still exists.(when I set the spi maximum frequency higher, the communication becomes weird, to be specific if I check my checksum, it is all wrong).

when trying the 4.9 kernel’s driver file, I built it with the nvbuild.sh in the dev kit. And then by doing “sudo make modules_install” at the output folder I installed the custom driver module. Can this be a possible problem? should I use flashing method from the host pc to update the kernel of the dev kit?

Hi user19192,

Please build it on the x86 ubuntu host.

Yes, we would suggest you build it on host PC and flash the board to apply the change.

Could you reproduce the same issue if you short MISO/MOSI to perform loopback test instead of connecting the SPI slave device?

I will try to do the flashing

for the loopback test, it works fine even with 25MHz spi frequency.
This only occurs with the external SPI slave device.

So it should work with this frequency…

Do you have other SPI slave device to verify to clarify if the issue is specific to your current SPI slave device?

I do not have other SPI slaves to clarify, but I am sure that the slave device is not the problem, since it works fine with the other master pc like upboard.

Still, I am stuck with this problem and I really need to fix this problem. Is it due to the spi driver of orin? or is it the hardware problem of orin? I see lots of forums but I have seen no one who actually did the spi communication with the orin device, all of them are saying the orin is not working fine with the spi, so isn’t it the orin’s problem?

It may relate to the clock settings in Orin.

Could you share the full dmseg and device tree for further check?
and also the detailed steps how you verify SPI and which SPI interface you are using.

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