i2c_hw.lib does not follow I2C standard?

I’m trying to use a Microchip 24LC64 from a Rabbit 6700. According to wikipedia: “If the master wishes to read from the slave then it repeatedly receives a byte from the slave, the master sending an ACK bit after every byte but the last one”

This is also specified in the datasheet for the chip I’m using. However, when I listen to the pins with a logic analyzer I can see that my read looks like this:

Slave addr (Read) ACK Databyte ACK

No stop condition is sent. I’m I doing something wrong or is this a bug?

A snippet of my code:

// Set the address from where to read:
status = I2C_WriteToSlave(a_SlaveAddress, (char far*)&buffer[0], 2, 1, 100);

// Read a single byte:
status = I2C_ReadFromSlave(a_SlaveAddress, (char far*)&data[0], 1, 1, 100);

Regards Sebastian

Update: It seems to work if you read two bytes. If I read only one byte it fails.

Looking at the ISR there is an issue with a read of a single byte. The test for setting up the finish condition is missed for a single byte because the count is decremented to 0 before it compares the bytes remaining to 1.

Regards,
Peter

Exactly! I have also noticed this and I have registered a support case. I’ll fix it myself for the time being.

Hi Sebastian,

I am having similar problems with i2c_hw library. It doesn’t update the status register after it receives data. Do you have the modified library with the fix ?

Thanks

Regards,

Rabben

Hi Rabb,

Unfortunatly I don’t have any modified library. We made a quickfix by reading two bytes and ignore the stray byte. I have reported a case to digi, but it is not yet solved. Other tasks at work have higher priorities then I2C at the moment. However, we will need he issue to be fixed in the future. Either Digi will fix it, or we will hack the library ourselves.

I would recommend you to file a troublereport to Digi. Refer to my case-number: 1315646.

Regards Sebastian