Skip to content

Cart

Your cart is empty

How to Test SPI Interface on DSBOARD-NX2 with Xavier NX in C?

WHAT YOU WILL LEARN?

1- How to configure BSP files to enable SPI?

2- How to Test SPI?

ENVIRONMENT

Hardware: DSBOARD-NX2 with Jetson Xavier NX

OS: Jetpack 4.6

In this blog post, we will use SPI port which is on the extension connector. First we will flash the module which includes BSP files. Then, we will copy test file to Jetson. Afterwards, we can build test file and execute it. 

Configuring BSP Files

Open the target HW image folder.


(${HOME}/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra/)


Download SPI BSP files from here & extract it. 

Copy files that mentioned below to the directories inside JetPack-4.6.

Move tegra194-p3668-all-p3509-0000.dtb file inside to ./kernel/dtb directory and overwrite on the file that exist before.


Move tegra19x-mb1-pinmux-p3668-a01.cfg file inside to ./bootloader/t186ref/BCT directory and overwrite on the file that exist before. 


Return to the “Linux_for_Tegra” folder and open a Terminal.


Type "lsusb" and check the device connected in Recovery mode (0955:7e19 NVidia Corp.)


After this step, you can flash the module with the command below.


sudo ./flash.sh jetson-xavier-nx-devkit-emmc mmcblk0p1

When the flash is successfully done, the module will reboot and open itself.

Testing SPI

First, we need to connect MOSI to MISO pins with a jumper. Below image shows connector’s pinout.


After that, we need to download spidev_test file from here and extract it. 

Then, go to file destination, open a terminal there and compile this file using below command:


gcc -o spidev_test spidev_test.c


After this step, use below command to test SPI:


sudo ./spidev_test -D /dev/spidev0.0



Thank you for reading our blog post.