From 8467783d44dc5b36a7b1fcb8c70403238f41ce1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philip=20=C3=85kesson?= Date: Mon, 28 Nov 2016 16:02:02 +0100 Subject: [PATCH] Workaround for UART issues when polling in some cases Clear interrupt instead of just the rxc bit --- simavr/sim/avr_uart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simavr/sim/avr_uart.c b/simavr/sim/avr_uart.c index 0fff236..2a69c16 100644 --- a/simavr/sim/avr_uart.c +++ b/simavr/sim/avr_uart.c @@ -98,8 +98,9 @@ static uint8_t avr_uart_read(struct avr_t * avr, avr_io_addr_t addr, void * para { avr_uart_t * p = (avr_uart_t *)param; - // clear the rxc bit in case the code is using polling - avr_regbit_clear(avr, p->rxc.raised); + // clear the rxc interrupt in case the code is using polling + uint8_t rxc = avr_regbit_get(avr, p->rxc.raised); + avr_clear_interrupt_if(avr, &p->rxc, rxc); if (!avr_regbit_get(avr, p->rxen)) { avr->data[addr] = 0; -- 2.39.5