TheKikGen / stm32-tkg-hid-bootloader

A HID driverless bootloader and flash tool companion for the STM32F1 line
38 stars 12 forks source link

bootloader fails to enumerate in win10 / linux #9

Open slorquet opened 3 years ago

slorquet commented 3 years ago

hello, I managed to flash your latest release (generic pc13) on a bluepill that already has a 1K5 pullup.

But windows cannot enumerate the device. It says in the device manager: failure to ask for a device descriptor. And the LED flashes quickly (100ms delays?)

Linux is more verbose:

[680973.585678] usb 2-1: device descriptor read/64, error -32
[680973.821695] usb 2-1: device descriptor read/64, error -32
[680974.057684] usb 2-1: new full-speed USB device number 24 using xhci_hcd
[680974.185698] usb 2-1: device descriptor read/64, error -32
[680974.421703] usb 2-1: device descriptor read/64, error -32
[680974.529750] usb usb2-port1: attempt power cycle
[680975.181694] usb 2-1: new full-speed USB device number 25 using xhci_hcd
[680975.181860] usb 2-1: Device not responding to setup address.
[680975.389865] usb 2-1: Device not responding to setup address.
[680975.597698] usb 2-1: device not accepting address 25, error -71
[680975.725701] usb 2-1: new full-speed USB device number 26 using xhci_hcd
[680975.725860] usb 2-1: Device not responding to setup address.
[680975.933865] usb 2-1: Device not responding to setup address.
[680976.141703] usb 2-1: device not accepting address 26, error -71
[680976.141764] usb usb2-port1: unable to enumerate USB device

It is not a hardware error, since I can enumerate both the blackmagic probe and the maple bootloader successfully with the same device:

openocd -f interface/ftdi/jtag-lock-pick_tiny_2.cfg -c 'transport select swd' -f target/stm32f1x.cfg -c 'reset_config none separate' -c 'program generic_boot20_pc13.bin 0x08000000 verify reset exit'
Open On-Chip Debugger 0.10.0+dev-01070-g753cf12 (2017-05-09-10:21)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
swd
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
none separate
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000040 msp: 0x20002000
** Programming Started **
auto erase enabled
Info : device id = 0x20036410
Info : flash size = 128kbytes
wrote 8192 bytes from file generic_boot20_pc13.bin in 0.180988s (44.202 KiB/s)
** Programming Finished **
** Verify Started **
verified 7172 bytes in 0.160009s (43.772 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

Then:

dmesg
[681046.426462] usb 2-1: new full-speed USB device number 27 using xhci_hcd
[681046.575522] usb 2-1: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[681046.575527] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[681046.575530] usb 2-1: Product: Maple 003
[681046.575533] usb 2-1: Manufacturer: LeafLabs
[681046.575535] usb 2-1: SerialNumber: LLM 003

The device also shows up in the device manager. The LED flashes slowly.

Something in your bootloader is not compatible with my bluepill.

How to investigate this?

I have already tried several things: mass erase flash unlock

Nothing helped. still fails to read device descriptor.

Thank you

TheKikGen commented 2 years ago

HI. Almost impossible to diagnose that remotely. A lot of blue pill version, and stm32 clones are existing.
You can try to play with delay in the source code. Sometimes it helps. Also, show hidden devices in the WIndows Device Manager, and remove all previous HID devices you see.

jamesle-0812 commented 11 months ago

Hi, sorry to bring it back. I have the same problem here. Mine is a Chinese clone of STM32F103, which has problem of "CPUTAPID 0x2ba01477" instead of 0x1ba01477. May be a clue if you wanna have a look?!