This issue pertains to the STM official core for USB CDC Serial.
i'm not too sure if i'm the only one observing this or that it is rather common.
I've been seeing that usb (cdc) serial initially stalls could be into the 10s of seconds after a reset.
a test sketch is something like this
Code: Select all
#include <Arduino.h>
#include <USBSerial.h>
uint32_t begin;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin();
Serial.println("press space to begin");
while(1) {
if(Serial.available()) {
int16_t c = Serial.read();
if(c == ' ')
break;
}
}
while(Serial.available()) Serial.read();
begin = millis();
}
void loop() {
//echo the characters back
if(Serial.available()) {
int16_t c = Serial.read();
Serial.write(c);
if(c == '\r')
Serial.write('\n');
}
if(millis() - begin > 500) {
digitalToggle(LED_BUILTIN);
begin = millis();
}
asm("wfi");
}
a thing is serial (i.e. the virtual comm port) would stall/freeze, i'm using linux so that is /dev/ttyACM0
this did appear in dmesg
Code: Select all
[ 9685.396495] usb 3-4: new full-speed USB device number 14 using xhci_hcd
[ 9685.545724] usb 3-4: New USB device found, idVendor=0483, idProduct=5740
[ 9685.545726] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9685.545726] usb 3-4: Product: BLACKPILL_F401CC CDC in FS Mode
[ 9685.545727] usb 3-4: Manufacturer: STMicroelectronics
[ 9685.545727] usb 3-4: SerialNumber: 388236403135
[ 9685.546138] cdc_acm 3-4:1.0: ttyACM0: USB ACM device
and reports and error with the serial port.
https://www.putty.org/
this happens for some like at least 10 seconds or more after a reset.
in the above code, usb-serial is responsive after the connection is established. but the initial freeze tends to be irritating as it stalls for quite a while and connect fails.
the mcu board used is stm32f401ccu black pill. but that i observe similar on stm32f103 pill type boards