[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] TWI interface on Atmega16

From: Bjarne Laursen
Subject: Re: [avr-gcc-list] TWI interface on Atmega16
Date: Wed, 24 Sep 2003 13:32:32 +0200

At 13:01 24-09-2003, you wrote:
The situation is as follows: one Atmega is a transmitting master, the other a receiving slave. The master sends a START condition, then waits for TWINT, sends SLA+W, waits, sends BYTE, waits and finally sends a STOP. The receiver is set in RS mode and waits for TWINT (address and ACK are received), sets TWINT to 1 and waits again. After the wait the data is in the TWDR register.

The receiver should get a interupt for the stopcondition as well. Unfortunely, until this is handled, the receiver will not respond to it's SLA (and not hold clk to force wait). One way to avoid this is to not let the slavetransmitter acknowledge the last byte. Then the TWI will return to unadressed mode and not get an interrupt for the stopcondition. Also remember to handle the bus-error interrupt.

The master does this in a loop, incrementing the sent byte every cycle. The weird thing is that it only works the first cycle. When the master wants to send the second byte, it waits forever for TWINT after issuing the START condition.
Have you consideret to send more than one byte in each transfer?

-Bjarne Laursen, RoseTechnology

reply via email to

[Prev in Thread] Current Thread [Next in Thread]