[Top][All Lists]

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

Re: [avr-gcc-list] TWI interrupt problem

From: Geoffrey Wossum
Subject: Re: [avr-gcc-list] TWI interrupt problem
Date: Wed, 26 Mar 2003 08:59:28 -0600
User-agent: KMail/1.5

On Tuesday 25 March 2003 07:39 pm, Andreas Trenkwalder wrote:


You need to handle as many of the TWSTA conditions as possible in your ISR.  
One of the most important is when TWSTA == 0x00, in which case you MUST write 
the TWSTO bit in TWCR, along with anything else like TWINT and TWEA you need.  
0x00 indicates a bus error, and you must write the stop bit to reset the 
hardware.  My experience is that I always get this bus error when I first 
enable the TWI hardware.  Also, your ISR disables the TWI (doesn't keep TWEN 

However, you should get at least one interrupt, the one for the bus error.  
Check your fuses, and make sure the ATmega103 compatibility bit is not set.  
If you're in 103 compatibility mode, the TWI hardware won't function.  
ATmega128's ship with this bit set.  You might also write the TWINT bit when 
you assert the start condition.  I do it in my code, maybe that makes a 

Geoffrey Wossum
Software Engineer
Long Range Systems - http://www.pager.net

reply via email to

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