Searching \ for '[AVR]: More TWI problem info' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'More TWI problem info'.

Exact match. Not showing close matches.
PICList Thread
'[AVR]: More TWI problem info'
2003\06\14@202501 by Sean Breheny

face picon face
Hi all,

I have a bit more info on the problem I'm having with using TWI on an

I have two ATmega128s talking via TWI. One is always master, the other
always slave. There are no other devices on the bus.

The master occasionally "locks up". It does so right after you command a
stop condition after completing a master receive operation. When I say
"locks up" I do not mean that the process stops running code (it is still
running code) but rather that the TWI interface seems to stop working.
That is, it never finishes the stop command (the TWSTO bit stays high and
the SDA line stays low). This happens even without the slave connected
(so the slave is not the one pulling the SDA line low).

Also strange is that I have a JTAG ICE and when
I use it to debug the problem, the following happens:

I have a loop after I command the STOP operation where I wait for the
TWSTO bit to go low (indicating that the STOP operation is completed).
When I use the ICE to break the processor during the TWI malfunction, and
then inspect the TWCR, I see that TWSTO is set and TWWC is clear. If I
then single step once, the TWWC bit goes high. I have a breakpoint on my
TWI interrupt routine so I can make sure that no TWI interrupt happens
during that single step and it doesn't, so there should be no part of my
code that could be writing to the TWDR during that step, which, as I
understand, is the only way that TWWC should be able to go from clear to set.

Any ideas? I've spent the whole day on this and I'm beginning to get
desperate :-) My next step is to try another board in case there is a
hardware problem. Luckily, I have another board to try.


-- Going offline? Don't AutoReply us!
email with SET PICList DIGEST in the body

2003\06\16@023730 by hael Rigby-Jones

picon face
{Quote hidden}

Do you have the correct value pullups on the master?


This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
Any questions about Bookham's E-Mail service should be directed to

-- hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\16@104950 by Sean H. Breheny

face picon face
Hi Mike,

I have 2.2k resistors to 5V(Vdd) from both the SDA and SCL lines right next
to the master. I did originally have 1k resistors but then I found out that
this just barely violated a 3mA max pull-down current spec for the
ATmega128's TWI module, so I switched them to 2.2k with no change in operation.

I have since "fixed" the problem by having a time-out on the loop that
waits for the transfer to complete and having my code reset the TWI after
each transfer. However, once every few thousand transfers, I still get the
wrong value (which may or may not be the same problem, I'll have to look
into it further).


At 07:37 AM 6/16/2003 +0100, you wrote:
>Do you have the correct value pullups on the master?

-- hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...