LPC546xx I2C eeprom driver example

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

LPC546xx I2C eeprom driver example

Jump to solution
1,106 Views
cybaluke
Contributor III

Hi,

is there any full software driver example for a I2C external EEPROM (i.e. 24xx512 or 24xxM01) for the LPC546xx family?

(I'm working with MCUXpresso and its SDK - baremetal examples)

Maybe I'm wrong but in the SDK I can find only internal  eeprom examples...

thanks

Labels (2)
0 Kudos
1 Solution
1,022 Views
frank_m
Senior Contributor III

I think mentioned SDK EEPROM examples are related to an EEPROM emulation, using internal Flash.
Which is not based upon I2C in any way.

I would suggest to use other examples for the 24xx serial EEPROM, and combine them with an I2C example from the SDK.
More or less as poster giraffe508 suggested.
You will still need to implement the specific protocol, i.e. transfer sequences.

And I highly recommend the use of a scope or logic analyzer.

 

View solution in original post

5 Replies
1,028 Views
CarlosGarabito
NXP TechSupport
NXP TechSupport

We have this document that can help you to develop the code you are looking for with the following memories https://www.nxp.com/docs/en/application-note/AN13165.pdf

0 Kudos
1,097 Views
giraffe508
Contributor IV

Hi There, You are correct that the SDK examples are primarily focused on the internal EEPROM. However, you can easily adapt the I2C examples provided in the SDK to communicate with an external EEPROM like the 24xx512 or 24xxM01.

First, make sure you have the latest SDK for the LPC546xx family.

Once you have the SDK installed, you can find the I2C examples under the following path:

SDK_2.x_LPC546xx\\boards\\lpcxpresso546xx\\driver_examples\\i2c

These examples demonstrate how to use the I2C driver to communicate with I2C devices. You can use them as a starting point for your external EEPROM implementation. You will need to modify the example code to include the specific commands and address format required by your EEPROM device.

For instance, to write data to the 24xx512 EEPROM, you would need to send the following sequence:

 1. Start condition 2. Device address with write bit 3. Memory address (high byte) 4. Memory address (low byte) 5. Data to be written 6. Stop condition 

Similarly, to read data from the EEPROM, you would need to send the following sequence:

 1. Start condition 2. Device address with write bit 3. Memory address (high byte) 4. Memory address (low byte) 5. Repeated start condition 6. Device address with read bit 7. Read data 8. Stop condition 

Make sure to consult the datasheet of your specific EEPROM device for the correct commands and address format.

I hope this helps you get started with your I2C EEPROM implementation on the LPC546xx family. If you have any further questions, please feel free to ask.

Kind Regards, 

1,093 Views
cybaluke
Contributor III

Thanks for your answer, ...but what I was asking for is just an example code of how to use the SDK api for the eeprom used and redirected to control an external I2C eeprom (if it is possible)... is there any good example code for lpc54xxx or any is there any good GitHub code available?

0 Kudos
1,023 Views
frank_m
Senior Contributor III

I think mentioned SDK EEPROM examples are related to an EEPROM emulation, using internal Flash.
Which is not based upon I2C in any way.

I would suggest to use other examples for the 24xx serial EEPROM, and combine them with an I2C example from the SDK.
More or less as poster giraffe508 suggested.
You will still need to implement the specific protocol, i.e. transfer sequences.

And I highly recommend the use of a scope or logic analyzer.