From 301121cce45e4db4c1d0e66d16dc42cb1246e36b Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Sat, 16 Aug 2014 15:15:58 +0200 Subject: [PATCH] twi: Clear TWSTO bit after STOP condition transmitted > This change fixes a problem where a TWI driver polling the TWSTO bit would run on the real device but not simavr. > More detail in for example p188 of the ATMega32A datasheet (rev 815D-AVR-10/2013). --- simavr/sim/avr_twi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/simavr/sim/avr_twi.c b/simavr/sim/avr_twi.c index 808da9d..663357e 100644 --- a/simavr/sim/avr_twi.c +++ b/simavr/sim/avr_twi.c @@ -182,6 +182,7 @@ avr_twi_write( if (p->state & TWI_COND_START) { avr_raise_irq(p->io.irq + TWI_IRQ_OUTPUT, avr_twi_irq_msg(TWI_COND_STOP, p->peer_addr, 1)); + avr_regbit_clear(avr, p->twsto); } } p->state = 0; -- 2.39.5