This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3358: USB flash drive error

Part Number: AM3358

Tool/software: Linux

Hello Everyone,

We have purchased a Beagle-bone Black board for development purpose to prepare our custom product based on AM3358 processor. During the development we are facing issue in Firmware flashing using USB Flash Drive on Beagle-bone Black. While flashing new Firmware using USB Flash drive showing below error.

Running uenvcmd ...
resetting USB...
USB0:   Port not available.
** Bad device usb 0 **
reading logo.bin
90672 bytes read in 13 ms (6.7 MiB/s)
reading zImage
8197016 bytes read in 464 ms (16.8 MiB/s)
reading am335x-boneblack.dtb
63897 bytes read in 10 ms (6.1 MiB/s)
Kernel image @ 0x80100000 [ 0x000000 - 0x7d1398 ]
## Flattened Device Tree blob at 81000000
   Booting using the fdt blob at 0x81000000
   Loading Device Tree to 8ffed000, end 8ffff998 ... OK

Note:  We have one pen-drive (with full details as below) is working fine for Flashing Firmware but other USB Flash Drive does not work with the same board.

[ +0.000007] usb 1-2: Product: STEC USB 2.0
[ +0.000005] usb 1-2: Manufacturer: STEC
[ +0.000006] usb 1-2: SerialNumber: 86AA0E00E88B08C9

Thanks & Best Regards;

Nikunj Patel

  • Nikunj,

    What uboot do you use? Is it the original one shipped in the BBB board? Or the one in the latest TI Processor SDK?
    Please share your 'uenvcmd' uboot variable.
  • Hello Bin Liu,
    Thanks for your quick reply.

    Please check the below details of uboot command

    1) u-boot> version

    U-Boot 2015.10 (Apr 03 2018 - 09:01:33 +0800)
    arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2017.01) 4.9.4
    GNU ld (Linaro_Binutils-2017.01) 2.24.0.20141017 Linaro 2014_11-3-git

    2) u-boot> env print uenvcmd

    ## Error: "uenvcmd" not defined

  • Nikunj,

    The uboot version doesn't help me understand what uboot you use. Is it the original one shipped in the BBB board? Or you flashed using the latest TI Processor SDK uboot?

    If you boot the BBB board into Linux kernel, does the failure flash drive get enumerated by the kernel?
  • Hello Bin Liu,
    Thanks for your quick reply.

    We have some modification in u-boot source which was original shipped in BBB but does not any change regarding the USB Section.


    Thanks & Best Regards;
    Nikunj Patel
  • If you boot the BBB board into Linux kernel, does the failure flash drive get enumerated by the kernel?
  • Hello Bin Liu,
    Thanks for your quick reply.

    Linux kernel enumerates the flash drive but not detected during the u-boot so not able to update the New Firmware through USB drive, as u-boot is not able to understand the device..

    Best Regards,
    Nikunj Patel
  • Nikunj,

    Earlier you mentioned you didn't set uenvcmd parameter in uboot, please explain how you use USB drive for updating firmware, for example, what uboot commands you use to use USB drive.
  • Hello Bin Liu,
    Thanks for your quick reply.

    We used below command in u-boot.

    search_dir=firmware 
    usbboot=setenv bootargs 'mem=511M console=ttyO0,115200 root=/dev/ram'; 
    usb reset; 
    if fatload usb 0 88080000 ${search_dir}/ramdisk.img; then fatload usb 0 80100000 ${search_dir}/zImage; fatload usb 0 81000000 ${search_dir}/am335x-boneblack.dtb; bootz 80100000 88080000 81000000; fi 
    setbootargswithflag=setenv bootargs mem=511M bootlogo=9FF00000 fbcon=rotate:1 console=ttyS0,115200 root=${mmcroot} rootfstype=ext4 
    rw rootwait 
    uenvcmd=run usbboot; run setbootargswithflag; fatload mmc 1 80100000 zImage; fatload mmc 1 81000000 am335x-boneblack.dtb; bootz 80100000 - 81000000

    Best Regards;
    Nikunj Patel

  • Hello Bin Liu,

    Any update.....

    Thanks & Best Regards;
    Nikunj Patel
  • Nikunj,

    Sorry for the delayed response. I was out of the office and just got back.
    I will try if I can reproduce it and will post if have any progress.

  • Hello Bin Liu,

    Any update.....

    Thanks & Best Regards;
    Nikunj Patel
  • Nikunj,

    The error you reported ("** Bad device usb 0 **") could be printed while running "usb reset" command, but I don't see the problem with all thumb drives I have.

    Can you please confirm you will see the error by only run "usb reset" command instead of your whole flash uboot command script?
  • Hi, I haven’t heard back from you, I’m assuming you were able to resolve your issue. If not, just post a reply below (or create a new thread if the thread has locked due to time-out). thanks.
  • Sorry for late reply;


    Actually we have tested below USB drives with board using the USB Analyzer in details but the behavior of those drives are random means some time pen-drives get detected and some time pen-drives did not detect.
    so still we are facing issue.. as per our understanding there was something issue regrading the timing of USB start or detecting. but we don't know about the software part for that.

    Can you please guide for the software timing for USB section so we can change[increase] and test again.

    List of USB Drives:

    • Altera(1GB)
    • Sandisk Cruzer (8GB)
    • Sandisk Cruzer Blade(4GB)
    • Sandisk Cruzer Micro(1GB)
    • STEC(1GB)


    Thanks & Best Regards;
    Nikunj Patel

  • Nikunj,

    It is hard to tell what timing to adjust without knowing the root cause.
    But please try to add the following option in your uboot booargs parameter.

    usb_pgood_delay=200
  • Hi Nikunj,

    I haven’t heard back from you. have you tested with "usb_pgood_delay" uboot parameter and if it solves the issue?

    If "usb_pgood_delay" parameter doesn't change the behavior, please update your board with Uboot in the Processor SDK. I don't know what Uboot is shipped originally. The forums only supports TI Processor SDKs, but not other community software.

  • Thank you Bin Liu...

    Actually we have reduced "usb_pgood_delay" and try but it does not work.

    We have configured the "USB1_DRVVBUS" pin as gpio and make it high during the bootup before the USB Core initialize then USB Drive gets detected successfully in u-boot .