[Top][All Lists]

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

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

From: Christian Ludlam
Subject: Re: [avr-gcc-list] TWI interface on Atmega16
Date: Wed, 24 Sep 2003 12:20:33 +0100
User-agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.03) POPstar/2.05

On 24 Sep Bart Friederichs wrote:

> I have some problems programming the TWI interface on two Atmega16's.
> 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 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.

I found something similar with a Mega163, and the errata for this device
states that there are conditions where the TWI can lock up, never generating
any signals on the bus, until the device is reset.

I found disabling the TWI (clearing TWEN) between sending the previous STOP
and the next START helped with this.

Christian Ludlam

reply via email to

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