arduino / ArduinoCore-sam

80 stars 107 forks source link

Wire does not play nicely with Adafruit I2C FRAM breakout board #126

Open fkromer opened 3 years ago

fkromer commented 3 years ago

I'm trying to get some example sketch MB85RC256V.ino running on Arduino Due to interface with an Adafruit I2C FRAM breakout board. I've the issue that the IC is not detected at all. The I2C default address has not been changed and I'm using the official docs to setup the board.

With the Arduino Due (SDA/20 + SCL/21) I'm getting this output:

Unexpected Manufacturer ID: 0xA00
I2C FRAM not identified ... check your connections?

Will continue in case this processor doesn't support repeated start

For comparison with the Arduino Mega (SDA/20 + SCL/21) I'm getting this output:

Found I2C FRAM
Restarted 7 times

 0x0: 0x8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0x20: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0x40: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0x60: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0x80: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0xA0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0xC0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
 0xE0: 0x00 0x00 0x00 0x00 0x00 0x00 (...a lot of other FRAM dump data...)

In all post comments in the Arduino forum I've found so far about people running the breakout board and the Arduino Due successfully report that they are using own libs. Can someone confirm that the official libs support the Arduino Due and Adafruit I2C FRAM Breakout Board?

fkromer commented 3 years ago

It turned out that fram.begin() does not return properly when using Arduino Due. For more info refer to this thread. In the example sketch changing

  if (fram.begin()) {  // you can stick the new i2c addr in here, e.g. begin(0x51);
    Serial.println("Found I2C FRAM");
  } else {
    Serial.println("I2C FRAM not identified ... check your connections?\r\n");
    Serial.println("Will continue in case this processor doesn't support repeated start\r\n");
    while (1);
  }

to fram.begin(); should make the sketch working. Of course this is a workaround, no fix 😏