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

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

Re: [avr-gcc-list] TWI hardware hangup issue


From: Christian Ludlam
Subject: Re: [avr-gcc-list] TWI hardware hangup issue
Date: Wed, 18 Feb 2004 10:13:33 GMT
User-agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.03) POPstar/2.05

On 18 Feb Robert Conger wrote:

>   I wrote a TWI interface for the atmega8 uC. I have four of them on a
> board with one attached to a line-driver for rs232 output. I found that I
> can transmit only once on the TWI before there is an error somewhere in the
> hardware and software. When I took a scope to the SCL and SDA lines I found
> that the Master Transmitter was transmitting as many bytes as it pleased
> for the first transmission but would only get to the start command during
> the second tranmission. After debugging with the onboard LEDs I found that
> the Master Transmitter would issue a start command but then never continue
> with the transmission. I'm using the interrupt driven approach to using the
> TWI and it's just a few switch statements and a control structure.

>   I look around on the list and found someone with a similar problem, but,
> it wasn't remedied as far as I could tell. In that instance, several bytes
> were being transmitted as individual transmissions and it would hang-up on
> the second attempt to send. Looking further I found that the datasheet
> lists two possible error conditions on the bus that could cause the
> hardware to fall into a non-active state, but, upon testing I found that
> those states were not occuring.

>   Is there anything that needs to be done to the TWI registers between
> transmissions? I just had the control register default to having the
> TWEN,TWIE,and TWEA bits set. The execution is cyclic so the exact same
> settings are used in the first transmission as the second, yet the TWI
> fails. Any advice for such a problem?

I had a similar problem with a Mega163, and found that disabling the TWI
between transmissions helped, ie. clear the TWEN bit after sending the STOP
condition, then set it just before the next START.

HTH,

-- 
Christian Ludlam
address@hidden

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

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