How To Enable SPI/SPIDev on L4T 32.2.0 ?

Hi!

How to enable SPI/SPIDev on L4T 32.2.0 ? I think https://elinux.org/Jetson/TX2_SPI is not working anymore.

I can load the SPI module ($ sudo modprobe spidev) but I don’t see nothing on /dev/spi*

Thanks!
Mauricio

Hi Mauricio,

For J4.2 you don’t need to rebuild the kernel Image but must edit the dtc like the elinux tell like below.

Update The Device-Tree
Use your text editor of choice to update the DTS that we decompiled above:

 $ sudo gedit myTX2DeviceTreeSource.dts
Make the following patches:

 spi@3240000{
    compatible = "nvidia,tegra186-spi";
    reg = <0x0 0x3240000 0x0 0x10000>;
    ....
    ....
    ....
    linux,phandle = <0x80>;
    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>;
    }; 
 };
Recompiling the Device Tree
Use DTC again to recompile the modifying DTS back into the new DTB:

 $ cd /boot/dtb/
 $ sudo dtc -I dts -O dtb -o tegra186-quill-p3310-1000-c03-00-base.dtb extracted_proc.dts
Enabling the New DTB
It's better flash the DTB by flash command instead of modify the extlinux due plugin manager will broken may cause unknow problem like break the network interface. Below is the command flash the DTB only.

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

Also check below topics for reference.

https://devtalk.nvidia.com/default/topic/1050427

https://devtalk.nvidia.com/default/topic/1049170

https://devtalk.nvidia.com/default/topic/1049488