I can not seem to get USB serial [USB CDC] working on either a STM 32 Bluepill or Nucleo F767ZI. I can get the USB CDC to workly using the STCUBEMX and TrueStudio tool chain on both devices but not under arduino ststm32. I have tried with latest standard STM32 package and the developmental package on GIT [changing the platform = line].
I have added build flags in Platformio.ini (for the Nucleo F767ZI):
I get the same results with/without these flags, when I plug in the USB, I get no response on the windows PC with the Nucleo board and a USB device unrecognized error on BluePill.
I am not sure what I am missing here. Can someone help me out?
I will also add that using the Arduino IDE, I immediately got the Serial over USB [USB CDC] to work on the STM32 Bluepill. How do I get this to work under the PlatformIO IDE?
PlatformIOâs build script for activating USB serial support seems really broken right now. Itâs missnig needed flags like USBD_VID, USB_MANUFACTURER, USB_PRODUCT, USBCON and HAL_PCD_MODULE_ENABLED.
Regarding high-speed (HS) mode: The bluepill only supports the lesser Full-Speeed (FS) standard. Activating PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED will cause it to try HS which it doesnât have, and PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMODE will cause it to put its HS peripheral into FS mode, which it doesnât even have in the first place, so both macros must be omitted.
Can you test on your bluepill if this works? Baud rate for the CDC should be 115200.
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
build_flags =
; enable USB serial
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
; QUIRK: without setting this, no
; data will be received on the serial USB port
; https://github.com/stm32duino/Arduino_Core_STM32/issues/1193
monitor_dtr = 1
; optional: set COM port to monitor here if there are multiple
;monitor_port= COM27
EDIT October 2020: Added USBD_PID. Also: Using the dev-platform is not required anymore, you can write platform = ststm32 instead.
The same problem seem to appear when using the original âRoger Melbourneâ (derived from leaflabs)-core.
When using this in platformio.ini:
board_build.core = maple
the same thing seems to happen. The bluepillâs USB does not change from âbootloaderâ to âserial portâ.
A funny detail: if you disable the libUSB device (maple 003) in the device manager and reactivate it after that, then the board activates the virtual serial port.
Hi,
thank you, the solution is working. However, there is still a problem.
I am programming a bluepill, and stlink for upload and debug.
If I upload the code, the usb virtual serial port is working.
If I start a debug session, no serial port in the Device Manager, but an unknown usb device instead. So the serial monitor is not working.
I suspect itâs because the debugger stops the uC before proper enumeration.
A workaround:
start running the code in the debugger
disconnect the boardâs usb, and reconnect it, now the virtual usb port appears in the Device Manager
restart the serial monitor in PIO
stop the uC with a breakpoint
now both debugging and serial is working
While itâs working, not really comfortable. Is there a better way?
Great
I really struggled to make the USB serial monitor work on my BLACKPILL_F411CE work.
I was able to restore the serial monitor by slightly modifying the platformio.ini as follows:
However, as the saying goes, âDonât give me a fish, but rather teach me how to fishâ,
How do we go about finding the solution to this problem? which documentation if any shall we refer to?
Notice that I am using F401cc board configuration for the F411ce, and that is because the Blackpill_411 board is not yet available in the platformio boards list.
How do we know whether platformio is working on the Bloackpill_F411 board?
Hi , i have some problem with PIO USB serial Programming . after change boot loader i can just programing with Arduino IDE , here is my board configuration . and all the time i have some error
I started recently to use stm32duino and platformio for fast prototyping on small projects.
This solution allowed me add USB/serial support on my devices.
IMPORTANT NOTE: To receive data on PC I needed to enable DTR signal (Data Terminal Ready). Handshaking (flow control) does not need to be activated.
Hi there, Iâm trying to get serial monitor communication with blackpill stm32f411 via the USB cable, but I donât know how to proceed, is there a âhow toâ guide for that?
this is my current platformio.ini: