Arduino Forum

Products => Arduino Due => Topic started by: ggorine on Sep 04, 2013, 03:46 pm

Title: I2C SCANNER Sketch for Arduino DUE
Post by: ggorine on Sep 04, 2013, 03:46 pm
Hi all,

I was wondering if somebody ever modified this sketch ( http://playground.arduino.cc/Main/I2cScanner (http://playground.arduino.cc/Main/I2cScanner) ) in order to work fine with an Arduino DUE.

When i run the sketch on my Arduino UNO, it perfectly recognizes the three I2C devices I've connected to the bus, but when I load it to the DUE no devices are recognized anymore.
I've tried everything, different pull-ups, switched between the two different I2C/TWI ports, inserted delays between functions, but nothing to do.
(I've also disconnected the 1.5k (actually 1k) pull-up on the DUE and placed external 4.7k pull up on both sda0-sck0 and sda1-sck1 to have similar delays everywhere.)

I've already questioned this forum (http://forum.arduino.cc/index.php?topic=180552.0 (http://forum.arduino.cc/index.php?topic=180552.0)) for some issues with those I2C. Before it was totally a logic level incompatibility, but now I'm having a perfect 3.3 to 5V bidirectional translation (checked with the scope).

Thank you,
Georgi
Title: Re: I2C SCANNER Sketch for Arduino DUE
Post by: peebee on Sep 07, 2013, 07:32 am
Have you checked the pins you are using?  SDA and SCL maddeningly shift around between boards.  (Worst is the Leonardo, which uses pins 2,3 - so no hardware interrupts if you use I2C!).
Title: Re: I2C SCANNER Sketch for Arduino DUE
Post by: ggorine on Sep 07, 2013, 10:03 am
Hi,thanks for answering.
My problem now is that I'm able to communicate with some devices of which I know the address (so I got the connection a right) but I would find usefull an i2c scanner like the one working just for AVRs.
Georgi
Title: Re: I2C SCANNER Sketch for Arduino DUE
Post by: chriskner on Sep 09, 2013, 03:27 pm
Hi Georgi,

The bits that the I2C Scanner example uses are broken in the library (last I knew).  It relates to the fact that "endTransmission()" is no longer working (or ever was) for the DUE.

I made a work-around for a project that I was developing that duplicates the functionality. 

Look in this thread:
http://forum.arduino.cc/index.php?topic=182727.0 (http://forum.arduino.cc/index.php?topic=182727.0)

Look for the "// **** S **** --Scan I2C bus for known chips..." section in the linked code.

This is not a library that you can just import.  You'll need to adapt the code for your use.

I2C support in the DUE remains largely-broken, and you should be prepared to write your own bits as necessary...

Best of luck,

Chris
Title: Re: I2C SCANNER Sketch for Arduino DUE
Post by: ggorine on Sep 11, 2013, 10:30 am
Thank you Chris for your constant interests in my issues  :)

I`ve got a new one going on now> http://forum.arduino.cc/index.php?topic=187215.msg1387029#msg1387029 (http://forum.arduino.cc/index.php?topic=187215.msg1387029#msg1387029) (in the big quote you can find a brief review of the issue)
We would happily hear your opinion!
Thanks again,
Georgi