2025-01-06 04:52 AM - last edited on 2025-01-06 04:54 AM by Andrew Neil
I've "developed" a ridiculously simple test program using STM32CubeIDE, for BlackPill STM32F411CE :
on board LED blinks at 0,5 Hz. Downloaded via ST-link plugged into USB.
Browsing through Memory shows the downloaded code (Segment .text) matching the linker log file, all fine.
Disconnect the ST-Link wires from board and plugging in a USB3 Cable into the up to now unused onboard USB port. Holding down boot0 button while tapping the RST button fires up STM ROM bootloader, which correctly senses a plugged in USB cable and presents the board as USB device 0483/df11, complete with text "STM32 BOOTLOADER", again all well, one would think.
However, firing up CubeProgrammer mode "USB" and clicking rescan button "no DFU detected" shows.
Clocksetup ist 96MHz main clock and 48MHz USB clock(?) with the onboard external 25.000MHz crystal.
Even after configuring the (in my program unused) USB as USB_OTG_FS device in "device only" mode, same result. Configuring the (unused) USB_OTG_FS device in "OTG/Dual_Role" mode, same result.
Do I need to configure USB in my program at all to make it work for the bootloader,
even if my programm doesn't use USB?
(I'd guess: no, the bootloader does all the setup himself, and my program doesn't even run when in STM bootloader)
What am I missing?
On a further note, what are the various USB modes for?
What mode to setup if one wants to send out characters via BlackPill's onboard USB port to a virtual USB-serial "COMx:" device in Windows?
Solved! Go to Solution.
2025-01-06 07:31 AM
Nope. That was the bootloader USB device, no idea why CubeProgrammer does not recognize it.
But I've found a solution to the USB_CDC Device not showing up: the heap was too small !
I changed it from 0x0200 to 0x2000 and voila, the device shows up, gets configured by Windows and on COM6:
I can watch my Hello World messages appear!
=> one needs to look at SRM32F411CEUX_RAM.ld there the heap gets defined as _Min_Heap_Size
Only drawback I see is that this file is a genuien STM file for my MCU so tampering with it does feel like a hack.
I'd rather right-click that projekt and define those vaules as "per project default-overrides" and not change basic chip definition files.
2025-01-06 05:18 AM
Is Windows loading a driver for "STM32 BOOTLOADER" ?
To pretend to be a Serial port you'd want to be a CDC Device
2025-01-06 06:14 AM
Hi @PRenn.1
Since it is a Blackpill device, we cannot provide further support for this issue as it is a fake product.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-06 07:31 AM
Nope. That was the bootloader USB device, no idea why CubeProgrammer does not recognize it.
But I've found a solution to the USB_CDC Device not showing up: the heap was too small !
I changed it from 0x0200 to 0x2000 and voila, the device shows up, gets configured by Windows and on COM6:
I can watch my Hello World messages appear!
=> one needs to look at SRM32F411CEUX_RAM.ld there the heap gets defined as _Min_Heap_Size
Only drawback I see is that this file is a genuien STM file for my MCU so tampering with it does feel like a hack.
I'd rather right-click that projekt and define those vaules as "per project default-overrides" and not change basic chip definition files.
2025-01-06 07:43 AM
@PRenn.1 wrote:no idea why CubeProgrammer does not recognize it.
Being a Black Pill, it's (probably) not a genuine STM32 ?
2025-01-07 04:27 AM
2025-01-07 04:31 AM
@PRenn.1 wrote:Well, how would I know?
Assume that it isn't!