How to directly use the flash command to flash Thor

Hello NVIDIA experts,

I am currently using a custom board. In our hardware design, we have removed the PD controller. I have noticed that when using the l4t_initrd_flash.sh script for flashing, the device fails to enter recovery mode after booting into the small system and times out. Since the l4t_initrd_flash.sh script ultimately calls the flash.sh script for flashing, is it possible to directly use the flash.sh script for flashing? This might require specifying a configuration file with the -c cfgfile option.

how about “Bringing Up the Jetson Module for the initrd Flash Tool”board_config_for_flashing.cfg how to write it

no, by default it is expected to use initrd flash. flash.sh has no capability to flash external storage like NVMe SSD or USB drive.

flash.sh only does partial work in initrd flash.

Hi,WayneWWW

In the development documentation, does the section “Bringing Up the Jetson Module for the initrd Flash Tool” apply to my situation? I notice that it seems possible to add a configuration file to describe the customization. how to write the board_config_for_flashing.cfg ? we do not have PD as devkit,How do I write this custom configuration file? What is the format, and could you provide an example?

As shown in the schematic above, our USB Type-C is currently directly routed out. In this situation, how can I make the USB act as a device in the ramdisk, so that the USB can be recognized by the host again? I urgently need your help. We currently have multiple custom boards waiting for firmware flashing.

Hi,

The purpose of that document is just to tell you that you could create your own board config file which you used to flash your board in the flash command.
For example, Orin flash command has “jetson-agx-orin-devkit”. That means it is using “jetson-agx-orin-devkit.conf”.

This document is just telling you could create something like “my_board.conf” with content similar to the one you used to flash Thor.

This file has nothing to do with USB device mode. USB device mode configuration still relies on the device tree configuration in the adaptation guide.

Note that files for config (like “jetson-agx-orin-devkit.conf”) are plain text and human-readable. One file might include another, and so parts can be reused in customizing, e.g., copy “jetson-agx-orin-devkit.conf” to a new name.conf, and copy the parts which are unchanged, include those, and then copy an edited version of the other files as needed.

If you examine (in “Linux_for_Tegra/”) this:
ls -l jetson-agx-orin-devkit.conf
…then you will see that this is just a more “human” name for the actual “technical” name file. That “technical” name consists of a module name (there is a file for the module part) and the carrier board name (that also has a file which is included). Sometimes there is also a hardware revision in the technical name.

Sometimes people make their own disk drive layout (mainly just the rootfs size), which is edited in one of the XML files. In your case you could reuse the module part verbatim, and probably make changes to the carrier board file(s). Part of this is likely a device tree change (and you can have it use the correct device tree that way).

On a normally booted Jetson, when USB is a “device”, this is just the kernel’s “USB Gadget” feature. USB has some “standard” devices which all use the same code, e.g., keyboards, and compliant virtual block storage (disks, e.g., how a smartphone makes a filesystem available). More details:
https://forums.developer.nvidia.com/t/xavier-nx-bridge-usb-otg-connected-host-identifies-pcie-connected-nvme-ssd-as-disk/254268/5

USB Gadget is not specific to a Jetson, it is a general feature “framework” in Linux. When a partition is presented, then it doesn’t matter if it is a real partition, or a RAM disk loopback partition (it just happens that NVIDIA’s use is for a loopback covered file, where that file is the correct size and formatted under loopback).

Hi,WayneWWW

