Continous 12mbps SPI stream to Jetson Nano

After configuring Jetson Nano to act as a slave, I’m facing a problem now that Jetson is losing the moment when the master starts writing data. And it happens too frequently for big chunks of data (~500 bytes), like more than half is lost. For my use case, I need to reliably transfer 12MBits/s continuously.

My current plan is to (1) increase spi-max-frequency to allow me to test it with 30Mhz SPI clock and (2) to use gpio-slave-ready pin to let the master know when it can start to transfer.

If there is anything else I could try to do in order to achieve the goal of continuous transfer at 12mbps data rate please let me know. Maybe I should consider increasing the buffer size? What can be reasonable for Jetson? 4096? More? Or patch the driver for my particular use case? Using dual/quad SPI? If so, is there any documentation how to properly set it up on Jetson? Or maybe it’s possible to configure the SPI driver to run with higher priority?

By leveraging the nvidia,slave-ready-gpio and synchronizing the master with it I was able to fully eliminate problems with DMA getting wrong number of bytes half the time.

I also tested it with different buffer sizes and bits-per-word combinations.

The master transmits at 15MHz, as soon as the slave is ready. The master always ready to transmit. The only delay there is caused by Jetson’s delay on the nvidia,slave-ready-gpio pin.

|     test          |   bandwidth   |   η   |
| buf16xbpw32       | 1,197,248bit  | 8.0%  |
| buf16xbpw32   MAX | 1,285,672bit  | 8.6%  |
| buf1920xbpw8      | 5,328,047bit  | 35.5% |
| buf256xbpw32      | 5,763,602bit  | 38.4% |
| buf4096xbpw8      | 5,754,540bit  | 38.4% |
| buf256xbpw32  MAX | 7,037,800bit  | 46.9% |
| buf4096xbpw32     | 9,810,778bit  | 65.4% |
| buf1920xbpw32 MAX | 12,810,675bit | 85.4% |
| buf4096xbpw32 MAX | 13,508,598bit | 90.1% |

buf - buffer size
bpw - bits per word
MAX - forcing Jetson to run at maximum frequencies

These are of course purely synthetic tests - on both sides nothing else happens except transmitting and receiving.

I wonder why bits-per-word give such huge boost. Is that expected? For 4096 bytes buffer, the difference is more than 2x.

What else could I do to reduce overhead and increase efficiency? At least to minimize the gap when forcing Jetson to run at maximum frequencies. I’d prefer to keep Jetson at default power consumption settings because it is powered by a LiPo battery.

Hi swrqmail,

Are you using the devkit or custom board for Jetson Nano?
What’s your Jetpack version in use?

What’s your use case for SPI?

What’s your current max data rate for SPI could be achieved?
and what’s your desired rate?

Please also share the full device tree for further check.