Steps to enable SPI interface on AGX Xavier

Hello,

I want to integrate the Beaglebone AI with the Xavier AGX bus using CAN interface. I am using “MCP2515 CAN Bus Breakout Board With SPI Interface” for this. The JetPack version I am using is 4.4. Can anyone please help me with the steps to enable the SPI interface on Xavier AGX board?

Thanks in advance.

Have a reference to below link for SPI pin configure.

I downloaded the bsp source code (https://developer.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/Sources/T186/public_sources.tbz2) on the target NVIDIA AGX device.but I cannot find the .cfg extension file for t18x platform. The board type is t186ref. I can only find the .cfg file for the t19x platforms.

I am confused whether this should be done on the host machine or the NVIDIA AGX target board.

Can you please clarify the following points:
a) Do I need to create a .cfg file for spi interface with the pinmux modifications?
b) Can you please point me to the data sheet which contains the address of the spi device?
c) Do I need to modify/create a new device tree blob file?

“Please modify the pinmux for spi1 like spi2 does. file name: tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg”

I cannot find the tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg in the BSP source code.

The cfg file gen by the sdkmanager. Please download the sdkmanager to check it.

Thanks for the update.
I have applied the Rt linux patch to make the kernel real time. I did this by downloading the BSP source code (on Nvidia AGX board)and then compiling the kernel image using Rt linux patch.

How can I flash the Jetson xavier with RT linux patch and the SPI interface enabled?

Have a check below link to update the dtb and just replace the /boot/Image for the customized kernel Image.

Hi Shane,

I don’t see the link. Are you referring the link you posted earlier?

Sorry, Please check below link.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fkernel_custom.html%23

I did the pinmux configuration for the SPI1 device. What are the steps to create the corresponding device tree file? Should that be done on host machine or target Nvidia device?

I found this post to modify the device tree

The reference link is update the cfg file and update the image from host machine.

  1. download skdmanager.
  2. Using sdkmanager to download and install the image.
  3. Modify the cfg file that gen by the sdkmanger. You can find the path from the sdkmanager GUI
  4. modify the cfg file
  5. flash the Image again.

I downloaded the nvidia target source code using the sdk manager.
The JetPack version is “JetPack_4.4_Linux_JETSON_AGX_XAVIER”. However, the bsp version in nv_tegra folder show the JetPack version as 32.4.3.

Here are the steps that I performed:

  1. Downloaded the nvidia_host and nvidia_target source code using sdk manager.
  2. Ran the script source_sync.sh with tag tegra-l4t-32.4.4. This downloads the source in the new folder created with the name “sources” containing kernel/kernel-4.9, u-boot and hardware sub directory.
  3. Go to directory kernel/kernel-4.9 and applied the rt-linux patch and modified the pinmux settings.
  4. Built the kernel.
    make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j8
  5. Copied the image and dts directory to Linux_for_Tegra/kernel/Image and Linux_for_Tegra/kernel/dtb.
  6. Installed the kernel modules.
  7. Flashed the image using sudo ./flash.sh jetson-xavier mmcblk0p1.

When I execute the uname -a command it does not reflect the RT Linux and rather reflects the normal Linux image.
The byte size of the Image built does not match with the byte size of the Image flashed.
The /dev/ directory shows two files spidev0.0 and spidev0.1.
and insmod shows that the spidev is installed.
After running the spidev_test(downloaded from linux open source) with /dev/spidev0.0 I do see the packets being send and received. I connected to MISO and MOSI pins (pin 19 and 21).

My further question is :
How do I modify the transmission speed?
What is the reason that the RT-Linux is not enabled?

You need to replace the Image to apply the customized kernel Image too.
spidev_test -s should be able to set the speed.