I’m very glad to receive your reply. It seems that I misunderstood the cfg file earlier. It turns out that this custom cfg file is for partition layout. Based on the schematic above, I only want to fix the device without role switching, and hope to transfer data for flashing this way. The device tree modifications are as follows. Could you please help check if any further adaptation is needed?

                        ports {
                                usb2-0 {
                                        mode = "peripheral";
                                        //usb-role-switch;
                                        //role-switch-default-mode = "peripheral";
                                        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 {

I don’t see your full wiring on Thor part, so usb2-0 is coupled with usb3-1 too?

Hi,WayneWWW

I haven’t made any other changes. Should I remove the union with 3.0?

tegra264-p4071-0000.dtsi.txt (15.8 KB)

I found that with my modified device tree, the Host still can’t detect the device. Now that the 5V power supply has been switched from the board to the HOST, I noticed that it hasn’t made a difference.

bash-5.2# dmesg |grep usb
[    0.882557] usbcore: registered new interface driver usbfs
[    0.888033] usbcore: registered new interface driver hub
[    0.893282] usbcore: registered new device driver usb
[    1.550501] usbcore: registered new interface driver usb-storage
[    3.565363] usbcore: registered new interface driver usbhid
[    3.570804] usbhid: USB HID core driver
[    3.591484] usbcore: registered new interface driver snd-usb-audio
[    4.144869] tegra-xusb-padctl a808680000.padctl: supply avdd-usb not found, using dummy regulator
[    4.152889] tegra-xusb-padctl a808680000.padctl: supply vclamp-usb not found, using dummy regulator
[    4.162486]  usb2-0: usb-role-switch not found for peripheral mode
[    4.168220] tegra-xusb-padctl a808680000.padctl: failed to setup XUSB ports: -22
[    4.175981] tegra-xusb-padctl: probe of a808680000.padctl failed with error -22
[    7.190513] usbcore: registered new interface driver uas
[   18.000288] platform a808670000.usb: deferred probe pending: platform: wait for supplier /bus@0/padctl@a808680000/pads/usb3/lanes/usb3-1
[   18.000330] platform a80aa10000.usb: deferred probe pending: platform: wait for supplier /bus@0/padctl@a808680000/pads/usb3/lanes/usb3-2
bash-5.2#

I haven’t made any other changes. Should I remove the union with 3.0?

It depends on your hardware design. I won’t know if you really add that or not as I told that your schematic is not completed. But it does not matter. If you understand what you are doing there then just add or remove that based on your hardware.

usb-role-switch property is mandatory for OTG/Peripheral modes mentioned in the driver code so you could not remove it.

Hi,WayneWWW

Could you please clarify which part of the schematic is incomplete? I’m not entirely sure what needs to be modified, and whether it involves USB 3.0.We only have this one USB. The schematic includes all the USBs. Do we need to disable the others?

tegra264-p4071-0000.dtsi.txt (15.9 KB)

00000.display
[   18.095828] tegra-mc 8108020000.memory-controller: sync_state() pending due to 8808c00000.display
[   18.104574] tegra186-emc 8108020000.memory-controller:external-memory-controller@8108800000: sync_state() pending due to 0000:01:00.0
[   18.116781] tegra-mc 8108020000.memory-controller: sync_state() pending due to 0000:01:00.0
Connection timeout: device /dev/nvme0n1 is still not ready.
Finding UDC
Finding UDC
Finding UDC
Finding UDC
Finding UDC
No known UDC device found
Failed to run "enable_remote_access"
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-5.2#
bash-5.2#
bash-5.2#
bash-5.2# dmesg |grep usb
[    0.886795] usbcore: registered new interface driver usbfs
[    0.888309] usbcore: registered new interface driver hub
[    0.893552] usbcore: registered new device driver usb
[    1.543072] usbcore: registered new interface driver usb-storage
[    3.618452] usbcore: registered new interface driver usbhid
[    3.623848] usbhid: USB HID core driver
[    3.644961] usbcore: registered new interface driver snd-usb-audio
[    4.205234] tegra-xusb-padctl a808680000.padctl: supply avdd-usb not found, using dummy regulator
[    4.213112] tegra-xusb-padctl a808680000.padctl: supply vclamp-usb not found, using dummy regulator
[    4.222390]  usb2-0: usb-role-switch not found for peripheral mode
[    4.228172] tegra-xusb-padctl a808680000.padctl: failed to setup XUSB ports: -22
[    4.235905] tegra-xusb-padctl: probe of a808680000.padctl failed with error -22
[    7.248371] usbcore: registered new interface driver uas
[   17.999590] platform a808670000.usb: deferred probe pending: platform: wait for supplier /bus@0/padctl@a808680000/pads/usb3/lanes/usb3-1

不確定我用中文說明會不會比較清楚一點

  1. 你不知道自己到底有沒有加進USB3的功能這件事其實沒什麼道理. 這板子是你們做的, 這件事情你不清楚的話你去問負責設計板子的人他也會知道.
    線路圖不清楚的意思是你們只給了connector端的部份.
    Thor端你們只給了部份, 你給的部份只畫了一個USB0_N/P. 但你的connector部份有接一個USB3什麼的, 但這個USB3接去Thor的哪一個部份你們沒給出來

  2. 前面已經講了, 如果你要用Peripheral, 那usb-role-switch 不能拿掉.


  1. You don’t know if you have added USB3 functions, which is actually unreasonable. You are the one who made this board, if you don’t know about it, you can ask the person in charge of designing the board, and he will know.
    The unclear schematic means that you only gave the connector part.
    For Thor part, you only gave the partial info, and the part you gave only have the USB0_N/P. But your connector part has a connection to a USB3 or something, but you haven’t given which part of this USB3 is connected to on Thor SOM.

  2. As mentioned earlier, if you want to use Peripheral, then the usb-role-switch cannot be removed.

Hi,WayneWWW

Okay, this is the more complete part. USB 3.0 is connected to UPHY lane 1. Please help take a look.

tegra264-p4071-0000+p3834-0008-nv.dtb.txt (245.5 KB)

Ok then that is usb3-1. The setting looks good.

Hi,WayneWWW

I think the USB can be ejected now, but there are still some errors. Could you help take a look? I’m not sure if this error is critical.

[ 7.147506] tegra-xusb-padctl a808680000.padctl: 00000288 poll timeout > 0451e3ce
[ 7.154295] tegra-xusb-padctl a808680000.padctl: failed to poll USB2 trk completed: -110

However, there is still an issues here. Maybe it related to nvme、uphy0 config.

[   19.922601] bcdVersion must be 0x0100, stored in Little Endian order. Userspace driver should be fixed, accepting 0x0001 for compatibility.
to get adbd socket: No such file or directory
adbd64 I 01-01 00:00:19   491   493 usb.cpp:264] initializing functionfs
adbd64 I 01-01 00:00:19   491   493 usb.cpp:285] opening control endpoint /dev/usb-ffs/adb/ep0
libc: Using old property service protocol ("ro.property_service.version" is not set)
adbd64 I 01-01 00:00:19   491   493 usb.cpp:370] functionfs successfully initialized
adbd64 I 01-01 00:00:19   491   493 usb.cpp:377] registering usb transport
[   20.919979] tegra-xudc a808670000.usb: EP 0 (type: ctrl, dir: out) enabled
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-5.2#
bash-5.2#
bash-5.2# [   50.523966] tegra-xudc a808670000.usb: EP 2 (type: bulk, dir: out) enabled
[   50.524012] tegra-xudc a808670000.usb: EP 3 (type: bulk, dir: in) enabled
[   66.309780] tegra-xudc a808670000.usb: ep 2 disabled
[   66.309825] tegra-xudc a808670000.usb: ep 3 disabled
adbd64 E 01-01 00:01:05   491   495 usb.cpp:471] aio: got error event on read total bufs 1: Cannot send after transport endpoint shutdown
adbd64 E 01-01 00:01:05   491   495 transport_usb.cpp:125] remote usb: read terminated (message): Cannot send after transport endpoint shutdown
[   66.774424] tegra-xudc a808670000.usb: EP 2 (type: bulk, dir: out) enabled
[   66.774476] tegra-xudc a808670000.usb: EP 3 (type: bulk, dir: in) enabled
adbd64 I 01-01 00:01:06   491   491 usb.cpp:511] closing functionfs transport
adbd64 I 01-01 00:01:06   491   493 usb.cpp:264] initializing functionfs
adbd64 I 01-01 00:01:06   491   493 usb.cpp:370] functionfs successfully initialized
adbd64 I 01-01 00:01:06   491   493 usb.cpp:377] registering usb transport

