AGX Orin flash and boot up on pcie C0

Hi Nvidia,

I’m using AGX Orin , customer carrier board, L4T36.4.3

When I flash the OS on Pcie C4. It works fine and pcie C0 can read/write M.2 storage.

But when I try to flash OS on C0, the l4t_initrd_flash.sh will time out on Step3.

Can AGX Orin flash and boot up on C0 Storage?

*** Please note that this reply is generated by LLM automatically ***

The Jetson AGX Orin module supports booting from various storage devices, including PCIe NVMe storage. However, the default configuration of the module is set to boot from the internal QSPI or eMMC storage.

To flash and boot the OS on the C0 storage (PCIe NVMe), you need to modify the boot configuration and ensure that the storage device is properly configured.

Here are the steps to follow:

  1. Modify the boot configuration: You need to update the bootloader/uefi_jetson.bin file to include the PCIe NVMe storage as a boot device. You can do this by modifying the Linux_for_Tegra/bootloader/uefi_jetson.bin file and adding the PCIe NVMe storage device to the boot list.
  2. Configure the PCIe NVMe storage: Ensure that the PCIe NVMe storage device is properly configured and recognized by the system. You can do this by checking the dmesg output and verifying that the storage device is detected and initialized correctly.
  3. Update the flash.sh script: You need to update the flash.sh script to include the PCIe NVMe storage device as a target device. You can do this by modifying the Linux_for_Tegra/flash.sh script and adding the PCIe NVMe storage device to the list of target devices.

Here is an example of how to modify the flash.sh script to include the PCIe NVMe storage device:

sudo ./flash.sh -i "./ekb.key" jetson-agx-orin-devkit nvme0n1p1

In this example, nvme0n1p1 is the device name of the PCIe NVMe storage device.

Comparison with other storage devices:

  • Internal QSPI: The internal QSPI storage is the default boot device for the Jetson AGX Orin module. It is a relatively slow storage device, but it is reliable and easy to use.
  • eMMC: The eMMC storage is another popular storage device for the Jetson AGX Orin module. It is faster than the internal QSPI storage, but it may not be as reliable.
  • PCIe NVMe: The PCIe NVMe storage is a high-speed storage device that is ideal for applications that require fast storage access. However, it may require additional configuration and setup to work properly.

In summary, the Jetson AGX Orin module can flash and boot up on the C0 storage (PCIe NVMe) device, but it requires additional configuration and setup. By modifying the boot configuration, configuring the PCIe NVMe storage device, and updating the flash.sh script, you can successfully flash and boot the OS on the C0 storage device.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

You could start from checking the UART log first.

Hi Wayne,

This is my uart log.

It looks that the the system can get nvme0n1 when system boot.

But flash tool is still time out.

AGX_Orin_C0_flash_failed.txt (83.4 KB)

Hi,

The issue is not related to NVMe but the USB device mode fails to get detected.

[ 12.277207] tegra-xudc 3550000.usb: EP 0 (type: ctrl, dir: out) enabled

If USB device mode is detected, then above line should be printed multiple times. But it only showed once in your case.

Does your hardware design support usb device mode?

Hi Wayne,

What do you mean the usb device mode?

initrd flash requires not only USB0 to be in recovery mode. When initrd is up, it has to be USB device mode.

如果你需要中文解釋的話…簡單來說, 你使用的那個flash port需要能當USB device… 也就是要支援OTG.

Hi Wayne,

抱歉我看不太懂,你的意思是initrd flash在燒錄過程需要用到USB OTG嗎?

我們設計是

C0是M.2 B-Key PCIe,此Port有USB及PCIe x1,無法燒錄L4T

C4是M.2 M-Key PCIe,此Port 是純PCIe x4,沒有USB,可以用來燒錄

但C4是純PCIe卻可以燒錄,這邊不太理解,能麻煩你再詳細說一下嗎?

Hi,

感覺你好像搞錯了方向. 這條目前的問題跟你的PCIe沒有關聯. 你不用說明C0/C4的差異. 因為問題根本不在那裡

這邊先解釋一下flash的機制.

目前Orin AGX上能使用的flash tool有兩種

  1. flash.sh
  2. l4t_initrd_flash.sh

不論哪一種燒錄方式, 都是host PC用USB線接著你的Jetson燒錄. 所以你的host PC這時候得當USB host的角色. Jetson需要當USB device.

