Where is the Device Tree in Xavier NX

Where do I find the device tree in the Xavier NX board. I can see lot of dtb, dtsi etc files, but I am not sure which is the actual device tree.

Also, I need to add SPI for a new codec board, but I am not able to fine any usable resources for the same. Please help me find the same.

Thanks in advance,
Abhigyan

hello abhigyanborah95,

you may looking for kernel init messages for the device tree it’s using.
for example, $ dmesg | grep DTS
it shows the complete path of the device tree sources, the default release file is coming from build machine.

[    0.434452] DTS File Name: /dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts

you should check /boot/ for the binary file, tegra194-p3668-all-p3509-0000.dtb

Thanks JerryChang,

Can you please tell me what the other dtb files are in /boot/ ?

Also I need to connect a new codec over SPI, so some advice on how I can add it to the device tree would be great!

Thanks,
Abhigyan

hello abhigyanborah95,

it copy those files under $OUT/Linux_for_Tegra/kernel/dtb for making the rootfs,
due to it’s device tree to specify the hardware configurations, they’re platform specific, as you can see, they’re named with tegra som, board-id, and carrier board id.

BTW, please refer to Jetson/TX2 SPI - eLinux.org for using SPI.

Hi JerryChang,

The SPI in my Device Tree looks something like this:

spi@3210000 {
		compatible = "nvidia,tegra186-spi";
		reg = <0x0 0x3210000 0x0 0x10000>;
		interrupts = <0x0 0x24 0x4>;
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		iommus = <0x2 0x20>;
		dma-coherent;
		dmas = <0x19 0xf 0x19 0xf>;
		dma-names = "rx", "tx";
		spi-max-frequency = <0x3dfd240>;
		nvidia,clk-parents = "pll_p", "clk_m";
		clocks = <0x4 0x87 0x4 0x66 0x4 0xe>;
		clock-names = "spi", "pll_p", "clk_m";
		resets = <0x5 0x5b>;
		reset-names = "spi";
		status = "okay";
		linux,phandle = <0xf2>;
		phandle = <0xf2>;

		spi@0 {
			compatible = "spidev";
			reg = <0x0>;
			spi-max-frequency = <0x2faf080>;

			controller-data {
				nvidia,enable-hw-based-cs;
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x0>;
			};
		};

		spi@1 {
			compatible = "spidev";
			reg = <0x1>;
			spi-max-frequency = <0x2faf080>;

			controller-data {
				nvidia,enable-hw-based-cs;
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x0>;
			};
		};
	};

I connected it to spi0 of my Xavier NX and when I did ./spidev_test -D /dev/spidev0.0 then I see the following Output:

spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | 99 93 32 64 9B 26 52 95 2A 55 2A AA 64 DB 24 C9 96 DB 6C 92 49 24 92 DB 6D B6 DB 5A 6D B6 B2 55  | ��2d�&R�*U*�d�$ɖ�l�I$��m��Zm��U

So my question is, what does this signify, and how can I use it to connect my codec?

Thanks,
Abhigyan

Did you short the MOSI/MISO as loopback test to verify the spidev_test?
[jetson-nano] spidev_test not working on L4T 32.4.4 · Issue #573 · OE4T/meta-tegra · GitHub

If you able saw the TX data the same as RX that tell the SPI pin configure done well. Then you should consult with device vendor to get the driver for it.

Is the spidev that is defined in the device tree acts as a dummy codec?

And where do I find the tegra194-audio-p3668.dtsi file in my Xavier board?

Thanks,
Abhigyan

Follow below document to get the source code. And the file at …/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-audio-p3668.dtsi

Hi, I am looing for this file in the Xavier board and not in the kernel source code. Where do I find it in the Xavier NX?

Please get the source code for it.

When in here they say “Update the device tree properties of the sound node for the platform when you customize the platform to support a third-party audio codec.”, do they mean I am supposed to update the tegra194-audio-p3668.dtsi file or I am supposed to update the dts file which I got after decompiling the tegra194-p3668-all-p3509-0000.dtb file?

Thanks,
Abhigyan

I am supposed to update the dts file which I got after decompiling the tegra194-p3668-all-p3509-0000.dtb file?

This would be preferred option as you would be modifying final dt and there wont be issue of override by some other file

Thanks

Here it says, the command to flash the Device Tree is $ sudo ./flash.sh -k <partition_name> [--image <image_name>] <board> <rootdev>. But I am not able to find the flash.sh file. So, where do I find it?

Thanks,
Abhigyan

Did you ever use sdkmanager before?

Hi, no I haven’t used any SDKManager before. Will I find the flash.sh file there?

Thanks,
Abhigyan

Hi,

Actually the development over jetson requires a x86_64 ubuntu 18.04 host and sdkmanger is working on that system.

Thus, you need to prepare such host first.

Hi,
I am already using an Ubuntu 20.04. In Step 1 (Development Environment) of the SDK Manager, it says no available releases for Ubuntu 20.04 for the Target Operating System. What should I do now?

Thanks,
Abhigyan

That is why I said 18.04…

But here it says the System Requirements for the host OS can be Ubuntu 20.04.

So what should I do now?

Thanks,
Abhigyan