Tutorials

How Long Can an RP2040 UART RX Interrupt Wait at 115200 Baud?

Published · Updated

Increasing the software receive queue helps only after bytes have left the UART hardware. A short interrupt blackout can still overflow the hardware FIFO before the queue gets a chance to accept a byte.

Budget the empty FIFO entries at the instant service is delayed

Eight-channel USB logic analyser. For a digital timing capture, check the analyser sample rate, input threshold and the ground path for the signal in question.
Eight-channel USB logic analyser. For a digital timing capture, check the analyser sample rate, input threshold and the ground path for the signal in question. Dilshan Jayakody from Maharagama, Sri Lanka (Wikimedia Commons), CC BY-SA 2.0. Site-sized copy.

On the RP2040 UART, confirm FIFO mode and the receive interrupt trigger level. Use the number of entries still available at the start of the delay. A byte already in the shifter and an ongoing frame make the exact phase uncertain.

Also check whether the transmitter can send continuously, whether flow control is wired, and when the software can actually drain the FIFO. ISR entry alone does not remove any data.

Calculate asynchronous baud rate error · Budget FIFO capacity during a service stall

Convert spare entries into a maximum contiguous delay

8N1 frame / 10 / 115,200 / 86.8 µs per byte; 16 spare entries / 16 × 86.8 µs / 1.39 ms; 2 ms unserviced / 2 ms / 86.8 µs / About 23 byte times
Assumption / Calculation / Result.

A continuous 115200-baud link using one start bit, eight data bits, no parity and one stop bit occupies ten bit times per byte. That gives roughly 86.8 µs per received byte. If sixteen entries remain available, sixteen arriving bytes occupy about 1.39 ms.

A 2 ms critical section can exceed that allowance. Leave margin for a partially received frame and scheduling jitter. Exercise the receiver with a continuously numbered pattern and record both the UART overrun indication and gaps in the application sequence.

Will a larger software queue fix repeated UART overrun errors?

Only if the software queue is the limiting stage. Shorten the hardware service gap, use an appropriate DMA configuration or arrange end-to-end hardware flow control when the UART FIFO overflows first.

Replay the worked example8N1 frame / 10 / 115,200 / 86.8 µs per byte; 16 spare entries / 16 × 86.8 µs / 1.39 ms; 2 ms unserviced / 2 ms / 86.8 µs / About 23 byte times
  1. 8N1 frame · 10 / 115,200 · 86.8 µs per byte
  2. 16 spare entries · 16 × 86.8 µs · 1.39 ms
  3. 2 ms unserviced · 2 ms / 86.8 µs · About 23 byte times

Separate throughput from transaction latency · Capture the first rejected FIFO write

Work through a sensor FIFO watermark.

Raspberry Pi RP2040 Datasheet, 4.2 UART.

Photograph credit and licence

Dilshan Jayakody from Maharagama, Sri Lanka (Wikimedia Commons), CC BY-SA 2.0. Site-sized copy.

Original photograph https://commons.wikimedia.org/wiki/File:8_Channel_USB_logic_analyzer_(5172098012).jpg

Licence https://creativecommons.org/licenses/by-sa/2.0

Back to Tutorials

Related evidence and next tasks

Continue the task with the relevant source scope. These reading paths do not establish interchangeability or current supply.

Source addresses and citation trail

Full source addresses are retained below. Read each citation with its document revision, page, table and applicability conditions above.

  1. https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#page=406