當你用pin或是按鈕把device切進recovery mode之後. host PC上使用"lsusb"指令能讀到Jetson, 代表Jetson這時候進入的usb device mode.


以上部份是flash.sh跟initrd_flash共同的部份. 接下來講解不同的地方

  1. flash.sh的燒錄過程不會有Jetson開進Linux kernel的部份. 基本上就是透過BootRom從host PC端直接寫資料進去Jetson裡面. 這個過程不會在意你的device tree內容是對還是錯的. 就是完全寫進去之後開始進行開機. 這種方法比較簡單但有侷限性. 比方說他只能燒eMMC, 沒辦法燒錄external drive (NVMe/USB)

  2. l4t_initrd_flash.sh 是為了能燒錄external drive設計的. 這個tool 會先使用flash.sh讓你的Jetson開進initrd. 之後在initrd這階段偵測到nvme或是usb drive之後再把資料寫入這些SSD.
    在initrd 階段跟host之間的連線還是需要usb host/device的角色. 但這時候變成initrd要負責維持usb的功能. initrd基本上就是Linux kernel的作用機制. USB driver在這時候必須得正確執行讓Jetson保持在usb device mode的角色. 而USB driver有沒有辦法正確執行基本上就是device tree有沒有寫對.
    Device tree基本上又要搭配你的USB port怎麼設計的. 比方說一個type A usb port本來就沒有OTG的功能.


如果以上有看懂的話, 現在問題是在問你的USB0那個connector是如何設計的. 跟什麼PCIe C0/C4長怎樣完全沒有關聯.

感謝回覆,

flash.sh和l4t_initrd_flash.sh及USB OTG的部分我理解了,

我們所使用的燒錄USB port是使用USB0_N(F13)/USB0_P(F12)這2 pin,應該是有支援OTG才對。

而且我們C4燒成功了,是否就表示USB port正常?

以下是我USB,device-tree的部分

padctl@3520000 {
                        status = "okay";

                        pads {
                                usb2 {
                                        lanes {
                                                usb2-0 {
                                                        status = "okay";
                                                };

                                                usb2-1 {
                                                        status = "okay";
                                                };

                                                usb2-2 {
                                                        status = "okay";
                                                };

                                                usb2-3 {
                                                        status = "okay";
                                                };
                                        };
                                };

                                usb3 {
                                        lanes {
                                                /*usb3-0 {
                                                        status = "okay";
                                                };*/

                                                usb3-1 {
                                                        status = "okay";
                                                };

                                                usb3-2 {
                                                        status = "okay";
                                                };
                                        };
                                };
                        };

                        ports {
                                usb2-0 {
                                        mode = "otg";
                                        usb-role-switch;
                                        status = "okay";
                                };

                                usb2-1 {
                                        mode = "host";
                                        status = "okay";
                                };

                                usb2-2 {
                                        mode = "host";
                                        status = "okay";
                                };

                                usb2-3 {
                                        mode = "host";
                                        status = "okay";
                                };

                                /*usb3-0 {
                                        nvidia,usb2-companion = <1>;
                                        status = "okay";
                                };*/

                                usb3-1 {
                                        nvidia,usb2-companion = <0>;
                                        status = "okay";
                                };

                                usb3-2 {
                                        nvidia,usb2-companion = <3>;
                                        status = "okay";
                                };
                        };
                };

                usb@3550000 {
                        status = "okay";

                        phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>,
                               <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>;
                        phy-names = "usb2-0", "usb3-1";
                };

                usb@3610000 {
                        status = "okay";

                        phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>,
                               <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-1}>,
                               <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-2}>,
                               <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-3}>,
                               <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>,
                               <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-2}>;
                        phy-names = "usb2-0", "usb2-1", "usb2-2", "usb2-3",
                                    "usb3-1", "usb3-2";
                };

Hi,

有幾個地方不太正確.

我們所使用的燒錄USB port是使用USB0_N(F13)/USB0_P(F12)這2 pin,應該是有支援OTG才對。

這一句話並不正確. 而且其實沒有提供什麼資訊出來.
USB2-0本來就是使用這兩根pin. USB OTG有沒有支援也不是看這兩根pin. 是額外的設計才會支援所謂的otg.
比方說好了, 你把這個port做成usb type A, 一定也是有這兩根pin. 但type A當不成OTG port.
如果拿這兩根加上其他額外的id pin/vbus det pin做成micro usb port才有辦法完整的支援OTG.
可能有部份的USB知識你得自己從網路上補充. 我目前只能說請你把usb部份的線路圖提供出來給我們看一下.

