More Due I2C Woes ... Alternative Boards?

Just noticed a bulletin on the adafruit motor shield page: "As of Arduino 1.5.6-r2 BETA, there is a bug in the Due Wire library that prevents multiple
Motor Shields from working properly!"

Seriously. Is there any update to this, specifically with the Arduino 1.6.5 release? I've gotten so fed up with the Due / I2C issues I want to throw it through the window. When is the Due I2C bus / wire library going to be fixed for good!?

Anyone know of any other arduino boards that are fully compatible with adafruit motor shield, pwm shield, lcd backpack, music maker, etc? I need something faster with more flash than a mega. I'm beginning to think I'm trying to accomplish too much on the arduino platform.

Anyone tried the Digilent chipKIT Max32?

The Adafruit pwm/servo breakout board is compatible. I use it with a Due. I think the shield is also but you must remember to use the secondary Wire pins (Wire1).

The Adafruit motor shield says it is also Due compatible. The Adafruit motor shield library has the stuff in it for the Due.

edit: If you use the I2C scanner for the Due shields, you must change Wire calls to Wire1 calls. Here is the I2C Scanner code modified for the Due I2C shields that use the SDA1 and SCL1 pins next to the AREF pin.

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
//  Version 6 for Due only by SurferTim 27 June 2015
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire1.begin();

  Serial.begin(9600);
  Serial.println("\nDue I2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire1.beginTransmission(address);
    error = Wire1.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

Exactly what is the problem you're having? I've been using I2C on the Due for some time, at 2MHz, and had zero problems, once I figured out that you need to have external pull-up resistors.

The Wire library is pretty darned simple, so if there is a problem in there, it should not be very hard to fix....

Regards,
Ray L.

I have no problem with the Due and 1 or 2 of these shields on Wire1. Problems arise when I connect more than that. My project requires 3-4 motor shields, 2 pwm shields, music maker and lcd backpack all at once on I2C. Plus other non-adafruit stuff of course like the USB host shield, lidar, 10 DOF board, etc.

Curious - what are you running that needs 2Mhz on I2C? I would be happy with 100KHz or 400KHz running without freezing.

There have been so many back and forths with the Due wire library that I'm tired of trying to keep up my code and hardware to work.

See my posts at adafruit forum for more detail:

https://forums.adafruit.com/viewtopic.php?f=31&t=76030&p=385538#p385538

integrate:
I have no problem with the Due and 1 or 2 of these shields on Wire1. Problems arise when I connect more than that. My project requires 3-4 motor shields, 2 pwm shields, music maker and lcd backpack all at once on I2C. Plus other non-adafruit stuff of course like the USB host shield, lidar, 10 DOF board, etc.

And which of those libraries would Arduino be responsible for? Do you blame the Due because Adafruit's library doesn't support multiple boards? Or do you blame the Due for the fact that you are unable to modify available third party libraries to meet your own needs? Or do you blame the Due because the third party boards were not designed to work well with all other I2C equipment?

@SurferTim: None, no (because it does), no (because I can) and no (irrelevant - I2C is a common standard). I blame the Due because all these shields work (together at once) on a Mega and even an Uno. But neither of those boards operate fast enough and have enough flash for my project.

If I offended you with my exasperation I apologize - I sense perhaps a bit of defensiveness in your tone - maybe you are affiliated with Arduino or maybe you are trying to catch out someone you think is a noob maker. Either way, you cannot possibly convince me that the Due hasn't had serious issues with I2C. If I had an hour (or more) to spare I would reference all the traffic on the intertubes regarding Due I2C issues.

So I ask again: 1) Am I trying to do too much on the Arduino platform regarding this number of combined shields? And, 2) Anyone tried the Diligent chipKIT Max32 with these and other shields?

Maybe a more appropriate question would be: Anyone having success with MULTIPLE (i.e., 3-4 or more) Adafruit I2C boards on a Due?

I don't see a problem with my I2C devices, but I use only two together at the moment. I may eventually use two or more of the PWM/servo breakout boards tho.

edit: I don't know if you mean separate boards or I2C devices. I have a 10DOF board with three I2C devices on it. Does that count as one or three to you? If three, then I have 4 Adafruit I2C devices on my Due.

What are the symptoms of your fails? No communication initially? Losing communication after a while? One device confused with another?

Are you watching the I2C lines with an o-scope? Maybe the pullups are not quite strong enough?

edit: I did seem a bit patronizing. My apology. Normally when I see a user with one post, he/she is a newbie.

@SurferTim: Scope is square-a-licious at 100KHz and 400KHz (with different pull-ups), but I have a short list of further rabbit holes to investigate, mostly in the Wire library. More than anything I was looking for validation that the Due hardware can actually handle the traffic. Sounds like you may have it so I'll spend the time digging, though I would still like to hear from others that might have more I2C slaves than 3 or 4. Thanks.

There is nothing in the Wire library code that knows, or cares, how many devices are actually connected to the I2C interface - each transaction is carried out exactly as it would be if there were only the one device connected. If the number of devices is actually a problem, then it is almost certainly either an electrical problem, or a bug in one or more of the devices.

Regards,
Ray L.

@RL: Thanks for the thought and at first glance it may appear that way. But I disagree based solely on the fact that all of these boards work together with a Mega or an Uno. Even got it working (though slowly) on a Galileo with a hacked Wire library. It is either the Due hardware or its Wire library implementation. I suspect an interrupt issue in the Wire library. I2C master controls the clock but based on the Philips standard, slaves can hold the line to make sure they're heard. I suspect the Wire library for the Due is TOO simple and not handling this case, or handling it incorrectly. Add more traffic and more voices to be heard and it compounds the issue and you have a freeze with the line held and never let go. Regardless, I don't have time to dig in for a few days. Still interested to hear what you're doing with a 2Mhz clock!

I think you're jumping to invalid conclusions. First, the fact that another board works supports the theory that the problem is electrical, rather than a logic problem. The Due is a 3.3V only device. Are the AdaFruit board 3.3V? If not, that is likely your problem right there. Second, the ability of a slave to "hold the line" applies only when a data transfer is in process, and the slave cannot either send or receive data fast enough. The number of slaves on the line has absolutely nothing to do with it - if it's going to happen it will happen with only one slave. The use, or not, of this I2C feature is ENTIRELY under the control of the slave device, and very few devices use it.

I have a Due communicating with a custom FPGA, and the keep the communications low-latency, I run the interface at 2MHz.

Regards,
Ray L.