diff --git a/cores/rp2040/SerialPIO.cpp b/cores/rp2040/SerialPIO.cpp index 32af295ac..ddd9b0a7f 100644 --- a/cores/rp2040/SerialPIO.cpp +++ b/cores/rp2040/SerialPIO.cpp @@ -338,7 +338,7 @@ int SerialPIO::available() { if (!_running || !m || (_rx == NOPIN)) { return 0; } - return (_writer - _reader) % _fifoSize; + return (_fifoSize + _writer - _reader) % _fifoSize; } int SerialPIO::availableForWrite() {