From: Doug Szumski Date: Sat, 16 Aug 2014 13:15:58 +0000 (+0200) Subject: twi: Clear TWSTO bit after STOP condition transmitted X-Git-Tag: v1.3~73^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=301121cce45e4db4c1d0e66d16dc42cb1246e36b;p=sx%2Fsimavr.git 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). --- 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;