From fb53c2c0a83761506f446dd3602e7d8fbad25ec1 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Mon, 4 Oct 2010 15:51:55 +0200 Subject: [PATCH] serial.c: make sure to read incoming characters even if we don't have space to store them. --- serial.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/serial.c b/serial.c index 1db39af..9f75128 100644 --- a/serial.c +++ b/serial.c @@ -82,6 +82,12 @@ ISR(USART0_RX_vect) { if (buf_canwrite(rx)) buf_push(rx, UDR0); + else { + uint8_t trash; + + // not reading the character makes the interrupt logic to swamp us with retries, so better read it and throw it away + trash = UDR0; + } } #ifdef USART_UDRE_vect