nxp-imx / mfgtools

Freescale/NXP I.MX Chip image deploy tools.
BSD 3-Clause "New" or "Revised" License
562 stars 301 forks source link

LIBUSB_ERROR_TIMEOUT in WSL #428

Open KCHBloem opened 5 months ago

KCHBloem commented 5 months ago

I'm experiencing a USB timeout issue when I attempt to flash an IMX6 in WSL. Flashing the device works fine in a ubuntu 22.04 virtual machine. The same script and same files don't work in WSL. After about 15 seconds on the "SDPV: write" command it times out. The device is accessible by WSL according to lsusb and dmesg. The reason I want to use WSL is because I'm also compiling the files and that goes much faster on the WSL.

~/mfgtools/uuu$ sudo ./uuu ../../workspace/bsom.auto

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.182-0-gda3cd53

Success 0    Failure 1

1:1-         2/ 3 [HID(W): LIBUSB_ERROR_TIMEOUT (-7)     ] SDPV: write -f build/tmpglibc/deploy/images/bsom/u-boot.imx -

wsl --version

WSL-version: 2.2.4.0
Kernelversion: 5.15.153.1-2
WSLg-version: 1.0.61
MSRDC-version: 1.2.5326
Direct3D-version: 1.611.1-81528511
DXCore-version: 10.0.26091.1-240325-1447.ge-release
Windows-version: 10.0.22631.3672

uuu version

uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.182-0-gda3cd53

bsom.auto file

uuu_version 1.5.182

SDP: boot -f build/tmpglibc/deploy/images/bsom/SPL

# SDP in SPL
SDPV: delay 3000
SDPV: write -f build/tmpglibc/deploy/images/bsom/u-boot.imx -ivt 0
SDPV: jump -addr 0x877FF400

FB: ucmd echo ----------------------------------------------------------------------
FB: ucmd echo Setting Environment Variables
FB: ucmd echo ----------------------------------------------------------------------

#For some reason these don't save very well? So execute them manually if it doesn't work
FB: ucmd setenv fastboot_buffer 0x82000000
FB: ucmd setenv ubipart rootfs
FB: ucmd setenv image zImage
FB: ucmd setenv fdt_file bsom.dtb

FB: ucmd setenv ubifsboot 'run setup; setenv bootargs ubi.mtd=rootfs root=ubi0:rootfs rw rootfstype=ubifs console=ttymxc0,115200;echo Booting from ubifs...; ubi part ${ubipart} && ubifsmount ${ubidev}:${ubipart} && ubifsload ${loadaddr} /boot/${image} && ubifsload ${fdt_addr} /boot/${fdt_file} && bootz ${loadaddr} - ${fdt_addr}'
FB: ucmd saveenv

FB: ucmd printenv

FB: ucmd echo ----------------------------------------------------------------------
FB: ucmd echo Erase Chip and Ubi Partition
FB: ucmd echo ----------------------------------------------------------------------

FB: download -f build/tmpglibc/deploy/images/bsom/SPL
FB: ucmd nandbcb init ${fastboot_buffer} 0 ${filesize}

FB: download -f build/tmpglibc/deploy/images/bsom/u-boot.img
FB: ucmd nand erase.part u-boot;
FB: ucmd nand write ${fastboot_buffer} u-boot ${filesize}

FB: ucmd nand erase.part u-boot-backup;
FB: ucmd nand write ${fastboot_buffer} u-boot-backup ${filesize}

FB: download -f build/tmpglibc/deploy/images/bsom/core-image-minimal-bsom.ubi
FB: ucmd nand erase.part ${ubipart}
FB[-t 60000]: ucmd nand write.trimffs ${fastboot_buffer} ${ubipart} ${filesize}

FB: ucmd echo ----------------------------------------------------------------------
FB: ucmd echo Write Ubi Partition to chip
FB: ucmd echo ----------------------------------------------------------------------

FB: ucmd mtdparts
FB: ucmd ubi part ${ubipart} 
FB: ucmd ubifsmount ubi0:rootfs

FB: ucmd echo ----------------------------------------------------------------------
FB: ucmd echo Load zImage and Device Tree, Start Kernel
FB: ucmd echo ----------------------------------------------------------------------

FB: ucmd ubifsload ${loadaddr} /boot/${image}  
FB: ucmd ubifsload ${fdt_addr} /boot/${fdt_file}

#FB: ucmd fuse prog 0 5 91  #Sets 0x91 into BOOT_CFG1 (first 8 bit of 0x450)

#FB: ucmd fuse prog 0 6 10  #Sets 1 into BT_FUSE_SEL

#FB: ucmd run ubifsboot
FB: ucmd echo Successfully booted kernel

Dmesg --follow output

[ 3837.008289] vhci_hcd: unlink->seqnum 224
[ 3837.008301] vhci_hcd: urb->status -104
[ 3847.009823] vhci_hcd: unlink->seqnum 226
[ 3847.009827] vhci_hcd: urb->status -104
nxpfrankli commented 5 months ago

Look like hang in SPL when write uboot image. May address overlap or ddr issue.

KCHBloem commented 5 months ago

If that is the case how come it does work in a virtual machine?

edit: Accidentally closed the issue, reopened.