QWICC RFID interrupt pin

I am attempting to get the Qwiic RFID-IDXXLA to work with an ESP8266. I bought the Qwiic RedBoard along with the Qwiic RFID-IDXXLA and used that to test that the Qwiic RFID works as expected. I then configured an ESP8266 (NodeMCU v1.0 12E) to use the Wire library in order to enable I2C communication with Qwiic RFID.

I am having an issue with the interrupt pin. I am using the example code from the Hookup Guide (with a few minor changes to use the proper GPIO for the ESP8266). See below. I am able to scan the first RFID tag properly and get the correct ID. However, upon the next scan, the interrupt line then stays LOW… and the checkTagID() function is constantly called. The interrupt line from the QWICC RFID never goes HIGH again unless I do a hard reset by disconnecting power.

I’m hoping there might be some insight as to why that is the case using the Wire library?

#include <Wire.h> 

#define RFID_ADDR 0x7D // Default I2C address 
//#define RFID_ADD 0x7C // Close "ADDR" jumper for this address
#define TAG_REQUEST 6

// We'll use a pin attached to the interrupt line to initiate the check for the RFID tag ID. 
// Alternately the product can store up to 20 tags. 
const int eventPin = 14;  

void setup()
{
    // Begin I-squared-C
    // void wire.begin(int sda, int scl);
    Wire.begin(4, 5); 
    Serial.begin(9600); 
    Serial.println("SparkFun Qwiic RFID, waiting for RFID to be scanned."); 
    pinMode(eventPin, INPUT_PULLUP);// Our pin is active low so let's put it in a known high state.
}

void loop()
{
    // When the interrupt pin changes to a LOW state, a tag has been scanned. 
    if( digitalRead(eventPin) == LOW ) {
        Serial.println("RFID tag scanned.  Checking."); 
        checkTagID();
    }
    
    delay(250); // Slow it down
}

// 20 tags can be stored by the product at a time, the first one to be scanned is the first one
// to be pulled from the tag stack. If the tag reads '000000' or the interrupt line never went low
// then there are no new tags waiting to be read. 
void checkTagID()
{   
  byte tempTag = 0; 
  // This variable stores the tag and could easily be a global variable. Just
  // make sure to clear it in between reads. 
  String tagID; 
    Serial.print("RFID Tag ID: "); 
    Wire.requestFrom((uint8_t)RFID_ADDR, TAG_REQUEST); 
    for( int x = 0; x < TAG_REQUEST; x++ ) {
    tempTag = Wire.read(); 
    // Concatenating the bytes onto the end of "tagID".
    tagID += String(tempTag); 
  }
  Serial.println(tagID); 
}

Ah, I think I see what the issue is. The example code uses pin 14 as the “eventPin”, however pin 14 is also the clock line for I2C on an ESP8266. It works when it starts up because you’re not using I2C, but as soon as an RFID card is read, I2C communication begins, and you get stuck in a loop: Pin goes low because of the clock signal being sent out on the “eventPin” which results in the “checkTagID()” function being called to check for an RFID card, which results in the “eventPin” going low because of the clock signal, which calls the function…etc etc.

Changing that event pin to pin 3 or some other pin, should fix the issue.

Wonder_boom, thanks for the prompt reply. I had originally thought something similar… so I had moved that eventPin assignment around the board. However, no matter what I do, the results are similar. I have tried:

eventPin as GPIO9, 10, 16, 14, 12, 13, 15, 3, 1, 0. Some assignments (as expected) interfere with Serial comms (13, 15, 3, 1, e.g.) or flashing the board (GPIO0 e.g.)

I have tried the above with SDA and SCL assigned as GPIO4 and 5, respectively. I have also tried SDA = 4 and SCL = 14 … to free up GPIO5 for the eventPin. Same result… I get one good card read… then one with bytes all 255… then the infinite loop as the QWICC RFID seems to hold the interrupt pin LOW… which seems to be on the third card read (1st good, 2nd all 255s with pin going HIGH after the 2nd read, 3rd results in loop with pin remaining LOW). This seems to be an incompatibility with the ESP8266, perhaps? See serial output below to see if that inspires some additional feedback. Thanks!

d⸮c⸮SparkFun Qwiic RFID, waiting for RFID to be scanned.
RFID tag scanned.  Checking.
RFID Tag ID: 10002161659151
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255
RFID tag scanned.  Checking.
RFID Tag ID: 255255255255255255

Good morning, I can confirm that I’m seeing the same thing as you on my ESP8266. I’ll take a deeper look at it later this afternoon.

Some development but not much ( I have been quite busy with pressing projects). It’s note worthy that the RFID reader is returning a series of 255 numbers. If it were being asked for an RFID card and one had not been scanned, the correct response would instead be a series of zeroes. The ESP8266 does not have I2C built into hardware but rather software which leads me to believe that there is a timing issue. I tried to slow down the setClock speed but that didn’t help. This is the avenue I’ll be walking down to find a solution.