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

Unknown USB Device. UF2 Mass Storage device only shows up in bootloader mode #13

Open
robrussell opened this issue Feb 7, 2020 · 8 comments

Comments

@robrussell
Copy link

When uploading code to the Robohat MM1 from the Arduino IDE, the COM port disappeared. I've flashed it successfully many times and saw output from the serial monitor. But the next time I tried to flash it Windows 10 reported that the device is not working. In Device Manager the Robohat MM1 shows up as "Unknown USB Device (Device Descriptor Request Failed).

When I connect it to my Linux machine, dmesg shows:
[ 4192.243690] usb 1-12: new full-speed USB device number 19 using xhci_hcd
[ 4192.363702] usb 1-12: device descriptor read/64, error -71
[ 4192.591716] usb 1-12: device descriptor read/64, error -71
[ 4192.819687] usb 1-12: new full-speed USB device number 20 using xhci_hcd
[ 4192.939701] usb 1-12: device descriptor read/64, error -71
[ 4193.167705] usb 1-12: device descriptor read/64, error -71
[ 4193.395687] usb 1-12: new full-speed USB device number 21 using xhci_hcd
[ 4193.395845] usb 1-12: Device not responding to setup address.
[ 4193.603847] usb 1-12: Device not responding to setup address.
[ 4193.811632] usb 1-12: device not accepting address 21, error -71
[ 4193.931697] usb 1-12: new full-speed USB device number 22 using xhci_hcd
[ 4193.931834] usb 1-12: Device not responding to setup address.
[ 4194.139842] usb 1-12: Device not responding to setup address.
[ 4194.347685] usb 1-12: device not accepting address 22, error -71
[ 4194.347736] usb usb1-port12: unable to enumerate USB device

I've tried multiple cables and computers and rebooted the Windows machine.

Tapping the reset button on the MM1 twice quickly does bring up the bootloader mass storage device. It shows the files "CURRENT.UF2", "INDEX.HTM", and "INFO_UF2.TXT".

Is there a way to recover the MM1?

@wallarug
Copy link
Member

wallarug commented Feb 8, 2020

Hey @robrussell

You can still push Arduino code while the board is in Bootloader mode.

It sounds like you may have selected the wrong board in Arduino IDE and then pushed a bootloader that the board does not like. For Example: If you have Arduino Uno selected and then hit upload. The board could still take the file but then get confused when it tries to run code.

I would recommend the following two actions:

  1. Try and push code again when the board is in bootloader mode, double checking the correct board is selected.
  2. Put the board into bootloader mode and reload CircuitPython onto it to put the board into a known good state. https://circuitpython.org/board/robohatmm1_m4/

@robrussell
Copy link
Author

Thanks @wallarug . Good to know it's possible to mess up by selecting the wrong board. I don't think that's what happened in this particular case though. I had pushed code several times a few minutes before this happened and can't imagine that I changed boards and changed back afterward.

The COM port shows up in bootloader mode and I'm able to push code to the board from the Arduino IDE. But then the board resets and my code doesn't run.

I grabbed adafruit-circuitpython-robohatmm1_m4-en_US-4.1.1.uf2 from the page you linked to, that looks like the latest stable release?

Before putting the new uf2 file on it, my INFO_UF2.TXT file said:

UF2 Bootloader v3.7.0-37-g06c6126 SFHWRO
Model: Robo HAT MM1 M4
Board-ID: SAMD51G19A-RoboHATMM1-v24

I copied the file to the mass storage device and it reset. After it came up it seems to work again. It contains a file named boot_out.txt which says:

Adafruit CircuitPython 4.1.1 on 2019-12-18; Robo HAT MM1 M4 with samd51g19

That matches up with the uf2 file I put on the MM1 but when I go back into bootloader mode, the INFO_UF2.TXT file still has the same contents as before. Not sure why that doesn't change - unless the v3.7.0 refers to the bootloader version, separate from the CircuitPython version.

Anyway, this seems to have unwedged the device. I'm able to flash it from the Arduino IDE again and my code is running. Thanks again!

@wallarug
Copy link
Member

wallarug commented Feb 8, 2020

Hey @robrussell . That's great!

FYI: The bootloader and circuitpython are separate.

@robrussell robrussell reopened this Feb 8, 2020
@robrussell
Copy link
Author

I think I may have spoken too soon. It seems like it keeps getting in to this state again. I put the uf2 file on it, the board comes back up, I flash from Arduino IDE, and then when it resets Windows doesn't recognize the device. I've confirmed that the board selected is the Robohat MM1. I can keep tinkering with it. Does the name of the uf2 file matter at all?

@robrussell
Copy link
Author

This seems to be repeatable:

  1. Put a uf2 file on ROBOM4BOOT.
  2. Board resets. The serial port number has changed. MM1 comes up running code.py (my current code.py is dumping INA219 data to the serial port).
  3. Push code to the device from the Arduino IDE. If it succeeds, the board resets.
  4. After reset the board is not recognized by Windows (same symptoms as my first post).

After step 4 I can go back to step 1 and get the same results. I've tried the version 5 beta uf2 file as well but don't see a difference.

I don't know how the board decides whether it's going to run the Arduino code or code.py. This is the first CircuitPython board I've really done anything with.

@wallarug
Copy link
Member

wallarug commented Feb 8, 2020

It might be an issue with the bootloader file and how Arduino IDE is flashing the board.

If you treat the UF2 bootloader as a completely separate part of the device (0x0000 - 0x4000) it becomes a little bit easier to understand.

CircuitPython and Arduino run in the same part of the device - so they cannot be running at the same time on the same device. The bootloader should not change but can become corrupted by Arduino IDE in my experience.

The other way you can check that Arduino IDE is behaving itself is by looking at the device descriptor.
image

I cannot recall exactly what the Arduino IDE variant should say but it should be VID: 1209 and PID:4D4 something.

I believe that Arduino IDE can be forced to upload a fresh bootloader.

@robrussell
Copy link
Author

I see this in Device Manager

Driver Management concluded the process to install driver usbser.inf_amd64_a465ab02edb9afb0 for Device Instance ID USB\VID_1209&PID_4D45&MI_00\6&862A29F&0&0000 with the following status: 0x0.

when I get the device running Arduino code. But if the device is running Arduino code and I try to flash it again from the Arduino IDE, the device seems to go into bootloader mode but not actually accept the new code.

Here's the elided output from Arduino IDE:

Arduino: 1.8.11 (Windows 10), Board: "Robo HAT MM1 (SAMD51), Enabled, 120 MHz (standard), Small (-Os) (standard), Arduino, Off"

... successful compilation and linking messages for Blink.cpp ...

Sketch uses 10724 bytes (2%) of program storage space. Maximum is 507904 bytes.
Forcing reset using 1200bps open/close on port COM9
PORTS {COM5, COM7, COM9, } / {COM5, COM7, } => {}
PORTS {COM5, COM7, } / {COM5, COM7, } => {}
... lots more of the same ...
PORTS {COM5, COM7, } / {COM5, COM7, } => {}
PORTS {COM5, COM7, } / {COM5, COM7, } => {}
PORTS {COM5, COM7, } / {COM5, COM7, } => {}
PORTS {COM5, COM7, } / {COM5, COM7, } => {}
Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.

Based on that last error message I tried hitting the reset button after compilation but before it tries to flash. Results are different but not better yet. I think my problem is a lot like the one covered at https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/metro-m0-help#faq-2835964 . I'll dig a little more as time allows.

@wallarug
Copy link
Member

wallarug commented May 4, 2020

Hey @robrussell ,

How did this issue end up? Did it get resolved?

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