bash-5.2#
bash-5.2# dmesg |grep usb
[    0.886450] usbcore: registered new interface driver usbfs
[    0.888327] usbcore: registered new interface driver hub
[    0.893570] usbcore: registered new device driver usb
[    1.549505] usbcore: registered new interface driver usb-storage
[    3.522871] usbcore: registered new interface driver usbhid
[    3.528316] usbhid: USB HID core driver
[    3.548929] usbcore: registered new interface driver snd-usb-audio
[    4.103850] tegra-xusb-padctl a808680000.padctl: supply avdd-usb not found, using dummy regulator
[    4.111596] tegra-xusb-padctl a808680000.padctl: supply vclamp-usb not found, using dummy regulator
[    4.121157] (null) usb2-0: supply vbus not found, using dummy regulator
[    7.139302] tegra-xudc a808670000.usb: Adding to iommu group 10
[    7.147506] tegra-xusb-padctl a808680000.padctl: 00000288 poll timeout > 0451e3ce
[    7.154295] tegra-xusb-padctl a808680000.padctl: failed to poll USB2 trk completed: -110
[    7.162974] usbcore: registered new interface driver uas
[   20.919979] tegra-xudc a808670000.usb: EP 0 (type: ctrl, dir: out) enabled
[   50.523966] tegra-xudc a808670000.usb: EP 2 (type: bulk, dir: out) enabled
[   50.524012] tegra-xudc a808670000.usb: EP 3 (type: bulk, dir: in) enabled
[   66.309780] tegra-xudc a808670000.usb: ep 2 disabled
[   66.309825] tegra-xudc a808670000.usb: ep 3 disabled
[   66.774424] tegra-xudc a808670000.usb: EP 2 (type: bulk, dir: out) enabled
[   66.774476] tegra-xudc a808670000.usb: EP 3 (type: bulk, dir: in) enabled
bash-5.2#

[flash_bsp_jetson-t264_die0]: [FlashUsingADB(1112)] : [nvme0n1] Flashing for Partition master_boot_record
[flash_bsp_jetson-t264_die0]: [SendFileUsingADB(667)] : Flashing Partition - master_boot_record of size 512 of File mbr_9_0.bin of size 512
[flash_bsp_jetson-t264_die0]: [AdbPush(334)] : Push file via ADB to target destination
[flash_bsp_jetson-t264_die0]: [executeShellCommand(156)] : command = /home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/flash/adb -s 2U1TS830G00000CG2040 push mbr_9_0.bin  /tmp
cwd = /home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/flash_workspace/flash-images
[flash_bsp_jetson-t264_die0]: [executeShellCommand(163)] : [100%] /tmp/mbr_9_0.bin
mbr_9_0.bin: 1 file pushed. 0.1 MB/s (512 bytes in 0.004s)

[flash_bsp_jetson-t264_die0]: [executeShellCommand(156)] : command = /home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/flash/adb -s 2U1TS830G00000CG2040 shell /tmp/wr_sh.sh /tmp/nvdd --inputbin=/tmp/mbr_9_0.bin --device=/dev/nvme0n1 --startoffset=0 --partsize=512 --l4t
cwd = /home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/flash_workspace/flash-images
[flash_bsp_jetson-t264_die0]: [executeShellCommand(163)] : nvdd: /dev/nvme0n1 not found, looking by controller instance...
:[E]: IsControllerInstance               :   31: Error DeviceNotFound (0x18)
:[E]: NvParseDeviceByControllerInstance  :   80: Error DeviceNotFound (0x18)
:[E]: NvddGetDeviceInfo                  :   28: Error DeviceNotFound (0x18)
:[E]: nvdd                               :  460: Error DeviceNotFound (0x18)

EXITCODE=24

