You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Serial loopback with USB virtual COM port is not working as Serial.available() returns 0 always.
To Reproduce
// Initialize the USB serial port
Serial.begin(9600);
pinMode(PC13, OUTPUT);
digitalWrite(PC13, HIGH);
while (!Serial);
Serial.println(F("USB Serial Initialised"));
}
void loop() {
// Check if any characters are available to read
if (Serial.available()) {
char ch = Serial.read(); // Read one character from serial buffer
Serial.print(ch); // Print the character back to serial monitor
}
}
Steps to reproduce the behavior:
Upload to blue pill board with either FTDI/Serial adapter or rogerclarke's bootloader
Open COM port of the blue pill board which appears on connecting the board via its USB port
Observe "USB Serial Initialised" to get printed but any character sent from serial monitor is not echoed back.
Expected behavior
"USB Serial Initialised" gets printed and whatever characters are entered in the serial monitor should echo back
Screenshots
Desktop (please complete the following information):
OS: Windows 10
Arduino IDE version: 2.1.0
STM32 core version: 2.6.0
Tools menu settings if not the default: Available in screenshot
Upload method: Tried STM32duino (Serial) and Maple bootloader 2.0
Additional context
I tried a bunch of things to narrow down the problem so that actual problem can be pin pointed
Uploaded CDC example code compiled on Keil microvision to test if windows drivers are correct: The board is able to transmit and receive data over USB and COM port driver seems to work fine.
Tested Serial library with Serial1 to test if hardware serial works: The Arduino sketch works with Serial1 as expected and board echos back the data sent over serial adapter to its UART1.
Tested the board with android device: CDC device is recognized and Serial USB Terminal app is able to connect to the COM port but as soon as a character is sent, the app hangs for a second and the COM port disconnects.
Printing Serial.available() returns 0 to Serial monitor no matter how many characters are sent.
The text was updated successfully, but these errors were encountered:
Hi @vibhoregit
I've tested with your sketch and my BluePill F103C8 and it works as expected. It fails only if it is large amount of data as stated in #1399.
Ensure you have a legacy mcu and a correct cable.
I am also able to reproduce this issue, even when the "SerialUSB" device is used.
Serial writes work, however serial reads do NOT work. No characters are ever available. I've tried both with USB being the generic serial, and with it NOT being generic serial.
Desktop (please complete the following information):
OS: MacOs
Arduino IDE version: 2.3.2
STM32 core version: 2.7.1
Tools menu settings if not the default: Available in screenshot
Upload method: ST-Link clone on HW port
I purchased some Blue pills and recently noticed too late that they contain STM32F103 clones, and exhibit this issue with Serial.available() in the Arduino core. I noticed that a workaround using Serial.read() == -1 would allow reads...
Describe the bug
Serial loopback with USB virtual COM port is not working as Serial.available() returns 0 always.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
"USB Serial Initialised" gets printed and whatever characters are entered in the serial monitor should echo back
Screenshots
Desktop (please complete the following information):
Board: Bluepill
Additional context
I tried a bunch of things to narrow down the problem so that actual problem can be pin pointed
The text was updated successfully, but these errors were encountered: