Wio terminal serial.flush() blocking

Hi everybody, I’m struggling on calling Serial1.flush() (the physical uart located on pins 8 and 10) because the flush() method locks the sketch forever.

I’ve found the same bug on arduino’s forum (https://github.com/arduino/ArduinoCore-samd/issues/597) but I don’t know how to solve it on wio terminal.

IDE is arduino IDE 1.8.17, board manager’s version is 1.8.2


As early as September 6, 2021, arduino officially released some instructions on modifying Serial.flush(). For related documents, you can refer to the following two links:

If you look at the older version of the Arduino textbook, you will usually write Serial.flush() to clear the serial buffer. But since Arduino 1.0, the meaning of this command has changed. If you still need to clear the serial port buffer, you can use: while(Serial.read() >= 0) instead.

“The Serial.flush() command has been repurposed to wait for outgoing data to be transmitted, rather than dropping received incoming data.”

Hi Citric, thanks for your answer.

I confirm that I’m using flush() to wait for transmission end and not to empty the receive buffer.

The document you pointed solves a slighlty different problem (Serial.flush() returns before last character is transmitted) while if I call flush() method my application gets blocked forever.

The only effective solution I found was to comment out flush() and add a delay() but it’s only a workaround.