I'm trying to hook up a 2-wire connection using the method on page 183 in the mega 16 data sheet. (Setting/clearing and polling the TWINT bit.) I get some very strange results that I hope you can help me with. Anybody seen this kind of behaviour before?
I have to send a start condition, device address with r/w bit, a local address, and finally the data byte and stop condition. In my code, a failed packet results in a warning message, not a halted transmission.
I can see all clocks and signals when there is nothing connected to the mega16. There are no ACKs. Then, when I connect my slave 2-wire unit, it ACKs the device address like it should, but the MCU doesn't send the local address! There is no action on neither SDA or SCL. The MCU seems to be pulling them low.
The even weirder thing is that if I set up the slave to listen to another device address (i.e. present but not ACKing), the MCU is able to clock out all packets while reporting errors.