LPC11C24 i2c

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

LPC11C24 i2c

1,103 Views
vnv
Contributor II

hi,

I use the LPC11C24 i2c and AT24C16 communication,I am using NXP official example.as follew:

/* Master tx only */
int Chip_I2C_MasterSend(I2C_ID_T id, uint8_t slaveAddr, const uint8_t *buff, uint8_t len)
{
I2C_XFER_T xfer = {0};
xfer.slaveAddr = slaveAddr;
xfer.txBuff = buff;
xfer.txSz = len;
while (Chip_I2C_MasterTransfer(id, &xfer) == I2C_STATUS_ARBLOST) {}
return len - xfer.txSz;
}

/* Sequential master read */
int Chip_I2C_MasterRead(I2C_ID_T id, uint8_t slaveAddr, uint8_t *buff, int len)
{
I2C_XFER_T xfer = {0};
xfer.slaveAddr = slaveAddr;
xfer.rxBuff = buff;
xfer.rxSz = len;
while (Chip_I2C_MasterTransfer(id, &xfer) == I2C_STATUS_ARBLOST) {}
return len - xfer.rxSz;
}

  • This wrapper function is not provided from the slave device register address,Only the slave hardware address is provided(uint8_t slaveAddr,),Causing read and write errors. How can I do the right to read and write?I do not know how to control the register address.Who can give me some advice?

Who can give me some examples of reading and writing?

Labels (1)
0 Kudos
1 Reply

593 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi VN V,

   I don't have the LPC11C24 I2C code for AT24C16 directly.

   But we have some I2C code for PCF8594, I think you can refer to it.

   Please download the code from this link:

1. MDK  project

Sample Code Bundle for LPC11xx Peripherals using Keil's MDK-ARM | www.LPCware.com 

2. LPCxpresso IDE project

Sample Code Bundle for LPC11xx Peripherals using NXP LPCXpresso | www.LPCware.com 

Please download the code, and refer to lpc11xx.keil-examples-CMSIS-update_2\lpc11xx.keil-examples-CMSIS-update\ADC

There has the I2C write and read code.

With it helps you!


Have a great day,
Kerry

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

0 Kudos