i2C BUG

A forums to allow resolved bugs and problems with Flowcode v7 to be stored and marked as resolved.

Moderator: Benj

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

i2C BUG

Postby Alan_37 » Mon Sep 05, 2016 9:39 pm

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 .
Attachments
Hardware.jpg
(246.03 KiB) Downloaded 699 times
Software.png
(37.29 KiB) Downloaded 699 times
These users thanked the author Alan_37 for the post:
Benj (Tue Sep 06, 2016 12:00 am)
Rating: 5.56%
 

User avatar
LeighM
Matrix Staff
Posts: 1844
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 429 times
Been thanked: 612 times
Contact:

Re: i2C BUG

Postby LeighM » Thu Sep 08, 2016 11:16 am

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

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: i2C BUG

Postby Alan_37 » Thu Sep 08, 2016 6:14 pm

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
Attachments
Read.png
Read.png (29.44 KiB) Viewed 2473 times
These users thanked the author Alan_37 for the post:
LeighM (Fri Sep 09, 2016 8:15 am)
Rating: 5.56%