I’ve been trying to upload a simple blinking LED sketch, and to send something over the serial port (or rather USB port, emulating a COM port). The board is a “black pill”, containing an STM32f103C8T6. I measured the pull-up resistor located between D+ and VCC, and its value is 1.5 kOhm (this is often an issue with blue pill boards).
The LED blinks successfully. Both upload via STlink (clone) and DFU work (after flashing bootloader). However, after flashing the sketch, the USB device isn’t recognised anymore. An exclamation mark appears next to the device in device manager, stating “unknown usb device (device descriptor request failed)”.
I tested on two boards (from different vendors), and the issue is exactly the same. Can you guys provide me some help here?
Your real problem is the usb port is sketchy at best. It is terminated incorrectly and you are lucky anything worked up until now. I’m not bashing, but it is a frustrating design.
The solution is to get one of those little cheap st-link devices that connect to the pins at the opposite end of the usb port. It is seamless and you never have to change jumpers. It works in both PlatformIO or ArduinoIDE. No bootloader required.
I am already using an STlink (see first post). I want to use the usb port for serial communication (data logging etc.). Given that the two boards give exactly the same error mode, AND that upload over DFU works ok (i.e. the USB port works), I suspect something is wrong in the software implementation. For completeness, a log from USBview:
[Port1] FailedEnumeration : Unknown USB Device (Device Descriptor Request Failed)
Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 5
Companion Hub Symbolic Link Name: USB#ROOT_HUB30#4&1a49b3c3&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
Protocols Supported:
USB 1.1: yes
USB 2.0: yes
USB 3.0: no
---===>Device Information<===---
ConnectionStatus: FailedEnumeration
Current Config Value: 0x00 -> Device Bus Speed: Full (is not SuperSpeed or higher capable)
Device Address: 0x00
Open Pipes: 0
*!*ERROR: No open pipes!
===>Device Descriptor<===
*!*ERROR: bLength of 0 incorrect, should be 18
bLength: 0x00
bDescriptorType: 0x00
bcdUSB: 0x0000
bDeviceClass: 0x00
*!*ERROR: Device enumeration failure
How possible is it that there is no boot loader on the board? Your code may not include any usb initialization code. I believe the bluepill defaults the serial to pa9,10 (or what ever, I don’t remember anymore).
I’m new to STM development, so I’m fumbling my way around. Unfortunately, I ended up not saving the project. What happened is I ordered a “BlackPill” From Amazon, RoboDYN with the arduino bootloader. When it first arrived I was able to see it as a Serial device. I used BlackPill 128k as the board. I loaded some generic blink code, uploaded it and it stopped the bootloader from loading / recognizing the device on any computer and lsusb shows nothing. It used to blink the onboard LED when connected and that stopped, I’m assuming some kind of indicator that its accessing serial over USB. For now, I’m using a direct serial connection to program the board.
You know you have to put the board in boot loader mode to be able to program it via USB DFU? The bootloader pins (BOOT0 and BOOT1) control whether the bootlaoder (system memory) is executed, the firmware from Flash or RAM.