lpcware

[solved] Problem with I2C example from LPCopen with LPCXpresso 1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by mos87 on Mon Apr 18 08:27:56 MST 2016
Hello,

im owning an LPCXpresso 1769 board and want to access the 24LC64 EEPROM who is also at the board.
The EEPROM is connected to I2C1 at the Pins P0.19 and P0.20.

How I see it I should be able too access the EEPROM via I2C without any hardware changes.

I was trying the run the periph_i2c example from the LPCopen V2.10 to learn how to use the lib.

In the example I disabled the initialization of I2C0 and the virtual Slaves and wanted to check all Bus devices with the i2c_probe_slaves() function.


static void i2c_probe_slaves(I2C_ID_T i2c)
{
int i;
uint8_t ch[2];

DEBUGOUT("Probing available I2C devices...\r\n");
DEBUGOUT("\r\n     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
DEBUGOUT("\r\n====================================================");
for (i = 0; i <= 0x7F; i++) {
if (!(i & 0x0F)) DEBUGOUT("\r\n%02X  ", i >> 4);
if (i <= 7 || i > 0x78) {
DEBUGOUT("   ");
continue;
}
/* Address 0x48 points to LM75AIM device which needs 2 bytes be read */
if(Chip_I2C_MasterRead(i2c, i, ch, 1 + (i == 0x48)) > 0)
DEBUGOUT(" %02X", i);
else
DEBUGOUT(" --");
}
DEBUGOUT("\r\n");
}


The problem is now that at the Chip_I2C_MasterRead() the programm blocks and dont do anything.
The real blocking is little deeper in the Chip_I2C_EventHandler(). The status stay always at I2C_STATUS_BUSY.


void Chip_I2C_EventHandler(I2C_ID_T id, I2C_EVENT_T event)
{
struct i2c_interface *iic = &i2c[id];
volatile I2C_STATUS_T *stat;

/* Only WAIT event needs to be handled */
if (event != I2C_EVENT_WAIT) {
return;
}

stat = &iic->mXfer->status;
/* Wait for the status to change */
while (*stat == I2C_STATUS_BUSY) {}
}


Any ideas why the example code isnt working at me?
Are there any issues at the LPCopen I2C library?

Thanks for any informations

Attachments

Outcomes