Interfacing AT24C16D using I2C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interfacing AT24C16D using I2C

Jump to solution
1,407 Views
shantanudhar
Contributor III

I am trying to interface AT24C16D EEPROM through I2C protocol with LPC1549. I am trying to use #LPCOpen. But, it seems, the LPC Open library for I2C Master is not compatible with #AT24C16D. I guess, it has been tested with LM75 whose addressing is different from AT24C16D. Does anyone have any sample piece of code of interfacing AT24C16D with #LPC1549 using LPC Open library ?

Note : When I tried twisting the LPC Open library code to make it work as per the data sheet of AT24C16D it didn't work and I was getting NACK_ADDR from the slave.

Any hint, any sample piece of code (using LPC Open) would be highly appreciable.

Labels (1)
1 Solution
1,020 Views
soledad
NXP Employee
NXP Employee

Hi,

Please check the below link, this may helps Reading and writing a 24LC32A eeprom memory using the LPCOpen framework for the LPC1549 chip | Siste... 


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
1,021 Views
soledad
NXP Employee
NXP Employee

Hi,

Please check the below link, this may helps Reading and writing a 24LC32A eeprom memory using the LPCOpen framework for the LPC1549 chip | Siste... 


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,020 Views
shantanudhar
Contributor III

It is working. Thanks Sol

0 Kudos
1,020 Views
shantanudhar
Contributor III

Thanks @soledad. I will try this link. But, I guess, the implementation in LPC Open differs in the following section:

Below is an excerpt from the AT24C16D data sheet (http://www.atmel.com/images/Atmel-8906-SEEPROM-AT24C16D-Datasheet.pdf )

5 Write Operations

All Write operations for the AT24C16D begin with the Master sending a Start condition, followed by a Device Address byte with the R/W bit set to ‘0’, and then by the Word Address byte. The data value(s) to be written to the device immediately follow the Word Address byte.

But, the way LPC Open handles a write operation is different and follows the datasheet of LM75 temperature sensor. So, I am in doubt if I can at all use LPC Open for handling AT24C16D.‌

Can anybody from the lpc1549‌ team help me to confirm if lpcopen v2.20 is compatible with AT24C16D eeprom ?

0 Kudos
1,020 Views
martin_maurer
Contributor III

Perhaps something like sending 1 or 2 byte addresses to the I2C device?

The mentioned AT24 device seems to have more than 255 bytes therefore needs two bytes to be sent to address the correct byte in device. But don't mix this address with I2C device address.

0 Kudos
1,020 Views
shantanudhar
Contributor III

Hi Martin,

       You got it right. Yes AT24C16D EEPROM has 2 bytes addressing mechanism. 1st byte defines the 4bit device ID which is fixed, 3 bit page ID and R/W bit. The next byte is the 8 bit address in the mentioned page ID. So, as mentioned in the spec, I wss sending the START bit first and then the 1st address byte and then 2nd. But, after the 1st address byte I am receiving NACK_ADR from the slave. I am wandering what wrong I did. 

0 Kudos