AnsweredAssumed Answered

LPC11C24   i2c

Question asked by N V on May 10, 2017
Latest reply on May 12, 2017 by Kerry Zhou

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?

Outcomes