I've got a couple of AVR's using their TWI interface to talk to each other.
ISSUE # 1 - In TWI1.png below, it has a stop/start, but in TWI2.png below, I did not get the stop? It is the same code run again and again.
case TWI_MTX_ADR_ACK: //0x18
case TWI_MTX_DATA_ACK: //0x28
//do we have more to send?
if (TWIPos<PROTOCOL_SIZE)
{
//yes, transmit byte
TWDR=RxBuffer[TWIPos++];
TWCR=_BV(TWEN) | _BV(TWIE) | _BV(TWINT);
}
else
{
//send stop
TWCR=_BV(TWEN) | _BV(TWINT) | _BV(TWSTO);
TWIState=TWISTATE_SENT;
}
break;
ISSUE # 2 - Also in TWI1.png I put a square around a glitch that shows up in many of the bytes sent to the slave. I don't think it affects anything, but is this when one device is turning off and allowing the other to ack/nak it? I see this tiny little glitch on many of the tx bytes. Actually it is on the RX bytes too. Happens during the fall of the clock though and I only think it is sampled on the rise.