TX2 Jetpack 4.2.2 ,SPI enable

Hi, dear~
I have a Jetson TX2,Ubuntu 18.04,and Jetpack 4.2.2,I need to use SPI interface.

by the way, I can Succeed in enable SPI on TX2 Jetpack 4.2, and I try to use the same method for opening SPI by the following steps.

  1. decompiler the dtb to dts at
    $ sudo dtc -I dtb -O dts -o extracted_proc.dts tegra186-quill-p3310-1000-c03-00-base.dtb

  2. modify the dts
    $ sudo gedit extracted_proc.dts
    spi@3240000



    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>;
    };

  3. compiler dts
    $ sudo dtc -I dts -O dtb -o tegra186-quill-p3310-1000-c03-00-base.dtb extracted_proc.dts

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

by the way, I use NVIDIA SDK Manager get the jetpack4.2.2 Linux_for_Tegra file,but I didn,t use it to install tx2 jetpack4.2.2. I don’t know it have problem or not.

Check the pinmux config from this wiki page.

https://elinux.org/Jetson/TX2_SPI

I already modify pinmux config ~

  1. At /nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P3310/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-a00.cfg, the original config is the following message. I think I don’t need to modify it.

pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: spi4, tristate-disable, input-disable
pinmux.0x02430040 = 0x00000455; # gpio_cam5_pn4: spi4, pull-down, tristate-enable, input-enable
pinmux.0x02430048 = 0x00000401; # gpio_cam6_pn5: spi4, tristate-disable, input-disable
pinmux.0x02430050 = 0x00000409; # gpio_cam7_pn6: spi4, pull-up, tristate-disable, input-disable

  1. I try to modify tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg and tegra186-mb1-bct-pinmux-quill-p3489-1000-a00.cfg, but stiil not enable spi.

by the way…I already create the /dev/spidev3.0…

by the way…I don’t know what is the difference between a00 and c03…
I modify the tegra186-quill-p3310-1000-c03-00-base.dtb, which config I need to modify…a00 or c03??

For your case should be the xxxx-c03.cfg
Also you can have devmem2 to read it back to confirm the REG value.

Hi. I modify my tegra186-mb1-bct-pinmux-qull-p3310-1000-c03.cfg,results are as follows.

I finish flash my TX2…and then I check it address value by devmem. I get the following msg,it let me confuse why I didn’t modify it.

#./devmem 0x02430038
value at address 0x02430038 (0x7fa3fc4038):0x56
#./devmem 0x02430040
value at address 0x02430038 (0x7f97415040):0x56
#./devmem 0x02430048
value at address 0x02430038 (0x7f928e1000):0x56
#./devmem 0x02430050
value at address 0x02430038 (0x7f89e39050):0x58

please help me…

Did you do the whole system flash?

I just run “sudo ./flash.sh -k kernel-dtb jetson-tx2 mmcblk0p1”.

I didn’t want to reflash all…

Need flash whole system instead of -k
sudo ./flash -r jetson-tx2 mmcblk0p1

But why I didn’t need to flash whole system at jetpack4.2?

It mean if I want to modify config above version Jetpack4.2.2,I need to flash whole system and it will reset my system…

By the way…If I want to know 0x02430038 stand for which pin and 0x401 stand for what ?

and spi@3240000 which stand for spi1 or spi2…etc,How do I known…

If you have any document can let me study,please tell me,thank you.

You can see this pin is SPI4, then it’s map to software spi3 aka spi@3240000. SPI4 is HW pin name it start from 1, and software function start from 0
pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: spi4, tristate-disable, input-disable

But why I didn’t need to flash whole system at jetpack4.2?

It mean if I want to modify config above version Jetpack4.2.2,I need to flash whole system and it will reset my system…

Yes, if you need to update the cfg configure you need to flash whole system.

thank you…I try it on other board.
by the way…
pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: spi4, tristate-disable, input-disable
if I want to know other REG Value, how can I do…ex: 0x402、0x403…etc, maybe have a document show every bit which mean .

You should be able find it in TRM. Just search “gpio_cam4”

thank you~~
I sucessfully enable SPI and I can use it by flashing a new board.
by the way~ have any solution which can let me flash REG value without clean my system.

It is not convenient for me~

For the debug purpose you can use devmem2 to write the REG after boot to the OS.

@ShaneCCC
Hi,
What is TRM, could you give a link for jetson nano?

TRM is Technical Reference Manual. See (you might need to log in there, and then click the link a second time):
https://developer.nvidia.com/embedded/downloads#?search=trm&tx=$product,jetson_tx2