avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] TWI interface on Atmega16


From: Bart Friederichs
Subject: [avr-gcc-list] TWI interface on Atmega16
Date: Wed, 24 Sep 2003 13:01:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Hi,

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.

Could someone help me with this?
TIA
Bart

PS
The according files are attached; libtwi.c is where all TWI code is.


reply via email to

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