Problem running the test for SPI

I managed to get spi3.0 device detected and now i am testing it based on the elinux documentation i was asked to follow

But the doc is terrible

in a copy of the kernel sources, change directories to tools/spi/
this requires an aarch64 (arm64) compatible gcc to be installed
Ex: sudo apt install gcc-aarch64-linux-gnu; CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make
copy the resulting spidev_test binary to the target system
Run spidev_test -D /dev/spidev3.0

What does this mean? Where is kernel sources?? I was told on the TX2 r32 i dont need the kernel files so how do i test this?

Is there a clear method to test SPI maybe using python? If yes, where is that example?

For the python
For the tools/spi it’s in the kernel source. Please reference to l4t document to get it.

I read this document but I still cannot understand why the pinmux did not do anything.

I’m lost, please help!

I followed the pinmux tutorial on the elinux site but I am stuck as to what package to use to access SPI interface and also
An example code in python

I will check the domotix link in the morning

Also according to the change I made to the pinmux, is that correct at least?
Thanks a lot!

I agree 100%. I used the Nvidia SDK Manager ( to setup the Jetson TX2. I, like many others, are finding it difficult to simply enable SPI. The doc which seems to be the one everyone points to ( could be significantly improved!!

I’ve spent the last few days trying to get it working and I think I reached the point where I need to test it. See my progress here for TX2 I too was wondering where to find the tools…the elinux doc (linked above) simply says “in a copy of the kernel sources, change directories to tools/spi/” but they fail to give the absolute path leaving everyone scratching their heads. I was able to find something here on my host OS


This directory was created following the SDK Manager setup. I don’t know if this is what @ShaneCCC is referring to by saying “For the tools/spi it’s in the kernel source”. This is just a repeated statement found in the elinux doc (linked above) and offers no support.

Nevertheless, I went to the directory I pointed to above and ran the following command (as the elinux doc says)

CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make

I get the following output:

make: *** No rule to make target ‘spidev_test’, needed by ‘all’. Stop.

The Makefile reads:


all: spidev_test spidev_fdx

	$(RM) spidev_test spidev_fdx

And this is where I’m stuck. The only file in the directory is the Makefile?!?!

Again, I’ve started with the SDK Manager and I’m working with the files installed by it. Starting from here, how do I create the spidev_test binary??

I tried to change the directory to ~/nvidia and run:

sudo find ./ -name “spidev*”

I get the following output:

Nothing about “spidev_test” which makes me wonder if I do have to obtain the souces? Maybe the SDK Manager does not natively obtain those sources?

OK…found “spidev_test.c”

The exlinux doc ( says:

“L4T source tarball available here:”

Well, obviously this link is not up to date, nor is the instructions generic enough to followed explicitly. That being said, there is a clue in the file name (which I highlighted in bold).

On the host OS

Goto the Jetson Download Center ( and you can scroll down or use the search filter to find “L4T Sources”. Be sure to download the version that matches the one used in your installed version of JetPack.

I just made a new directory called “kernal_sources” in my home directory and extracted the contents. The “spidev_test.c” can be found in:


I’m not sure why, but the SDK Manager does not download all the kernel source files? Therefore, in this case, the elinux doc is correct in telling you that you need to download the source files (albeit the instructions could be more clear and up to date). Nevertheless, performing the following steps will generate the necessary binary:

  1. sudo apt install gcc-aarch64-linux-gnu
  2. cd ~/kernal_sources/public_sources/kernel_src/kernel/kernel-4.9/tools/spi
  3. CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- make

With the Jetson powered up, you can “scp” the binary from the host over to the Jetson:


where you fill in the contents for “JETSON_USER_NAME”, “IP_ADDRESS”, and “TARGET_DIR”. Go over on the Jetson and you should find the binary file you just copied.

On the Jetson

I then followed the test procedures at the end of the elinux doc and executed the following command:

spidev_test -D /dev/spidev3.0

The output reads

spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | 00 00 00 00 00 (all zeros) | …

So, I’ve only got zeros spitting out at me. I think I need to check the pinmux settings.

Will follow up.

Hey! If you want, send me your email by PM and I will send you a document I made to setup SPI and test via Python

I am travelling right now and will be back in my office on Monday 9 sept so I can send you the document then

I was able to edit the pinmux settings and it appears that everything is working. See my final write up here for more details: