Serasidis / STM32_HID_Bootloader

Driverless USB HID bootloader and flashing tool for STM32F10X devices
409 stars 149 forks source link

USB init failing for new bluepills #64

Open f3sty opened 10 months ago

f3sty commented 10 months ago

I've recently bought two different lots of bluepills that don't work with this bootloader but they work fine with the STM32duino-bootloader, and user space USB works too. The chips are marked as STM32F103C8T6 but I'm sure they're fake just like most of the bluepills I've bought over the years. At first I thought I'd just received a bad batch, but it looks like many vendors are selling this new clone variant because I then got the same type from another seller :(

They symptoms seem to be they're just running too.... fast? On a 'good' bluepill PC13 LED flashes at ~20hz after burning the bootloader, but on these new ones it flashes at 60hz. The good bluepill receives its first SOF ~150ms after the start of enumeration, whereas the new bad one receives it 1ms after starting to wake the host. But with the STM32duino-bootloader flashed on the new bluepill instead, it too takes ~150ms too.

With STM32_HID_Bootloader both bluepills receive the SETUP and DATA0 packets from the host about 40-50ms after the first SOF, but these new bluepills never send an ACK (or any response to the SETUP). The host retries the SETUP transaction two more times without an answer, then tries 3 more times 400ms later.

Seeing as these bluepills work fine with other USB bootloaders the hardware is obviously capable of establishing a USB connection, which leads me to think there might be something in the initialization that they don't like? Any help would be appreciated, I've got a dozen of these now and I assume there's lot of other people receiving them too.

f3sty commented 10 months ago

bootsector's original stm32-hid-bootloader also works properly on these new bluepills.

reepotah commented 10 months ago

Having the same issue with Bluepills I've got few months ago and just unpacked. They get "Unknown USB Device (Device Descriptor Request Failed)" error in a couple of seconds after connecting it to PC. They look like this: PXL_20231023_155433814 MV PXL_20231023_155454008 MV LED on PC13, but it's a red led, same color as the power led.

I don't know how to check USB timings and all that, but my pills are blinking at 27Hz after flashing the bootloader.

One of them runs STLink v2 firmware just fine, also I tried STM32duino-bootloader and it also gets initialized properly.

f3sty commented 10 months ago

pulseview_usb.zip Here are a pair of pulseview captures of the USB init - one from a bluepill I bought a year or so ago (working), and the other from a recently purchased bluepill (non-working).
As much as it looks like a hardware issue, these new bluepills work fine with most other USB bootloaders and USB stacks.

onolox commented 7 months ago

I have a stm32F103CBT6 that have a problem similar to the OP, after flashing the green led stays on, it doesn't flash like it should (pressing reset or when plugged in USB green led off).

After plugging it into USB it shows in windows an problematic device under USB devices.

dylansison commented 7 months ago

I have a stm32F103CBT6 that have a problem similar to the OP, after flashing the green led stays on, it doesn't flash like it should (pressing reset or when plugged in USB green led off).

After plugging it into USB it shows in windows an problematic device under USB devices.

same issues here, and yes other usb bootloaders work just not this one

aguaviva commented 4 months ago

same issues here, and yes other usb bootloaders work just not this one

Which bootloaders work fine?

agusting21 commented 2 months ago

@aguaviva this one works for me https://github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries

arthurfprecht commented 3 weeks ago

I have the same issue, bought two blue pill boards in different occasions, from different sellers, both with the Device Descriptor Request Failed Error. Similarly to what pelople above found, they work with the STM32duino Bootloader, and if I use the STLink to program them and use CDC, the USB also works just fine ?! The funny thing is that they pass the tests in the following tool: https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diags-v1.640.html So that mean they are compatible even bug-wise in some things, but not in the USB hardware. That's sad :(

Harry1326 commented 2 weeks ago

please refer to: https://blog.csdn.net/es15071848238/article/details/141216773?spm=1001.2014.3001.5501

Harry1326 commented 2 weeks ago

https://github.com/Harry1326/STM32F103C6T6_HID-bootloader

Harry1326 commented 2 weeks ago

Having the same issue with Bluepills I've got few months ago and just unpacked. They get "Unknown USB Device (Device Descriptor Request Failed)" error in a couple of seconds after connecting it to PC. They look like this: PXL_20231023_155433814 MV PXL_20231023_155454008 MV LED on PC13, but it's a red led, same color as the power led.

I don't know how to check USB timings and all that, but my pills are blinking at 27Hz after flashing the bootloader.

One of them runs STLink v2 firmware just fine, also I tried STM32duino-bootloader and it also gets initialized properly.

https://github.com/Harry1326/STM32F103C6T6_HID-bootloader