而且我們C4燒成功了,是否就表示USB port正常?

並不一定. USB常常有機會剛好能使用. 但其實只是運氣好… 我們也是看過很多用戶碰到這種狀況.

請你在UART卡在下面這一段log的時候插拔一下你的usb線, 看一下uart 端有沒有新的log出現.

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-5.1#

Hi Wayne,

附件是我們USB的設計,我們使用USB-C的接頭但只有拉USB0_N/USB0_P

詳細請參考附件。

UART部分,我插拔USB,沒有新log,沒有任何變化。

Hi,

  1. 這個設計基本上是沒辦法照usb type C spec上預期的做OTG… type C connector上的CC pin就是決定 usb role用的. 但你的圖上是NC.

  2. 請你在系統卡在initrd的時候確認一下以下node有沒有存在, 有的話cat一下內容

/sys/class/usb_role/usb2-0-role-switch/role

Hi Wayne,

以下是cat內容

bash-5.1# cat /sys/class/usb_role/usb2-0-role-switch/role
device

能請你在device tree裡面加上這一段,然後再試試看嗎

                                        mode = "otg";
                                        usb-role-switch;
                                        status = "okay";
+                                       role-switch-default-mode = "peripheral";
                                };

另外也換一條usb cable試試

Hi Wayne,

已加入role-switch-default-mode = “peripheral”;

也有換線測試,看起來狀況相同,卡在3550000.usb: EP0後進入bash,沒有後續。

請問你們type C的話有測試過正面反面的插拔嗎?

目前測試兩條線,正反面都燒錄測試,都一樣卡3550000.usb: EP0

Hi,

目前可能先燒進去eMMC之後debug會比較有效率. 能請你用現在這個device tree跟flash.sh先用emmc開機嗎?

開機之後我們再來測試這個type C port的device mode狀況.

Hi Wayne,

我嘗試將我目前的device tree環境嘗試用flash.sh燒錄emmc開機,但會fail。

[   13.435426] pci_buins007mod /l:00: busnule_re[bus/5s 0.150-ff] .14is released
ernel/drivers/nvme/host/nvme-core.ko
insmod /lib/modules/5.15.148-tegra/kernel/drivers/nvme/host/nvme.ko
insmod /lib/modules/5.15.148-tegra/kernel/drivers/thermal/tegra/tegra-bpmp-thermal.ko
insmod /lib/modules/5.15.148-tegra/kernel/drivers/pwm/pwm-tegra.ko
insmod /lib/modules/5.15.148-tegra/kernel/drivers/hwmon/pwm-fan.ko
Checking whether device /dev/mmcblk?p1 exist
[   13.473687] Finding OTA work dir on external stoking fe devi wocesrk directory on the device(s): /dev/mmcblk0p1
[   13.482884] mount /dev/mmcblk0p1 /mnt
[   14.367697] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[   14.369424] is_boot_part_for_disk_enc /dev/mmcblk0p1 /mnt
[   14.389051] OTA work directory /mnt/ota_work is not found on /dev/mmcblk0p1
Checking whether device /dev/sd?1 exist
Device /dev/sd?1 does not exist
Checking whether device /dev/nvme?n1p1 exist
Device /dev/nvme?n1p1 does not exist
[   18.498559] Finding OTA work dir on internal storage device
[   18.499695] mount /dev/mmcblk0 /mnt
[   18.520377] exFAT-fs (mmcblk0): invalid fs_name
[   18.520384] exFAT-fs (mmcblk0): failed to read boot sector
[   18.520386] exFAT-fs (mmcblk0): failed to recognize exfat type
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/mmcblk0, missing codepage or helper program, or other error.
[   18.554913] Failed to mount /dev/mmcblk0 on the /mnt
[   18.556005] Failed to run "mount_ota_work_partition /dev/mmcblk0 /mnt"
[   18.557082] OTA work directory is not found on internal and external storage devices
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-5.1#

另外詢問一下,目前已知我們的USB硬體設計上不符合OTG設計,

如果我們想依照我們目前Type C的設計,做簡單的跳線驗證,

能否將某一根Pin(比如E56 SPI3_CS1),強制拉Low來代表id pin/vbus det pin,來實現OTG mode?