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 lpc2000@yahoogroups.com, "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
Message
Re: I2C problem with 24LC04
2005-01-16 by DG (dee-gee)
Attachments
- No local attachments were found for this message.