Searching \ for '[PIC]: I2C, Restart vs Start' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/i2cs.htm?key=i2c
Search entire site for: 'I2C, Restart vs Start'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: I2C, Restart vs Start'
2003\04\12@203304 by Edward Cooper

picon face
Hi

If someone could help me here, I'm trying to get I2C up and running
using a 24LC256 and a 16F877, I've put some code together mainly
chopped bits of other peoples code!  However it doesn't work, when I
read the data back from the EEPROM all I get is 1's, now in the data
sheet when reading you are meant to issue a start command send the
control byte address high and low byte and then issue another start.
It won't let me do this (it gets stuck) so I issue a restart instead
however this doesn't seem to work.

Basically Im asking what is the difference between these two different
commands!?

Thanks for any help

Ed Cooper

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

2003\04\13@043748 by Ian Forse

flavicon
face
Ed,

Have you got pull up resistors on the I2C lines.  I spent a weekend with a
similar problem which was fixed when I changed the pullups from 10K to 820R.

Ian

> {Original Message removed}

2003\04\13@073956 by Olin Lathrop

face picon face
> If someone could help me here, I'm trying to get I2C up and running
> using a 24LC256 and a 16F877, I've put some code together mainly
> chopped bits of other peoples code!  However it doesn't work, when I
> read the data back from the EEPROM all I get is 1's,

Are you getting an ACK from the address byte?  Probably not, in which case
you need to fix that first.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\04\13@080250 by Olin Lathrop

face picon face
> Have you got pull up resistors on the I2C lines.  I spent a weekend with a
> similar problem which was fixed when I changed the pullups from 10K to
> 820R.

820 ohms is a violation of the IIC spec unless you are using an unusually
low bus voltage.  1.8Kohms is about the minimum legal pullup on a 5V IIC
bus.

By the way, the IIC bus should work with 10Kohm pullup although you will
have to adjust the speed accordingly.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\04\13@125613 by Ian Forse
flavicon
face
This depends on line capacitance.  820R allows for 400pF of capacitance in
Philips I2C spec.  Although on a pcb at work we have a 10K pull which works
fine.


> {Original Message removed}

2003\04\13@154856 by Herbert Graf

flavicon
face
> This depends on line capacitance.  820R allows for 400pF of capacitance in
> Philips I2C spec.  Although on a pcb at work we have a 10K pull
> which works
> fine.

       I believe the limitation in the spec that Olin is referring to is sink
current. That's why 820R would be OK at a lower bus voltage. TTYL

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\04\14@081444 by Francisco Ares

flavicon
face
I've had some problems like this. Reading the I2C spec of the 24xxx
EEPROM, I noticed that you cannot read the recently stored value
immediately after a write cycle to the E2PROM, you have to keep sending
its address over the I2C buss until it signals an ACK, then it is ready
for another operation (it can accept a burst write, it has a buffer -
don't remember its size - so you may send several bytes at once, but
you'll have to wait much more time till it gets available again).

I have also noticed that the ACK is very important to get to know if the
EEPROM is really "understanding" what was sent to it, so if you get a
NOACK, send the data again.

Edward Cooper wrote:

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\04\14@221538 by Barry Gershenfeld

face picon face
>when I read the data back from the EEPROM all I get is 1's

Despite a lot of talk about the bus, if you get all 1's then
you are reading 1's from the data line and so it really
is in a high state.   So you best bet is to check for the
ack like the others have said.

>sheet when reading you are meant to issue a start command send the
>control byte address high and low byte and then issue another start.
>It won't let me do this (it gets stuck)

Does it get stuck at the control byte high, low, or at the "another
start"?  It make a difference...I'll bet you get stuck in
a "read", which you didn't mention.

>so I issue a restart instead however this doesn't seem to work.
>Basically Im asking what is the difference between these two different
>commands!?
>Ed Cooper

I noticed no one answered your question.  There is no actual command
called a restart.  There is one called a repeated start.   You
have two choices:
- you can issue a STOP followed (real quick) by a START
- you issue a START by itself. This is the Repeated Start.

The intent is that you can keep talking to your device without
anything else getting control of the i2c bus.  Note that you
send the device address again (in order to switch from write
to read) after the START.

By repeating the start, you get to resend the address and since
nobody saw a STOP they are still waiting their turn on the bus.
I believe this is the right way.  I say this because I saw
a paper that stated the STOP/START was the way to do it. I think
the "real quick" qualification constitutes wishful thinking
and that it's really asking for a race condition.

In the end, it is the slave chip that determines what will work
and what will not; if they don't follow the spec (or interpret
it differently) then they would have to be programmed in a
"different" manner.

I suspect the EEPROM would work with either method; I wrote
some code using a Repeated start and that worked fine in
my case.   Verify that ACK.

Barry

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\04\15@094023 by Olin Lathrop

face picon face
> The intent is that you can keep talking to your device without
> anything else getting control of the i2c bus.

Correct, but note that this doesn't matter in a single master system.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body

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