USB memory stick recognition for UBoot

Our customer inquired about a USB that could not be recognized by UBoot.
The USB can be successfully recognized by Linux and Windows, but cannot be read by UBoot.

Linux
root@colibri-imx6ull-06396566:~# lsusb
Bus 002 Device 004: ID 058f:6387 Alcor Micro Corp. flash drivers

UBoot

Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1…
starting USB…
Bus usb@2184000: USB EHCI 1.00
Bus usb@2184200: USB EHCI 1.00
scanning bus usb@2184000 for devices… 1 USB Device(s) found
scanning bus usb@2184200 for devices… 3 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found

Device 0: unknown device
ethernet@20b4000 Waiting for PHY auto negotiation to complete… TIMEOUT !
Could not initialize PHY ethernet@20b4000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4

What is the cause of this problem?

Best regards.

What is the formatting / filesystem on the USB stick?
And maybe size ?

Could you check your USB drive declared power consumption in device descriptor? Use usbview on Windows or lsusb -v on Linux. Some cheap drives may state they need 500mA, which won’t agree with bus powered hub, which needs as well few mA. Though I saw some odd device with built in hub in the past, which worked with all bus powered 500mA devices and didn’t work with less power hungry devices, no matter Linux or Windows.

NTFS formatted drives still are detected in U-Boot and shown in count of Storage Device(s).

I got usb information with lsusb -v from the customer.
Please check.

root@colibri-imx6ull-06902769:~# lsusb
Bus 001 Device 003: ID 058f:6387 Alcor Micro Corp. Flash Drive
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@colibri-imx6ull-06902769:~# lsusb -s 001:003 -v
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x058f Alcor Micro Corp.
idProduct 0x6387 Flash Drive
bcdDevice 1.06
iManufacturer 1 Generic
iProduct 2 Mass Storage
iSerial 3 F806AA6F
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
can’t get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)

Best regards.

Hi @developer0916,

As I understand you don’t have this memory stick at hand? Are there as well problems with other flash drives, or only with this one? If just one, then it would be much simpler to just trash it away.

Well, I have cheap Alcor stick with identical VID and PID, and it works in the same configuration like yours, iMX6ULL Bus 001 <–> 2514 hub <–> Alcor stick. It’s just little older controller. Yours is “bcdDevice 1.06” and mine is 1.02.

Did you show full output of lsusb -s 1:3 -v? It’s bit suspicious starting from Device Qualifier. “for other device speed” looks like support for USB3 SuperSpeed, or perhaps even for USB1. USB3 devices, I have, look different. USB2 flash sticks don’t show anything like Device Qalifier in lsuusb output. Perhaps it’s just older lsusb version? Which BSP are you using?

My recommendation, if you really care about this precious Alcor stick, use usbview.exe from Windows SDK. It will validate many possible device descriptor errors. If it shows errors, then just abandon this stick.

Regards

Thank your for your response.

The USB stick is not particularly important.
Customers are testing different USB flash drives because an unspecified USB flash drive will be used by an end user.
They are wondering why it works with Windows and Linux, but not with UBoot.
Their EasyInstaller boots from the USB stick.

As I understand you don’t have this memory stick at hand?

Yes, I dont have the USB memory.
I got the information on a usb stick which has no problems but it makes little difference.

I will ask my customer about usbview.

Module:colibri-imx6ull
BSP:5.7
Board:EVA Board

root@colibri-imx6ull-06399196:~# lsusb -V
lsusb (usbutils) 012

root@colibri-imx6ull-06399196:~# lsusb -s 001:003 -v

Bus 001 Device 003: ID 13fe:4100 Kingston Technology Company Inc. Flash drive
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x13fe Kingston Technology Company Inc.
idProduct 0x4100 Flash drive
bcdDevice 1.00
iManufacturer 1 UFD 2.0
iProduct 2 Silicon-Power4G
iSerial 3 201302SP0025070F33BC30ACA601
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 200mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
can’t get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)

Best regars.

I received information about usbview.

[Port1] : USB 大容量記憶装置

Device Power State: PowerDeviceD0

   ---===>Device Information<===---

English product name: “Mass Storage”

ConnectionStatus:
Current Config Value: 0x01 → Device Bus Speed: High
Device Address: 0x08
Open Pipes: 2

      ===>Device Descriptor<===

bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0x00 → This is an Interface Class Defined Device
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0x058F = Alcor Micro, Corp.
idProduct: 0x6387
bcdDevice: 0x0106
iManufacturer: 0x01
English (United States) “Generic”
iProduct: 0x02
English (United States) “Mass Storage”
iSerialNumber: 0x03
English (United States) “F806AA6F”
bNumConfigurations: 0x01

      ---===>Open Pipes<===---

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x01 → Direction: OUT - EndpointID: 1
bmAttributes: 0x02 → Bulk Transfer Type
wMaxPacketSize: 0x0200 = 0x200 max bytes
bInterval: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82 → Direction: IN - EndpointID: 2
bmAttributes: 0x02 → Bulk Transfer Type
wMaxPacketSize: 0x0200 = 0x200 max bytes
bInterval: 0x00

   ---===>Full Configuration Descriptor<===---

      ===>Configuration Descriptor<===

bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x0020 → Validated
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 → Bus Powered
MaxPower: 0x64 = 200 mA

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08 → This is a Mass Storage USB Device Interface Class
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x01 → Direction: OUT - EndpointID: 1
bmAttributes: 0x02 → Bulk Transfer Type
wMaxPacketSize: 0x0200 = 0x200 max bytes
bInterval: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82 → Direction: IN - EndpointID: 2
bmAttributes: 0x02 → Bulk Transfer Type
wMaxPacketSize: 0x0200 = 0x200 max bytes
bInterval: 0x00

Wireshark can get USB protocol log.
If you require, I will request to the customer.

Best regards.

Hi @developer0916,

So usbview doesn’t show USB descriptor errors and it still isn’t recognized by U-Boot? I don’t know could cause it. Obviously it is not Alcor or Kingston issue. It is not current consumption specified in descriptors issue. Clearly it is not USB hub issue, I use the same hub without problems.
Are you sure your USB drive is powered? Perhaps it is powered only after Linux boots? No more ideas, sorry.

Edward

So usbview doesn’t show USB descriptor errors and it still isn’t recognized by U-Boot?

yes it is.

Are you sure your USB drive is powered? Perhaps it is powered only after Linux boots?

Only this USB flash drive is not recognized.
Other USB flash drives can be recognized by UBoot.
Therefore, I don’t think it is a physical problem.

Please confirm attached file.
I compared with other USB flash drives.

Some parts are not output to this USB stick.
I am not familiar with USB, but I wonder if it has something to do with this part not outputting.
Other USB devices have this item.

Best regards.

What’s marked with black elipse is USB port properties, not attached device properties. Perhaps it’s just older usbview, which doesn’t show port properties. BTW newer usbview is stronger at USB descriptors validation. Try using at least version 2.0. It still may miss some descriptor errors, but it is much stronger than older usbview.

Best regards

USBView version is 2.0.
OS is windows7.
Windows7 doesnt show some items.

I borrowed this USB to analyze and investigate the cause.
This USB takes a few seconds to boot up after power is supplied.
U-boot only monitors the timeout period of 1.1 seconds after powering up with the usb start command.
This is not a problem in Windows or Linux because they are constantly monitoring the hub.

I explained this to the customer and it was resolved.

Best regards.

This is very interesting, thanks a lot for the investigation.

Did you modify the U-boot monitoring timeout period for the USB subsystem? It would be great if you could point where is this.

Thanks,
Alvaro.

U-boot was recognized by extending the timeout period.
However, it conversely means slower boot time.
It is up to the customer to decide if such USB sticks should be supported.

Best regards.

How did you extend the timeout period?

https://git.toradex.com/cgit/u-boot-toradex.git/tree/common/usb_hub.c?h=toradex_2020.07

Please check line 210

ex
hub->connect_timeout = hub->query_delay + 1000;

hub->connect_timeout = hub->query_delay + 10000;

hub->query_delay is 100.
It is USB specification.
100ms wait is for power stable.
100 + 1000 = 1.1second

The USB stick boot time is 3 second over.

Best regards

3 Likes

Thanks a lot!

I put a log in U-Boot, but when I deleted the log, the USB could not be recognized properly.
It seems that the delay due to the log was also necessary.
U-Boot recognized fine when I put delay instead of log. (line486)
I am attaching the source code for reference.
It may be helpful for other users if they have the same issue.

Best regards.
usb_hub.c (25.8 KB)