Howto enable SPI interface with Jetpack 4.2?

Hello,

I have just installed Jetpack 4.2 with R32.1 on my TX2i and now I am trying to enable the SPI interface without luck.

Based on the Wiki (https://elinux.org/Jetson/TX2_SPI) I have tried the following steps on the Jetson board:

  1. I have skipped the kernel/module compilation because there is already a file spidev.ko in /lib/modules/drivers/spi cat /lib/modules/$(uname -r)/modules.dep is also showing entries which are depending on spidev.ko
  2. $ cd /boot/dtb/ $ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree
  3. Editing the dts according to this post https://devtalk.nvidia.com/default/topic/1049488/jetson-tx2/tx2-spi4/
    spi@3240000 {
          ...
          spidev@0 {
            compatible = "spidev";
            reg = <0x0>;
            spi-max-frequency = <25000000>;
          };
        };
    ...
    
  4. sudo dtc -I dts -O dtb -o tegra186-quill-p3489-1000-a00-00-ucm1.dtb extracted_proc.dts
  5. Adding the line FDT /boot/dtb/tegra186-quill-p3489-1000-a00-00-ucm1.dtb in the file /boot/extlinux/extlinux.conf below LINUX /boot/Image

After rebooting the system the system will not start because it cannot find the tegra-xusb 3530000.xhci firmware.

I know some linux basics but I am far away from extert level. Can anybody tell me the missing/wrong steps?

Best regards

VicIpedia

Update the DTB by flash.sh instead of modification extlinux.conf
replace the dtb at nvidia_sdk/JetPack_4.2_Linux_P3310/Linux_for_Tegra/kernel/dtb/ and flash by below command

sudo ./flash -r -k kernel-dtb jetson-tx2 mmcblk0p1

@ShaneCCC: Still no luck but fortunately I have found my mistake.

First difference: All commands are performed on the host
The second one: In step 3 I created the source from the existing dtb instead of /proc/device-tree

  1. sudo apt-get install deveice-tree-compiler
  2. cd ~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3489/Linux_for_Tegra/kernel/dtb
  3. dtc -I dtb -O dts -o extracted.dts ./tegra186-quill-p3489-1000-a00-00-ucm1.dtb
  4. gedit ./extracted.dts Search for the string spi@3240000 { (Line 5397) Make the following entries
    spi@3240000{
        compatible = "nvidia,tegra186-spi";
        reg = <0x0 0x3240000 0x0 0x10000>;
        ....
        ....
        ....
        phandle = <0x184>;
        spi@0 {
          compatible = "spidev";
          reg = <0x0>;
          spi-max-frequency = <0x1312D00>;
          nvidia,enable-hw-based-cs;
          nvidia,cs-setup-clk-count = <0x1e>;
          nvidia,cs-hold-clk-count = <0x1e>;
          nvidia,rx-clk-tap-delay = <0x1f>;
          nvidia,tx-clk-tap-delay = <0x0>;
        }; 
     };
    
  5. dtc -I dts -O dtb -o tegra186-quill-p3489-1000-a00-00-ucm1.dtb extracted.dts
  6. Start the Jetson board in recovery mode
  7. cd ~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3489/Linux_for_Tegra
  8. sudo ./flash.sh -r -k kernel-dtb jetson-tx2i mmcblk0p1

After flashing the board there should be an entry /dev/spidev3.0

Best regards

VicIpedia

Hi Viclpedia,
Please can you confirm you are using a TX2i? I use TX2 dev kit and I modified(tegra186-quill-p3489-1000-a00-00-ucm1.dtb) exactly as described following the 8 step guide. However, when I reboot my TX2 after flashing, I do not see any see spidev.

Could it be that I am supposed to modify a “tegra186-quill-p3310-xxxxxxxx.dtb” file instead of a “P3489”?

I have got 3 .dtb files for P3310. I am unsure which to edit if I initially edited the wrong file.

Am I supposed to add the line
FDT /boot/dtb/tegra186-quill-p3489-1000-a00-00-ucm1.dtb in the file /boot/extlinux/extlinux.conf below LINUX /boot/Image ?
Although it was no part of the 8 step guide.

Thanks
Bade

Okay Its working now.

  1. I simply used the command "dmesg | grep “DTS File Name” on the TX2 terminal dev kit and it showed the .dtb file in use as “tegra186-quill-p3310-1000-c03-00-base.dtb”.

  2. I then followed the Viclpedia’s eight stepped process to edit the .dtb file. Rebooted … and it worked.

Thanks
Bade

Hi Bade,

yes, I am using a TX2i. As you already figured out the TX2 uses the p3310 dtb file.
And with flashing the board there is no need to add the FTD line in the extconfig.

Best regards

VicIpedia

Thank you so much for the help from VicIpedia! I’ve been stuck at this for days… spidev300 works on my Jetson TX2 dev. board!

I’m not sure why I couldn’t succeed by the tutorials from david_evans_g[1] and dwd_pete[2]. Are these two pages not compatible with Jetpack 4.2?

Thanks!

BRs,
escrowdis

PS:
[1]: https://devtalk.nvidia.com/default/topic/1024806/jetson-tx2/how-to-enable-spi-spidev-on-28-1-on-target-/
[2]: reply on the bottom of [1] at first page

Hi VicIpedia
does your step work on jetson? or a host?

Hi VicIpedia
does your step work on jetson? or a host?