2024-10-30 03:15 AM - last edited on 2024-10-30 03:27 AM by Andrew Neil
Hi all,
Total newbie here.
I am seeing this error in Windows 11 Device Manager: "Device Descriptor Request Failed", when I plug the Bluepill to a PC using Bluepill's onboard micro-USB Port
Although the Bluepill looks like it is running OK with the previously flashed program (Blink PC13) with power supplied via the Bluepill's onboard micro-USB, Windows is giving this error.
Being a "perferctionist", I would like to see the Windows error eliminated.
I have check few "solutions" on youtube and none of them seems to apply to STM32, and thus not working.
Can any kindly soul please help.
Sorry if this has been asked before, but being a newbie to this site, I can't find anything suitable.
Solved! Go to Solution.
2024-10-31 08:35 AM
Thanks Thomas, the code appear to work with just the bluepill onboard usb connected to PC giving no Windows error (initial problem).
Sorry that I don't quite understand when you say "before you want to use USB" ?
Ain't I already using USB to supply power to the blue pill ?
Do you mean reverting the "set PA12 low" change ? If so, you mean using reusing PA12 as USB Data ?
2024-10-31 08:38 AM
@JLHK01 wrote:Ain't I already using USB to supply power to the blue pill ?
Not really: you're just using it as a dumb power supply - not engaging in any USB protocol interactions.
2024-10-31 09:03 AM
Sorry that I don't quite understand when you say "before you want to use USB" ?
Do you mean reverting the "set PA12 low" change ? If so, you mean using reusing PA12 as USB Data ?
2024-10-31 09:24 AM
It was @Thomas8 who said those things - not me.
2024-10-31 10:48 AM
Well this code is just a workaround because the F103 does not provide this resistor internally. As long as PA12 is low no USB firmware can work. So if you plan to write a USB firmware PA12 mut be switched back to input mode. This will work as USB plugin event and the host tries again to enumerate the USB device.
2024-11-01 05:07 AM
Thanks Thomas for your reply and further info.
Sorry that I am asking newbie/ignorant questions as I am indeed a newbie in microcontroller.
When you referring to "firmware" in "PA12 is low no USB firmware can work" and "write a USB firmware", are you referering to bootloader as "firmware" or application code as "firmware" ?
Also, "host tries again to enumerate...", here "host" referring to PC, not the MCU, right ?
Sorry for my understanding of English, not my mother tongue.
2024-11-01 12:14 PM
USB firmware means app with usb device code flashed to the F103 like CDC or HID. Host is usually a PC or another embeded platform with host functionality.
BTW I am German so English is not my mother language too.
2024-11-01 12:27 PM - edited 2024-11-01 12:31 PM
@Thomas8 wrote:So if you plan to write a USB firmware PA12 mut be switched back to input mode. This will work as USB plugin event and the host tries again to enumerate the USB device.
Well, that's not actually true. As soon as USB is enabled in RCC, it takes over the control of D+ and D- pins regardless of what's set in CRH. So it's enough to set PA12 in GPIOA->CRH as open drain output (logic low state - default after reset) to disable enumeration - no reason to change this setting. Also, it's practical to set it initially this way in USB applications, then switch USB on after about 50 ms - this allows for proper re-enumeration after reset or app/bootloader switch.
In addition, the 10k resistor to +5V found in BluePills is quite reasonable. It basically works the same as 1k5 connected to +3.3V.
2024-11-04 08:14 AM
Thomas,
Thanks for your answer. Is there any CDC example codes (any URLs are great) that I can download and try ?
2024-11-04 08:42 AM
gbm,
Thanks for your input.
You wrote: "then switch USB on after about 50 ms - this allows for proper re-enumeration after reset or app/bootloader switch."
How can one go about doing this, via some code at the beginning of main.c ? If so, can you give this newbie (me) some example code ?
BTW, regarding your USB device stack, is there a youtube video for a demo ? I wish to understand it a bit more but reading the code is too technical for me...sweating