您好,我們需要在Orin NX 16GB的板子上掛載IMU的驅動,
從位置圖上來看IMU是需要使用SPI3的接口,因此我們嘗試修改了pinmux, gpio, padvoltage的dtsi,以及SPI3(SPI@3230000)的device tree,
pinmux, gpio, padvoltage是使用spreadsheet產生的,dtsi檔案如下:
pinmux :tegra234-mb1-bct-pinmux-p3767_test.txt (65.8 KB)
gpio :tegra234-mb1-bct-gpio-p3767_test.txt (3.5 KB)
padvoltage :tegra234-mb1-bct-padvoltage-p3767_test.txt (2.4 KB)
產生後把pinmux, padvoltage放置到/Linux_for_Tegra/bootloader/t186ref/BCT,
把gpio放置到/Linux_for_Tegra/bootloader/,
並且在Linux_for_Tegra下對Orin進行重新燒錄,以下方指令:
$sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1
-c tools/kernel_flash/flash_l4t_external.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml”
–showlogs --network usb0 jetson-orin-nano-devkit internal
並且在Orin上的boot/dtb/kernel_tegra234-p3767-0000-p3768-0000-a0.dtb上新增了spi3的device tree:
kernel_tegra234-p3767-0000-p3768-0000-a0.txt (432.9 KB)
spi@3210000{ /* SPI1(SPI0) - TX to MCU*/
status = “okay”;
spi@0 { /* chip select 0 /
compatible = “tegra-spidev”;
reg = <0x0>;
spi-max-frequency = <50000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
/ spi@1 chip select 1 removed /
spi@1 { / chip select 1 */
compatible = “tegra-spidev”;
reg = <0x1>;
spi-max-frequency = <50000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
};
mytest{
status = "okay";
};
…
spi@3230000{ /* SPI3(SPI1) - RX from MCU /
status = “okay”;
num-cs = <1>;
spi@0 { / chip select 0 /
compatible = “tegra-spidev”;
reg = <0x0>;
spi-max-frequency = <50000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
/ spi@1 chip select 1 removed /
spi@1 { / chip select 1 */
compatible = “tegra-spidev”;
reg = <0x1>;
spi-max-frequency = <50000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
};
再Orin上reboot後,讀取pinmux的spi1與spi3的設定,看起來是有成功燒錄進去Orin :
eb@eb-desktop:~$ sudo busybox devmem 0x0243d008
0x00000408
eb@eb-desktop:~$ sudo busybox devmem 0x0243d018
0x00000454
eb@eb-desktop:~$ sudo busybox devmem 0x0243d028
0x00001404
eb@eb-desktop:~$ sudo busybox devmem 0x0243d038
0x00000408
eb@eb-desktop:~$ sudo busybox devmem 0x0243d040
0x00000404
eb@eb-desktop:~$ sudo busybox devmem 0x0243d000
0x00000454
eb@eb-desktop:~$ sudo busybox devmem 0x0243d010
0x00000404
eb@eb-desktop:~$ sudo busybox devmem 0x0243d020
0x00000404
eb@eb-desktop:~$ sudo busybox devmem 0x0243d030
0x00001404
eb@eb-desktop:~$ sudo busybox devmem 0x0243d048
0x00000404
在ls /sys/firmware/devicetree/base/ 上也看的到加進去的spi3@3230000的device tree,
但是在/dev/底下沒有看到有關spidev相關的驅動,
所以使用:$sudo ./spidev_test -D /dev/spidev0.0 -v 無法測試成功,顯示的訊息為/dev/spidev0.0 找不到相關的路徑,
想問一下如何確認spi3有成功加入?
以及為什麼/dev/下沒有spidev相關的設備與驅動產生?
如上述操作說明,我們還可以做什麼修改?
謝謝!
Hi cy_hong,
Are you using the devkit or custom board for Orin NX?
What’s the Jetpack version in use?
Do you also modify the board config file to specify the name of your new pinmux dtsi?
Could you run sudo modprobe spidev
to load the driver and run ls -l /dev/spi*
to check if there’s the node generated?
Which IMU are you using? Does it work with spidev driver or you should port its custom driver?
Are you using the devkit or custom board for Orin NX?
custom board, Holybro Jetson orin series
What’s the Jetpack version in use?
Jetpack : 5.1.2
Do you also modify the board config file to specify the name of your new pinmux dtsi?
board config file is Linux_for_Tegra/p3768-0000+p3767-0000.conf ? If is the file, I also modify the name of new dtsi for the conf file.
Could you run sudo modprobe spidev
to load the driver and run ls -l /dev/spi*
to check if there’s the node generated?
Which IMU are you using? Does it work with spidev driver or you should port its custom driver?
Invensense IIM42652
IMU的連接原理圖:
圖上看起來是連接到spi3,我們目前已經做的步驟:
spreadsheet修改pinmux,產生pinmux, padvolatge, gpio dtsi,放置對應的路徑,修改conf,重新燒錄Orin並成功開機
修改device tree,Orin的boot/dtb 新增spi3的device tree (spi@3230000)
如何確認pinmux與spi3的device tree正確修改與新增? 以及我們接下來可以做什麼來正確掛載IMU的驅動?
謝謝!
cy_hong:
但/dev/下還是沒有spi相關資料夾
It is not the expected result to me.
Could you check if there’s any errors in dmesg when you load the driver?
Please run the following command on your board and share extracted_proc.dts for further check.
$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree
cy_hong:
以及我們接下來可以做什麼來正確掛載IMU的驅動?
Sorry that I’m not familiar with your IMU module.
Please also check this with the vendor of your IMU module.
Maybe you need the porting guide and also the custom driver for this module rather than use current spidev driver.
spi@3230000 {
num-cs = <0x01>;
status = "okay";
spi@1 {
spi-max-frequency = <0x2faf080>;
compatible = "tegra-spidev";
reg = <0x01>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,tx-clk-tap-delay = <0x00>;
nvidia,rx-clk-tap-delay = <0x10>;
};
};
spi@0 {
spi-max-frequency = <0x2faf080>;
compatible = "tegra-spidev";
reg = <0x00>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,tx-clk-tap-delay = <0x00>;
nvidia,rx-clk-tap-delay = <0x10>;
};
};
};
It seems you lost lots of attributes in spi@3230000
node.
Do you remove the attributes like the following?
spi@3210000 {
compatible = "nvidia,tegra210-spi";
reg = <0x00 0x3210000 0x00 0x1000>;
interrupts = <0x00 0x24 0x04>;
#address-cells = <0x01>;
#size-cells = <0x00>;
clocks = <0x03 0x87>;
assigned-clocks = <0x03 0x87>;
assigned-clock-parents = <0x03 0x66>;
clock-names = "spi";
iommus = <0x04 0x04>;
resets = <0x03 0x5b>;
reset-names = "spi";
dmas = <0xdf 0x0f 0xdf 0x0f>;
dma-names = "rx\0tx";
dma-coherent;
status = "okay";
Yes, I remove the attributes, because I follow the thread to modify spi@3230000.
Hi,
I’m currently trying to get SPI1 and SPI3 working on our custom board. I’m using spidev_test as the first way of testing if loopback works (by shorting MISO and MOSI) - while doing this I am also monitoring the clock and chip-select pins.
Here is the result of SPI1 (If my analysis is correct, this is spi@3210000 in the device tree and enumerates as spidev0.* in Linux)
[image]
(I don’t have an image, but I can see that CS0 is HIGH on idle and transitions LOW during the write - this is wh…
So I need to add the attributes for spi@3230000? And how can I modify the parameters for the attributes of spi@3230000?
thanks!
Yes… SPI would need those attributes.
You can just start from scratch to flash your board w/o any modification in SPI.
Then, those attributes should exist by default.
system
Closed
October 9, 2024, 2:19am
11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.