Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC incorrect enumeration when pc booting #116

Open
telix001 opened this issue Apr 29, 2020 · 1 comment
Open

MSC incorrect enumeration when pc booting #116

telix001 opened this issue Apr 29, 2020 · 1 comment

Comments

@telix001
Copy link

When I connect the Feather M0 Express board (only the bootloader is programmed) to the computer's USB port before turning on the power, and then turn on the computer, the msc enumeration does not work correctly.... Operating system startup takes a very long time. The uf2 disk is not detected correctly..

Debug mode - incorrect enumeration:
Start
Before main loop
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x8
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x200 wIndex: 0x0 wLen: 0x9
USBReq: 0x680 wValue: 0x200 wIndex: 0x0 wLen: 0x57
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x681 wValue: 0x2200 wIndex: 0x1 wLen: 0x21
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x200 wIndex: 0x0 wLen: 0xFF
USBReq: 0x680 wValue: 0xF00 wIndex: 0x0 wLen: 0xFF
USBReq: 0x2C0 wValue: 0x0 wIndex: 0x7 wLen: 0xAA
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0xFF
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0xFF
USBReq: 0x680 wValue: 0x600 wIndex: 0x0 wLen: 0xA
Stall EP: 0x0
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0x2
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0x4
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0x2
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0x42
USBReq: 0xFEA1 wValue: 0x0 wIndex: 0x0 wLen: 0x1
MSC maxlun
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0xA21 wValue: 0x0 wIndex: 0x1 wLen: 0x0
USBReq: 0x681 wValue: 0x2200 wIndex: 0x1 wLen: 0x61
USBReq: 0x80 wValue: 0x0 wIndex: 0x0 wLen: 0x2
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0x402
USBReq: 0x680 wValue: 0x301 wIndex: 0x409 wLen: 0x402
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x402

and correct enumeration when the system is already running and I connect M0 Exprress to the usb port:

Start
Before main loop
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x40
USBReq: 0x500 wValue: 0xF wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x100 wIndex: 0x0 wLen: 0x12
USBReq: 0x680 wValue: 0x200 wIndex: 0x0 wLen: 0xFF
USBReq: 0x680 wValue: 0xF00 wIndex: 0x0 wLen: 0xFF
USBReq: 0x2C0 wValue: 0x0 wIndex: 0x7 wLen: 0xAA
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0xFF
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0xFF
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0xFF
USBReq: 0x680 wValue: 0x600 wIndex: 0x0 wLen: 0xA
Stall EP: 0x0
USBReq: 0x900 wValue: 0x1 wIndex: 0x0 wLen: 0x0
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x4
USBReq: 0x680 wValue: 0x302 wIndex: 0x409 wLen: 0x24
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0x2
USBReq: 0x680 wValue: 0x300 wIndex: 0x0 wLen: 0x4
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0x2
USBReq: 0x680 wValue: 0x303 wIndex: 0x409 wLen: 0x42
USBReq: 0xFEA1 wValue: 0x0 wIndex: 0x0 wLen: 0x1
MSC maxlun
MSC CMD: 0x12
MSC CMD: 0x12
MSC CMD: 0x23
MSC CMD: 0x12
left-over residue: 0xDB

@amasmiller
Copy link

We also had the same problem.

I believe the cause of the issue is the BIOS enumerating the USB device, and when the OS later tried to enumerate, the bootloader was in a state such that it didn't handle the re-enumeration correctly.

Our workaround was to customize the bootloader and introduce a delay prior to enumerating the USB, allowing, the BIOS to hand off control to the OS before the bootloader would accept start enumerating the USB device. The delay should be as long as it takes the BIOS to stop enumerating the USB device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants