I am using LPC11C24 and there you need to call
Chip_SYSCTL_DeassertPeriphReset(RESET_I2C0);
in order to use I2C bus. Apparently peripherial is in reset state until you deassert it, it was frustrating experinece because there in no mention of this in examples.
xfer.slaveAddr = 0xd0; xfer.rxBuff =rx; xfer.rxSz = 1; tx[0] = 0x01; xfer.txSz = 1; xfer.txBuff =tx; xfer.slaveAddr=0xd0; xfer.rxBuff = rx; xfer.rxSz = 2; Chip_I2C_MasterSend(i2cDev, xfer.slaveAddr, xfer.txBuff, xfer.txSz); Chip_I2C_MasterRead(i2cDev, xfer.slaveAddr, xfer.rxBuff, xfer.rxSz); |
i2c_start(); i2c_write(ex_e2_add); //i2c address of 24cxx series i2c_write(addressh); //for extenal e2prom (24c512) {heigh byte of addres} i2c_write(addressl); //low byte of address i2c_start(); i2c_write(ex_e2_add|0x01); //low byte of address + one bcc=i2c_read(0); i2c_stop(); |