ArduinoCore-renesas icon indicating copy to clipboard operation
ArduinoCore-renesas copied to clipboard

`Serial[x].flush()` does not wait until transmission is finished

Open TNobuhara opened this issue 2 years ago • 1 comments

Using Serial1.flush() In flush() of ArduinoUnoR3 waited until the transmission was completely finished. When I tried R4, it seemed to exit as soon as the Tx buffer was empty.

Please tell me what to do. Or is it possible to fix it?

TNobuhara avatar Oct 05 '23 01:10 TNobuhara

Serial on the R4 doesn't currently use the txBuffer at all. Serial.write is blocking by itself which makes 'flush' redundant. I've submitted PR #304 to modify the UART class to use the buffer and not to block. This by itself restores the function of flush. It will still block until the buffer is empty, but the buffer won't be empty until the transmission end interrupt at the end of the transmission.

delta-G avatar May 06 '24 23:05 delta-G

Closing as fixed by https://github.com/arduino/ArduinoCore-renesas/pull/405

per1234 avatar Nov 30 '24 10:11 per1234