Can not flash.sh anything when the usb hub which connect to PEX_RFU(USB3_1) working.

After I modified the DTS to enable USB3_1 and ODMDATA bit 1 set to 1 and flash the image.
The USB hub connect to PEX_RFU can work.
But when I try flash DTB or kernel or whole image again will stack at “CPU Bootloader is not running on device.”

If I disconnect USB hub power suppy to disable the hub then can flash successfully.

These are the fail log.

nvidia@nvidia-X299-UD4:~/jetpack/jetpack_download/Linux_for_Tegra$ sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1
./tegraflash.py --chip 0x18 --applet "/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin" --cmd "dump eeprom boardinfo cvm.bin" --skipuid 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0018 ] Generating RCM messages
[   0.0041 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 --download rcm /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin 0 0
[   0.0057 ] RCM 0 is saved as rcm_0.rcm
[   0.0061 ] RCM 1 is saved as rcm_1.rcm
[   0.0061 ] List of rcm files are saved in rcm_list.xml
[   0.0061 ] 
[   0.0062 ] Signing RCM messages
[   0.0099 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0116 ] Assuming zero filled SBK key
[   0.0179 ] 
[   0.0180 ] Copying signature to RCM mesages
[   0.0195 ] tegrarcm_v2 --chip 0x18 --updatesig rcm_list_signed.xml
[   0.0217 ] 
[   0.0218 ] Boot Rom communication
[   0.0239 ] tegrarcm_v2 --chip 0x18 --rcm rcm_list_signed.xml --skipuid
[   0.0255 ] RCM version 0X180001
[   0.0270 ] Boot Rom communication completed
[   1.0338 ] 
[   1.0359 ] tegrarcm_v2 --isapplet
[   1.0377 ] Applet version 01.00.0000
[   1.0502 ] 
[   1.0522 ] Retrieving EEPROM data
[   1.0524 ] tegrarcm_v2 --oem platformdetails eeprom cvm /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/cvm.bin
[   1.0541 ] Applet version 01.00.0000
[   1.0786 ] Saved platform info in /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/cvm.bin
[   1.1565 ] 
Board ID(3310) version(B02) 
odmdata 0x7090000
PMIC_CONFIG  tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg
copying bctfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg)... done.
copying misc_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-misc-si-l4t.cfg)... done.
copying pinmux_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)... done.
copying pmic_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg)... done.
copying pmc_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg)... done.
copying prod_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg)... done.
copying scr_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/minimal_scr.cfg)... done.
copying scr_cold_boot_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/mobile_scr.cfg)... done.
copying bootrom_config(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg)... done.
copying dev_params(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/BCT/emmc.cfg)... done.
Existing bootloader(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating extlinux.conf.emmc to rootfs... done.
	populating /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb to rootfs... done.
done.
Making Boot image... done.
Existing sosfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin) reused.
copying tegraboot(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/nvtboot.bin)... done.
Existing mb2blfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
Existing mtspreboot(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/preboot_d15_prod_cr.bin) reused.
Existing mts(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/mce_mts_d15_prod_cr.bin) reused.
Existing mb1file(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/mb1_prod.bin) reused.
Existing bpffile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/bpmp.bin) reused.
copying bpfdtbfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb)... done.
Existing scefile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/camera-rtcpu-sce.bin) reused.
Existing spefile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/spe.bin) reused.
copying wb0boot(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/warmboot.bin)... done.
Existing tosfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/tos.img) reused.
Existing eksfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)... done.
Reusing existing system.img... 
done.
Existing tbcfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/cboot.bin) reused.
copying tbcdtbfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)... done.
copying cfgfile(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/t186ref/cfg/flash_l4t_t186.xml) to flash.xml... done.
Existing flasher(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/nvtboot_recovery_cpu.bin) reused.
Existing flashapp(/home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating :kernel with boot.img ***
./flash.sh: line 1617: [: -eq: unary operator expected
./tegraflash.py  --bl nvtboot_recovery_cpu.bin   --chip 0x18 --applet mb1_recovery_prod.bin --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --misc_config tegra186-mb1-bct-misc-si-l4t.cfg --pinmux_config tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg --pmic_config tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg --pmc_config tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg --prod_config tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg --scr_config minimal_scr.cfg --scr_cold_boot_config mobile_scr.cfg --br_cmd_config tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg --dev_params emmc.cfg  --cfg  flash.xml --bins "mb2_bootloader nvtboot_recovery.bin; mts_preboot preboot_d15_prod_cr.bin; mts_bootpack mce_mts_d15_prod_cr.bin; bpmp_fw bpmp.bin; bpmp_fw_dtb tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb; tlk tos.img; eks eks.img; bootloader_dtb tegra186-quill-p3310-1000-c03-00-base.dtb"  --cmd "write kernel-dtb tegra186-quill-p3310-1000-c03-00-base.dtb; write kernel boot.img;"  
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0061 ] Generating RCM messages
[   0.0074 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 --download rcm mb1_recovery_prod.bin 0 0
[   0.0089 ] RCM 0 is saved as rcm_0.rcm
[   0.0092 ] RCM 1 is saved as rcm_1.rcm
[   0.0093 ] List of rcm files are saved in rcm_list.xml
[   0.0094 ] 
[   0.0094 ] Signing RCM messages
[   0.0141 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0155 ] Assuming zero filled SBK key
[   0.0216 ] 
[   0.0219 ] Copying signature to RCM mesages
[   0.0231 ] tegrarcm_v2 --chip 0x18 --updatesig rcm_list_signed.xml
[   0.0247 ] 
[   0.0248 ] Boot Rom communication
[   0.0261 ] tegrarcm_v2 --chip 0x18 --rcm rcm_list_signed.xml
[   0.0274 ] BootRom is not running
[   1.0263 ] 
[   1.0283 ] tegrarcm_v2 --isapplet
[   1.0301 ] Applet version 01.00.0000
[   1.0449 ] 
[   1.0469 ] tegrasign_v2 --key None --getmode mode.txt
[   1.0486 ] Assuming zero filled SBK key
[   1.0488 ] 
[   1.0488 ] Parsing partition layout
[   1.0508 ] tegraparser_v2 --pt flash.xml.tmp
[   1.0530 ] 
[   1.0531 ] Creating list of images to be signed
[   1.0551 ] tegrahost_v2 --chip 0x18 --partitionlayout flash.xml.bin --list images_list.xml zerosbk
[   1.0683 ] 
[   1.0684 ] Generating signatures
[   1.0704 ] tegrasign_v2 --key None --list images_list.xml --pubkeyhash pub_key.key
[   1.0720 ] Assuming zero filled SBK key
[   1.1597 ] 
[   1.1598 ] Reading BCT from device for further operations
[   1.1599 ] Generating blob
[   1.1615 ] tegrahost_v2 --align blob_nvtboot_recovery_cpu.bin
[   1.1632 ] 
[   1.1645 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery_cpu.bin zerosbk
[   1.1660 ] 
[   1.1675 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_cpu_sigheader.bin_list.xml
[   1.1687 ] Assuming zero filled SBK key
[   1.1724 ] 
[   1.1745 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_cpu_sigheader.bin.encrypt blob_nvtboot_recovery_cpu_sigheader.bin.hash zerosbk
[   1.1762 ] 
[   1.1779 ] tegrahost_v2 --align blob_nvtboot_recovery.bin
[   1.1792 ] 
[   1.1805 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery.bin zerosbk
[   1.1823 ] 
[   1.1838 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_sigheader.bin_list.xml
[   1.1851 ] Assuming zero filled SBK key
[   1.1892 ] 
[   1.1910 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_sigheader.bin.encrypt blob_nvtboot_recovery_sigheader.bin.hash zerosbk
[   1.1926 ] 
[   1.1945 ] tegrahost_v2 --align blob_preboot_d15_prod_cr.bin
[   1.1960 ] 
[   1.1975 ] tegrahost_v2 --appendsigheader blob_preboot_d15_prod_cr.bin zerosbk
[   1.1993 ] 
[   1.2010 ] tegrasign_v2 --key None --list blob_preboot_d15_prod_cr_sigheader.bin_list.xml
[   1.2024 ] Assuming zero filled SBK key
[   1.2055 ] 
[   1.2074 ] tegrahost_v2 --updatesigheader blob_preboot_d15_prod_cr_sigheader.bin.encrypt blob_preboot_d15_prod_cr_sigheader.bin.hash zerosbk
[   1.2090 ] 
[   1.2107 ] tegrahost_v2 --align blob_mce_mts_d15_prod_cr.bin
[   1.2122 ] 
[   1.2136 ] tegrahost_v2 --appendsigheader blob_mce_mts_d15_prod_cr.bin zerosbk
[   1.2201 ] 
[   1.2221 ] tegrasign_v2 --key None --list blob_mce_mts_d15_prod_cr_sigheader.bin_list.xml
[   1.2235 ] Assuming zero filled SBK key
[   1.2745 ] 
[   1.2765 ] tegrahost_v2 --updatesigheader blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt blob_mce_mts_d15_prod_cr_sigheader.bin.hash zerosbk
[   1.2818 ] 
[   1.2834 ] tegrahost_v2 --align blob_bpmp.bin
[   1.2848 ] 
[   1.2863 ] tegrahost_v2 --appendsigheader blob_bpmp.bin zerosbk
[   1.2889 ] 
[   1.2906 ] tegrasign_v2 --key None --list blob_bpmp_sigheader.bin_list.xml
[   1.2919 ] Assuming zero filled SBK key
[   1.3148 ] 
[   1.3162 ] tegrahost_v2 --updatesigheader blob_bpmp_sigheader.bin.encrypt blob_bpmp_sigheader.bin.hash zerosbk
[   1.3189 ] 
[   1.3200 ] tegrahost_v2 --align blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb
[   1.3211 ] 
[   1.3221 ] tegrahost_v2 --appendsigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb zerosbk
[   1.3239 ] 
[   1.3251 ] tegrasign_v2 --key None --list blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb_list.xml
[   1.3262 ] Assuming zero filled SBK key
[   1.3463 ] 
[   1.3484 ] tegrahost_v2 --updatesigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.hash zerosbk
[   1.3510 ] 
[   1.3526 ] tegrahost_v2 --align blob_tos.img
[   1.3541 ] 
[   1.3556 ] tegrahost_v2 --appendsigheader blob_tos.img zerosbk
[   1.3572 ] 
[   1.3591 ] tegrasign_v2 --key None --list blob_tos_sigheader.img_list.xml
[   1.3603 ] Assuming zero filled SBK key
[   1.3633 ] 
[   1.3654 ] tegrahost_v2 --updatesigheader blob_tos_sigheader.img.encrypt blob_tos_sigheader.img.hash zerosbk
[   1.3674 ] 
[   1.3690 ] tegrahost_v2 --align blob_eks.img
[   1.3711 ] 
[   1.3725 ] tegrahost_v2 --appendsigheader blob_eks.img zerosbk
[   1.3742 ] 
[   1.3759 ] tegrasign_v2 --key None --list blob_eks_sigheader.img_list.xml
[   1.3773 ] Assuming zero filled SBK key
[   1.3775 ] 
[   1.3797 ] tegrahost_v2 --updatesigheader blob_eks_sigheader.img.encrypt blob_eks_sigheader.img.hash zerosbk
[   1.3813 ] 
[   1.3831 ] tegrahost_v2 --align blob_tegra186-quill-p3310-1000-c03-00-base.dtb
[   1.3846 ] 
[   1.3862 ] tegrahost_v2 --appendsigheader blob_tegra186-quill-p3310-1000-c03-00-base.dtb zerosbk
[   1.3884 ] 
[   1.3903 ] tegrasign_v2 --key None --list blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb_list.xml
[   1.3918 ] Assuming zero filled SBK key
[   1.4055 ] 
[   1.4076 ] tegrahost_v2 --updatesigheader blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.hash zerosbk
[   1.4103 ] 
[   1.4122 ] tegrahost_v2 --generateblob blob.xml blob.bin
[   1.4138 ] number of images in blob are 9
[   1.4143 ] blobsize is 3736856
[   1.4144 ] Added binary blob_nvtboot_recovery_cpu_sigheader.bin.encrypt of size 184576
[   1.4167 ] Added binary blob_nvtboot_recovery_sigheader.bin.encrypt of size 78080
[   1.4172 ] Added binary blob_preboot_d15_prod_cr_sigheader.bin.encrypt of size 61472
[   1.4179 ] Added binary blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt of size 2077088
[   1.4189 ] Added binary blob_bpmp_sigheader.bin.encrypt of size 528800
[   1.4195 ] Added binary blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt of size 466160
[   1.4203 ] Added binary blob_tos_sigheader.img.encrypt of size 58880
[   1.4207 ] Added binary blob_eks_sigheader.img.encrypt of size 1488
[   1.4211 ] Added binary blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt of size 280160
[   1.4234 ] 
[   1.4235 ] Sending bootloader and pre-requisite binaries
[   1.4250 ] tegrarcm_v2 --download blob blob.bin
[   1.4267 ] Applet version 01.00.0000
[   1.4406 ] Sending blob
[   1.4407 ] [................................................] 100%
[   2.2506 ] 
[   2.2527 ] tegrarcm_v2 --boot recovery
[   2.2545 ] Applet version 01.00.0000
[   2.2699 ] 
[   2.2723 ] tegrarcm_v2 --isapplet
[   2.8998 ] 
[   2.9018 ] tegradevflash_v2 --iscpubl
[   2.9035 ] CPU Bootloader is not running on device.
[   2.9041 ] 
[  33.4997 ] Writing partition
[  33.5016 ] tegradevflash_v2 --write kernel-dtb /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/tegra186-quill-p3310-1000-c03-00-base.dtb
[  33.5033 ] Cannot Open USB
[  33.5037 ] 
Error: Return value 8
Command tegradevflash_v2 --write kernel-dtb /home/nvidia/jetpack/jetpack_download/Linux_for_Tegra/bootloader/tegra186-quill-p3310-1000-c03-00-base.dtb
Failed to flash/read t186ref.

Very few USB HUBs disable when power is removed for an externally powered HUB. Most (perhaps all?) switch to drawing power from the host port instead. It is conceivable that switching from external power to internal power could trigger re-enumeration (essentially a hot-plug event).

This sounds like a failure of the HUB, although if you use a VM USB usually fails even when hardware is valid. I do not know about your modifications, the above assumes these do not affect recovery mode flashing.

Hi Vin.zhang,

Did you ever get this issue resolved? We are experiencing the same problem with flash.sh after moving our TUSB8041 4-port USB hub chip to the PEX_RFU lines. I have an open thread about it here:

https://devtalk.nvidia.com/default/topic/1064450/jetson-tx2/deploying-with-l4t-flash-sh-breaks-on-my-carrier-board/post/5403077/#5403077