LPC546xx I2C eeprom driver example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC546xx I2C eeprom driver example

跳至解决方案
1,970 次查看
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

标签 (2)
0 项奖励
回复
1 解答
1,886 次查看
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.

 

在原帖中查看解决方案

5 回复数
1,892 次查看
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 项奖励
回复
1,961 次查看
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,957 次查看
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 项奖励
回复
1,887 次查看
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.

 

1,947 次查看
giraffe508
Contributor IV
0 项奖励
回复