Page 1 of 1

i2C BUG

Posted: Mon Sep 05, 2016 9:39 pm
by Alan_37
Hi

Just found this I2c bug ( Arduino Mega 2560)

When Communicating with I2c using Hardware Channel 1 with most devices where you have standard protocol structure like
for example DS1307 it works Perfectly .

Init->Start -> Device Address+Write->Target Register-> Restart -> Device Address+Read-> Receive Byte ->Receive Byte->Receive Byte->Stop
So that is fine .

But i have this device that have a slightly different protocol structure to read from it you just transmit the following bytes and it
starts to send data .

Init->Start -> Device Address+Command->Register H-Address-> Register L-Address-> Number of bytes to receive -> RX->RX->RX ..... Stop

The Problem is that with the i2c Hardware Channel it receives the first byte and the MCU stops responding as if it had entered a loop .
also the data received is not correct .

Now when trying whit I2c Software mode all works Fine .

Re: i2C BUG

Posted: Thu Sep 08, 2016 11:16 am
by LeighM
Hi
I've looked into this issue and it looks like this protocol is not supported by the AVR TWI peripheral.
A "Start, SLA+W" puts it into Master Write mode, and a "Restart, SLA+R" is needed to change that into Master Read mode.
I cannot see any way round that, as yet.
So looks like you will need to stick with the Software mode.
Leigh

Re: i2C BUG

Posted: Thu Sep 08, 2016 6:14 pm
by Alan_37
Hi LeighM

Good to know of this Limitation , The device is Atmel Crypto Memory it's very complicated and I'm not surprised
that it's not compatible .

Thanks for your time .

Alan