[flash_bsp_jetson-t264_die0]: [AdbShell(325)] : EXITCODE = 24
Process Process-1:2:
Traceback (most recent call last):
  File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/bootburn/../bootburn_t264_py/bootburn_adb.py", line 1251, in FlashUsingADB
    result = self.SendFileUsingADB(partitionInfo, SkipWriteZeroChunk, TempDir, queue, UpdatePartitions)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/bootburn/../bootburn_t264_py/bootburn_adb.py", line 715, in SendFileUsingADB
    AbnormalTermination("Write failed on (%s)" % str(partitionInfo.LinuxPartitionName), nverror.NvError_FileWriteFailed)
  File "/home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/bootburn/../bootburn_t264_py/flashtools_nverror.py", line 260, in AbnormalTermination
    raise OSError(errorCode)
OSError: 59
command line used was:
['/home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/tools/flashtools/bootburn/flash_bsp_images.py', '-b', 'jetson-t264', '--l4t', '-D', '-P', '/home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/flash_workspace', '--usb-instance', '2-1']


Write failed on (/dev/nvme0n1)

[flash_bsp_jetson-t264_die0]: [executeShellCommand(163)] : nvdd: /dev/block/810c5b0000.spi not found, looking by controller instance...
nvdd: Using [/dev/mtd0]

EXITCODE=0

[flash_bsp_jetson-t264_die0]: [AdbShell(325)] : EXITCODE = 0
[flash_bsp_jetson-t264_die0]: [EraseQspi(1374)] : Erase Qspi took 158.5438587665558
[flash_bsp_jetson-t264_die0]: [FlashUsingADB(1112)] : [810c5b0000.spi] Flashing for Partition bct
[flash_bsp_jetson-t264_die0]: [FlashUsingADB(1149)] : Remove previous instances of BCT
[flash_bsp_jetson-t264_die0]: [FlashUsingADB(1151)] : Copy partition BCT to destination
[flash_bsp_jetson-t264_die0]: [FlashUsingADB(1162)] : Make BCT size equal to 256KB by padding zeros at the end
[flash_bsp_jetson-t264_die0]: [executeShellCommand(156)] : command = dd if=/dev/zero of=die0_bctCopiesBlob.tmp seek=8192 count=253952 bs=1
cwd = /home/wpces/Downloads/Linux_for_Tegra/unified_flash/out/bsp_images/flash_workspace/flash-images
[flash_bsp_jetson-t264_die0]: [executeShellCommand(163)] : 253952+0 records in
253952+0 records out
253952 bytes (254 kB, 248 KiB) copied, 0.113414 s, 2.2 MB/s



bash-5.2#
bash-5.2# fdisk -l
Disk /dev/mtdblock0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
bash-5.2#


[    3.760235] pci 0000:01:00.0: Max Payload Size set to 256 (was 128, max 256)
[    3.767379] pci 0000:01:00.0: VF BAR 0 [mem 0x00000000-0x0007ffff 64bit pref]
[    3.774519] pci 0000:01:00.0: VF BAR 0 [mem 0x00000000-0x01f7ffff 64bit pref]: contains BAR 0 for 63 VFs
[    3.784302] pci 0000:01:00.0: 0.000 Gb/s available PCIe bandwidth, limited by Unknown x0 link at 0000:00:00.0 (capable of 32.000 Gb/s with 2.5 GT/s PCIe x16 link)
[    3.798920] pci 0000:00:00.0: bridge window [mem 0x01000000-0x01ffffff 64bit pref] to [bus 01-ff] add_size 2000000 add_align 1000000

we are use uphy0 configure6,i have remove the

-UPHY_CONFIG=“tegra264-mb1-bct-uphy-lanes-p4071-0000.dts”;
+UPHY_CONFIG=“”

but it still can not link up

I think we could just focus on one issue (usb device) for one topic.

As USB device mode is fine now, please file a new topic to focus on NVMe.

1 Like

Hi,WayneWWW

thank you very much . i have commit a new topic .

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.