sparkfun / SparkFun_Qwiic_RFID_Arduino_Library

2 stars 1 forks source link

Qwiic RFID acks on every I2C address #4

Open nseidle opened 4 years ago

nseidle commented 4 years ago

Why is the ATtiny ack'ing on every I2C address? This is causing issues talking to other I2C devices on my bus.

image

Here's the I2C scanner sketch.

include

void setup() { Serial.begin(115200); Wire.begin();

while (1) { 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.
  Wire.beginTransmission(address);
  error = Wire.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("Unknown 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

}

}

void loop() {

}

nseidle commented 4 years ago

I'm using Arduino 1.8.10 and Artemis with the latest Qwiic RFID lib.

edspark commented 4 years ago

It's a very enthusiastic chip just trying to to please?

Hur hur, I'll give a look see sometime tomorrow, if not, early next week.

edspark commented 4 years ago

A preliminary once over of the issue and I've found that with an Redboard, I don't see the issue: Scan with Uno

I do see the issue with the Artemis but in closer inspection with a logic analyzer I'm finding that the ACKs in the serial terminal are not lining up with the behavior of the transmissions:

Here's an ACK at adress 0x7D: clear ACK

Here's a NAK at address 0x7C - repeated for every address that is not 0x7D: Clear NAK

List of addresses being NAK'ed and the single address been ACK'ed: logic_analyzer_ACK

I'm not seeing any error in the logic of the Arduino Sketch, so I think the next step may need to be to hook up the I2C lines to a scope.

nseidle commented 4 years ago

I don't think we have this issue (Artemis doing weird things) on any other ATtiny based qwiic device so I'm nervous.

As an aside, I've been dealing with ublox modules doing evil things with I2C setup times on the Artemis. I think it's related to bus capacitance. We recently added a setPullups() feature to Artemis so for giggles, try adding Wire.setPullups(0); //Disable internal I2C pullups to your test sketch and see how the logic traces change (if any).