EmbeddedRelated.com
Forums

I2C problem with 24LC04

Started by acetoel January 15, 2005

hello... I have connected a 24LC04 to a LPC2106, used the library
SPI.ZIP that is in the section files. The VCC for the memory is 5V,
and the SCL and SDA were tided with 10K resistors to 5V (LPC Should be
5V tolerant). The SCL freq is 75KHz. Don't know why my program stops
when writing to the memory... any help, or consideration I must remember?
Perhaps somebody experienced something like this before...
Thanks
Ezequiel




An Engineer's Guide to the LPC2100 Series

I could suggest that you use I2C.zip. SPI and I2C are not the same
interface. :-)

Cheers,

Peter.
------------------------------
Web: www.homanndesigns.com
email:
Phone: +61 421 601 665
www.homanndesigns.com/DigiSpeedDeal.html - DC Spindle control
www.homanndesigns.com/TurboTaig.html - Taig Mill Upgrade board

acetoel wrote:
>
> hello... I have connected a 24LC04 to a LPC2106, used the library
> SPI.ZIP that is in the section files. The VCC for the memory is 5V,
> and the SCL and SDA were tided with 10K resistors to 5V (LPC Should be
> 5V tolerant). The SCL freq is 75KHz. Don't know why my program stops
> when writing to the memory... any help, or consideration I must remember?
> Perhaps somebody experienced something like this before...
> Thanks
> Ezequiel >
> Yahoo! Groups Links >
> .
>





Sorry... I was thinking about another thuing when writing the post. Of
course the driver I use is I2C.ZIP...
Still cannot make the program continue... I gets halted when writing
to the I2C EEPROM.
Ezequiel

--- In , Peter Homann <groups@h...> wrote:
> I could suggest that you use I2C.zip. SPI and I2C are not the same
> interface. :-)
>
> Cheers,
>
> Peter.
> ------------------------------
> Web: www.homanndesigns.com
> email: homann@h...
> Phone: +61 421 601 665
> www.homanndesigns.com/DigiSpeedDeal.html - DC Spindle control
> www.homanndesigns.com/TurboTaig.html - Taig Mill Upgrade board
>
> acetoel wrote:
> >
> > hello... I have connected a 24LC04 to a LPC2106, used the library
> > SPI.ZIP that is in the section files. The VCC for the memory is 5V,
> > and the SCL and SDA were tided with 10K resistors to 5V (LPC Should be
> > 5V tolerant). The SCL freq is 75KHz. Don't know why my program stops
> > when writing to the memory... any help, or consideration I must
remember?
> > Perhaps somebody experienced something like this before...
> > Thanks
> > Ezequiel
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > .
> >




Your problem is perhaps the most common one: You are rushing
to write data (the next byte) into EEPROM without waiting for
EEPROM to acknowledge that writing is done (of previous byte).
Your program has to wait till I2C writing sequence is done,
because write cycle takes some time. That "done" condition is
placed onto I2C bus by slave I2C device (in this case EEPROM)
and your program (the master) has to poll the bus in order to
sense that condition. That condition is called ACK (as of
"acknowledged"). If EEPROM cannot write for some reason, it
places NAK condition on the bus (as of "not acknowledged").
You are suppose to implement procedures to sense both conditions
in your program.
There is no other way to recognize the end of writing
condition except doing polling (as opposite of having interrupts),
so you have to implement polling sequence in your program where
writing the subsequent byte into EEPROM can occur only after
polling procedure has correctly recognized the "writing done"
(i.e. either ACK or NAK, where ACK means "writing was OK" and
"NAK" means "writing failed") condition on the I2C bus.
Since errant I2C condition could stall the bus, you may also
consider time-out implementation on the master side.

-- D.G.
--- In , "acetoel" <acetoel@y...> wrote:
>
> hello... I have connected a 24LC04 to a LPC2106, used the library
> SPI.ZIP that is in the section files. The VCC for the memory is 5V,
> and the SCL and SDA were tided with 10K resistors to 5V (LPC
Should be
> 5V tolerant). The SCL freq is 75KHz. Don't know why my program
stops
> when writing to the memory... any help, or consideration I must
remember?
> Perhaps somebody experienced something like this before...
> Thanks
> Ezequiel





Well.. I have tested the I2C memory with a PIC, and it's not working
either, so the problem is the memory...
Thanks very much
Ezequiel

--- In , "DG (dee-gee)" <dgacina@y...> wrote:
>
> Your problem is perhaps the most common one: You are rushing
> to write data (the next byte) into EEPROM without waiting for
> EEPROM to acknowledge that writing is done (of previous byte).
> Your program has to wait till I2C writing sequence is done,
> because write cycle takes some time. That "done" condition is
> placed onto I2C bus by slave I2C device (in this case EEPROM)
> and your program (the master) has to poll the bus in order to
> sense that condition. That condition is called ACK (as of
> "acknowledged"). If EEPROM cannot write for some reason, it
> places NAK condition on the bus (as of "not acknowledged").
> You are suppose to implement procedures to sense both conditions
> in your program.
> There is no other way to recognize the end of writing
> condition except doing polling (as opposite of having interrupts),
> so you have to implement polling sequence in your program where
> writing the subsequent byte into EEPROM can occur only after
> polling procedure has correctly recognized the "writing done"
> (i.e. either ACK or NAK, where ACK means "writing was OK" and
> "NAK" means "writing failed") condition on the I2C bus.
> Since errant I2C condition could stall the bus, you may also
> consider time-out implementation on the master side.
>
> -- D.G. >
> --- In , "acetoel" <acetoel@y...> wrote:
> >
> > hello... I have connected a 24LC04 to a LPC2106, used the library
> > SPI.ZIP that is in the section files. The VCC for the memory is 5V,
> > and the SCL and SDA were tided with 10K resistors to 5V (LPC
> Should be
> > 5V tolerant). The SCL freq is 75KHz. Don't know why my program
> stops
> > when writing to the memory... any help, or consideration I must
> remember?
> > Perhaps somebody experienced something like this before...
> > Thanks
> > Ezequiel




--- In , "acetoel" <acetoel@y...> wrote:
>
> hello... I have connected a 24LC04 to a LPC2106, used the library
> SPI.ZIP that is in the section files. The VCC for the memory is 5V,
> and the SCL and SDA were tided with 10K resistors to 5V (LPC Should be
> 5V tolerant). The SCL freq is 75KHz. Don't know why my program stops
> when writing to the memory... any help, or consideration I must
remember?
> Perhaps somebody experienced something like this before...
> Thanks
> Ezequiel

We had a simular problem with these parts we found that we could not
get it to write correctly with the 5v part fixed it by using the
24lC04W part which has a wider voltage tolerance of 3.3 - 5V may be
the same problem.