0

Unable to enumerate feather STM32 in DFU mode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Unable to enumerate feather STM32 in DFU mode

by faelys on Mon Sep 13, 2021 2:11 pm

Hello,

I'm very new at this, please forgive me if I missed something obvious.

I recently got a feather STM32F405 so that I could try to program something on it in Ada. I first tried to plug it as-is on my computer, and it was correctly recognized as FEATHER_F405 CDC in FS Mode, and cycling the embedded neopixel. So far so good.

I then soldered a header, and shorted the B0 pin with the 3.3V, and plugged it again, and got the following messages from the linux kernel:
Code: Select all | TOGGLE FULL SIZE
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: attempt power cycle

and after that automatic power cycle, the device was correctly recognized as STM32 BOOTLOADER. So using dfutool, I flashed the blinky example for Ada Drivers Library, and it went fine. Since then the feather isn't recognized when plug it without B0 pin high, so maybe I flashed something I shouldn't have, but I can live with that.

My issue that when I connect the B0 pin to the 3.3V and plug it, or push the reset button, I get the following linux kernel messages:
Code: Select all | TOGGLE FULL SIZE
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: attempt power cycle
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: Cannot enable. Maybe the USB cable is bad?
usb usb1-port4: unable to enumerate USB device

and there is no USB device on the linux, and I cannot use dfutool.

However, about one try of 20 or so, the enumeration works, and I can flash the feather again. So it is not completely broken, and when the enumeration works the flashing goes smoothly and the feather has the expected behavior (including unintended bugs in my code).

I tried using another cable, anther USB port, or another linux computer, with exactly the same issue and the same messages.

I doesn't work on FreeBSD either, but it says it with a slightly different message:
Code: Select all | TOGGLE FULL SIZE
kernel: uhub_reattach_port: giving up port 3 reset - device vanished: change 0x1 status 0x101


Is there something wrong with my unit? Have I broken something? Is there any clue in those symptoms on what I did wrong, and how I can avoid doing it again? Could there be a way to fix or work around the issue with this unit?

Thanks in advance for your help.

faelys
 
Posts: 12
Joined: Mon Sep 13, 2021 1:45 pm

Re: Unable to enumerate feather STM32 in DFU mode

by mikeysklar on Tue Sep 14, 2021 5:03 pm

We have replaced some of the STM32 modules that struggle to go into DFU mode. However, in your case it seems like you reliably access the bootloader, but have been seeing a 1 in 20 successful boot with the adafruit blink upload?

Which example code did you upload?

Can you try plugging the device in after bootloader mode, disabling the jumper and plugging in the usb connection again (rather than just pressing the reset button)?

Keep in mind that the USB-C cable orientation might effect the mounting.

mikeysklar
 
Posts: 5813
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to enumerate feather STM32 in DFU mode

by faelys on Thu Sep 16, 2021 1:26 am

Which example code did you upload?


The example code is https://github.com/AdaCore/Ada_Drivers_Library/blob/master/examples/feather_stm32f405/blinky/src/main.adb which I subsequently modified with a more complex blinking pattern. The Ada compiler generates and ELF binary, which I convert into a .dfu with elf2dfuse, and then upload using dfutool.

In all the binaries I generated the blinking pattern is different, and that's how I know that all uses of dfutool were successful, as long as the host correctly enumerates the USB device.

We have replaced some of the STM32 modules that struggle to go into DFU mode. However, in your case it seems like you reliably access the bootloader, but have been seeing a 1 in 20 successful boot with the adafruit blink upload?


I think it's the other way around, but now I'm not sure how many issues I'm facing, so I'll try explaining another way:

  • without B0 jumper, before first flashing: the host finds a FEATHER_F405 CDC in FS Mode device without error, and the neopixel blinkeded.
  • [with B0 jumper, before first flashing: the host reports an error, automatically power cycle, then finds a STM32 BOOTLOADER device, and dfutoo works fine[/*]
  • without B0 jumper, after first flashing: the host doesn't report anything (as usually happens when I plug a device which charges
  • without any data connection), the LED between the USB-C connector and the battery connector blinks red in the programmed pattern, and the LED on the other side of the USB-C connector blinks amber very quickly
  • with B0 jumper, after first flashing, most tries: the host reports errors and cannot enumerate, no USB device is created, dfutool cannot work, the red LED is off, the amber LED blinks quickly
  • with B0 jumper, after first flashing, sometimes: the host finds a STM32 BOOTLOADERdevice, sometimes after errors sometimes not, dfutool can be used, the LED pattern is the same as above

Now that I made more try, I think I may have been optimistic about 1 in 20, or maybe it's becoming worse over time, but I could not get it to work since my first post.

I tried with the reset button and with unplug/plug, I tried with both cable orientations, I tried with another cable and/or another host, with exactly the same results. I've also tried to apply a gentle pressure on the USB-C connector in various directions (in case there is a bad contact), but it didn't change anything either.

faelys
 
Posts: 12
Joined: Mon Sep 13, 2021 1:45 pm

Re: Unable to enumerate feather STM32 in DFU mode

by mikeysklar on Thu Sep 16, 2021 11:33 am

I think we should try a fresh unit in your case to see if you see the same behaior.

I have read about people waiting 10 - 20 minutes with B0 jumper set to get into DFU mode. The timing might explain the partial success you have had.

Please send an e-mail to supprot@adafruit.com requesting a replacement. Include your order# and a link to this forum thread. Let us know if you see anything different with a fresh controller.

mikeysklar
 
Posts: 5813
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to enumerate feather STM32 in DFU mode

by faelys on Fri Sep 17, 2021 4:44 am

Thanks for confirming the issue is known. Unfortunately I didn't order directly from Adafruit, but from a European reseller, so that delivery and payment are easier.

Could there be a work-around? I can live with a 10-to-20-minute wait if it can be automated. Any idea on how to do that? Maybe using a RaspberryPi with a GPIO on the feather reset pin, and a loop which triggers a reset when the device does not appear after some timeout?

faelys
 
Posts: 12
Joined: Mon Sep 13, 2021 1:45 pm

Re: Unable to enumerate feather STM32 in DFU mode

by mikeysklar on Fri Sep 17, 2021 11:36 am

You can contact support@adafruit.com asking about a work around and naming the reseller you worked with. Maybe there is something that can be done for your situation.

Were you able to confirm for yourself that the longer wait time does result in a successful DFU access? I like your thinking on using a Pi GPIO. You should also get OS level notifications dings and beeps as the device appears which would make it easier to script alerts. I would probably go with a looping bash script that is checking the output for the df or mount command for your STM32 FS mount point.

mikeysklar
 
Posts: 5813
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to enumerate feather STM32 in DFU mode

by faelys on Tue Sep 21, 2021 9:05 am

Just as a quick update, I'm still working out with the vendor, but I currently have the work around of rpi-assisted reset until the enumeration works. It usually takes a few minutes, but eventually I can flash whatever I need on the feather. Now I'm facing another, probably unrelated, issue with I2C (https://forums.adafruit.com/viewtopic.php?f=47&t=183431).

Thanks a lot for your help!

faelys
 
Posts: 12
Joined: Mon Sep 13, 2021 1:45 pm

Please be positive and constructive with your questions and comments.