# Data corruption?

**URL:** <https://community.sparkfun.com/t/data-corruption/45009>\
**Category:** NFC & RFID\
**Created:** [January 16, 2023, 5:38pm UTC](https://community.sparkfun.com/t/data-corruption/45009 "2023-01-16T17:38:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastienperth](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@Sebastienperth](https://community.sparkfun.com/u/Sebastienperth)\
**Post date:** [January 16, 2023, 5:38pm UTC](https://community.sparkfun.com/t/data-corruption/45009/1 "2023-01-16T17:38:13Z")

</div>

Hello,

I have a SparkFun Qwiic RFID breakout board (with ID-12LA reader) attached to an ESP32 ‘Feather’ board from Adafruit.

It runs an Arduino sketch that simply takes the tag information and sends it as keyboard input to the computer it’s attached to.

95% of the time, this works as intended. However, there is glitch that happens when a tad is scanned but the Arduino will send “-1-1-1-1-1-1-1” to the computer, over and over again. Sometimes this stops and the tag number is submitted, but often I have to unplug the device from the computer.

I have tried different things with the code, like slowing things down with delays, and removing the “print.serial” instruction… but this glitch still happens.

Here is the code running on the arduino board:

```auto
#include <Wire.h>
#include "Keyboard.h"
#include "SparkFun_Qwiic_Rfid.h"

#define RFID_ADDR 0x7D // Default I2C address 

// Interrupt Pin on pin 5.
const int intPin = 5;
String tag;
int ledPIN = 13;

Qwiic_Rfid myRfid(RFID_ADDR);

void setup()
{
  pinMode(ledPIN, OUTPUT);

  // Begin I-squared-C
  Wire.begin();
  //Serial.begin(50000);

  if (myRfid.begin())
    Serial.println("Ready to scan some tags!");
  else
    Serial.println("Could not communicate with the Qwiic RFID Reader!!!");

  // Put the interrupt pin in a known HIGH state.
  pinMode(intPin, INPUT_PULLUP);

  // Want to clear tags sitting on the Qwiic RFID card?
  Keyboard.begin();

}

    void loop()
    {
        
      digitalWrite(ledPIN, HIGH);
      // If the pin goes low, then a card has been scanned.
      if (digitalRead(intPin) == LOW) {
        tag = myRfid.getTag();
        delay(50);
        //Serial.println(tag);
        Keyboard.println(tag);
        delay(50);
        Keyboard.press(KEY_LEFT_CTRL);
        delay(50);
        Keyboard.press('a');
        Keyboard.releaseAll();
        Keyboard.end();
        digitalWrite(ledPIN, LOW);
        
      }   
      delay(1000); // Geeze, woah! Slow it down mate.

    
    }

```

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [January 16, 2023, 10:50pm UTC](https://community.sparkfun.com/t/data-corruption/45009/2 "2023-01-16T22:50:52Z")

</div>

4/5 times this is due to the pull-up resistance becoming too high on the i2c lines

Scroll up just barely from here [https://learn.sparkfun.com/tutorials/sp … e-assembly](https://learn.sparkfun.com/tutorials/sparkfun-qwiic-rfid-idxxla-hookup-guide#hardware-assembly) and remove the antenna, cut the i2c traces, and re-try…does the issue stop?

---

<div class="post-metadata">

**Author:** ![Sebastienperth](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@Sebastienperth](https://community.sparkfun.com/u/Sebastienperth)\
**Post date:** [January 17, 2023, 9:25pm UTC](https://community.sparkfun.com/t/data-corruption/45009/3 "2023-01-17T21:25:20Z")

</div>

When I tried this, the reader’s light blinked as if it read a tag, but it took about 10 seconds for anything to show up, and when it did, it was “-1-1-1-1-1-1” repeatedly.

And I am pretty sure I damaged the i2c traces to the point where I can’t add bridge the pads with solder…so that’s not great.

If I used a Qwiic wire to connect to the board, I still have an issue with the i2c traces being cut, correct?

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [January 17, 2023, 10:13pm UTC](https://community.sparkfun.com/t/data-corruption/45009/4 "2023-01-17T22:13:30Z")

</div>

Correct…but it’s pretty hard to damage beyond use (unless the whole pads are ripped off…even then you can still wire in a resistor and use the PTH’s SDA/SCL)

Share a photo of what it looks like and we’ll go from there

---

<div class="post-metadata">

**Author:** ![Sebastienperth](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@Sebastienperth](https://community.sparkfun.com/u/Sebastienperth)\
**Post date:** [January 17, 2023, 10:21pm UTC](https://community.sparkfun.com/t/data-corruption/45009/5 "2023-01-17T22:21:20Z")

</div>

> you can still wire in a resistor and use the PTH’s SDA/SCL

Ok yes, how could I do this?

 ![PXL_20230117_221853658.jpg](https://canada1.discourse-cdn.com/sparkfun/original/3X/7/9/79a61e9c12b8f6852c9a5ec384eee90cc8bf7b8d.jpeg)

---

<div class="post-metadata">

**Author:** ![n1ist](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@n1ist](https://community.sparkfun.com/u/n1ist)\
**Post date:** [January 17, 2023, 11:06pm UTC](https://community.sparkfun.com/t/data-corruption/45009/6 "2023-01-17T23:06:42Z")

</div>

I would resolder the pin headers; those connections don’t look like the solder properly flowed from the pin to the pad

/mike

---

<div class="post-metadata">

**Author:** ![Sebastienperth](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@Sebastienperth](https://community.sparkfun.com/u/Sebastienperth)\
**Post date:** [January 18, 2023, 3:29pm UTC](https://community.sparkfun.com/t/data-corruption/45009/7 "2023-01-18T15:29:06Z")

</div>

Ok, I will give it a shot.

I am still curious about “wire in a resistor and use the PTH’s SDA/SCL”. Can you explain that one a bit more?

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [January 18, 2023, 5:58pm UTC](https://community.sparkfun.com/t/data-corruption/45009/8 "2023-01-18T17:58:14Z")

</div>

What I’m referring to: Instead of using an on-board resistor, you can just wire a comparable resistor to the alternate pins…usually you need to snip the legs off the IC and solder the resistor between the header’s pad and the snipped legs

[https://cdn.sparkfun.com/assets/5/f/e/b … LA-Sch.pdf](https://cdn.sparkfun.com/assets/5/f/e/b/0/Qwiic_RFID_-_IDXXLA-Sch.pdf) you’d be replacing the R4 & R5 2.2k resistors here

---

<div class="post-metadata">

**Author:** ![YellowDog](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/yellowdog/32/1782_2.png) [@YellowDog](https://community.sparkfun.com/u/YellowDog)\
**Post date:** [January 19, 2023, 9:57am UTC](https://community.sparkfun.com/t/data-corruption/45009/9 "2023-01-19T09:57:36Z")

</div>

Not seeing any interrupt routines in your code.

For external i2c pull-ups, connect a 5 to 10k resistor to sda and scl with the other ends of the resistors connected to 3.3 volts.

---

<div class="post-metadata">

**Author:** ![Sebastienperth](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@Sebastienperth](https://community.sparkfun.com/u/Sebastienperth)\
**Post date:** [January 19, 2023, 3:32pm UTC](https://community.sparkfun.com/t/data-corruption/45009/10 "2023-01-19T15:32:03Z")

</div>

So I gave that a shot, and while the board’s pwr LED turns on, and the Read LED turns blue when a tag is close, I am not getting the tag number.

Just to be clear, the resistor is between the leg of the ATTINY84, and to the SDA and SCL pins ?

Or was the resistor being connected to the pad the IC leg was connecting to?

I know it’s not the best soldering job, but I had a close look and there’s no extra connections being made.

 ![PXL_20230119_152522819.jpg](https://canada1.discourse-cdn.com/sparkfun/original/3X/7/7/779d5bf68b804a7e98f4a43a587833b8a5e66b5a.jpeg)  
Thanks!

---

<div class="post-metadata">

**Author:** ![n1ist](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@n1ist](https://community.sparkfun.com/u/n1ist)\
**Post date:** [January 24, 2023, 2:39pm UTC](https://community.sparkfun.com/t/data-corruption/45009/11 "2023-01-24T14:39:13Z")

</div>

The resistors should be wired as pull-ups. Take one resistor, connect one end to the SDA header pin. Take the other end and connect it to the 3V3 header pin.

Take the second resistor, connect one end to SCL, and the other end to 3V3

/mike
