Qwiic RFID wrong readings after 20 reads

Great, well done :slight_smile:

Yes please detailed instructions, I think its important for several users here.

Steps for flashing the ATTiny84 on Sparkfun Qwiic RFID board using Arduino Mega 2560 R3 as programmer:

  • These steps are specific for the arduino mega. Some of the pins in the IDE code will be different if you are using other controllers.
  • Get your Arduino 2560 and run the ArduinoISP example code from Arduino with the following modifications:
  1. The spi clock needs to be slower for the ATTiny84. You can even find this recommendation in the original unedited Arduino code line 49. In line 53, make this edit:
    #define SPI_CLOCK (128000 / 6)

  2. Assign the following pins because they are used to program other boards. I found this here: https://support.arduino.cc/hc/en-us/articles/4841602539164-Burn-the-bootloader-on-UNO-Mega-and-classic-Nano-using-another-Arduino#ide
    The pin numbers are different for different Arduino boards so use the table in the above link to pick out the right pin numbers. If you are using Arduino mega 2560 like me, the modifications will be the following three pins:
    #define ARDUINOISP_PIN_MOSI 51

#define ARDUINOISP_PIN_MISO 50

#define ARDUINOISP_PIN_SCK 52

  1. Once you have that, upload the code to your arduino.
  • The second set of steps require soldering wires to the Sparkfun board and using connectors on the arduino controller. I took all of this from @micropuller but modified his pin placements for my arduino mega.
  1. Solder wires on GND, 3V3, SDA, SCL and RST breakouts and connect them to the following pins on arduino mega:
  • GND to GND
  • 3.3V to 3.3V
  • SDA to pin 51
  • SCL to pin 52
  • RST to pin 10
  1. There is one connections that does not have a breakout on the Qwiic board. It is the MOSI or CIPO pin. It will be a small hole on the bottom-left where it says I2C. I have tried two options for this. You can either solder a wire onto this hold. Or get a very thin metal (i cut a single pin from a stacking header) and solder that pin to a wire. This thin metal will fit into the whole without soldering onto the board. This wire will be connected to pin 50 of the arduino mega.
  2. You will need a polarized 10uF capactor which you will connect with the reset pin (positive end/longer) and GND (negative end/shorter).
  3. Get the updated source code for the ATTiny84 from here SparkFun_Qwiic_RFID_ID-XXLA/Firmware/ATtiny85_Firmware/Qwiic_RFID_IDXXLA/Qwiic_RFID_IDXXLA.ino at master ¡ sparkfun/SparkFun_Qwiic_RFID_ID-XXLA ¡ GitHub
    and select the board ATTiny84 (with no bootloader) and your port. Make sure you are running your Arduino as programmer by going to Tools > Programmer > “Arduino as ISP”. Run bootloader. It should take 20 seconds or so.
  4. Upload the updated source code by going to Sketch and selecting “Upload using Programmer”. It should take another 20 seconds.
3 Likes

Awesome, thank you!

I will try asap, but might take a few days before I have a Mega here.

you can use any arduino controller. go to the breakout pin diagram and identify the pins that can be used for programming other boards and make the pin changes in the code. and one more thing, if you prefer not to solder wires onto the Sparfun qwiic board, you can just use male-to-male dupont wires. I added a very thing layer of soldering wire on one end of the dupont wires to make them thick enough that they go through the qwiic board and hold tight. Once you have these wires and connections, you can flash one sparkfun board after another and it makes the process very quick (no pun intended).

Great to have a “how to” for other users facing this problem.
The only thing I think is missing, is that you probably also have to install the ATtiny core files, so you’re actually able to select the ATtiny when you want to upload the code.

1 Like

yes that is required.

I think this tutorial is what finally helped me to get things working: https://www.youtube.com/watch?v=gXXdoeu7yWw
This one is also pretty good (and more recent): https://www.youtube.com/watch?v=sycSdI49hlY

Excellent work! We’re isolating and testing stock now, but happy to hear you got it going :wink:

Hello! Thank you @paulvha for identifying a classic array memory problem, and for providing the fix. I have tested it here in the office and have put it into the Firmware folder within its’ repository.

We will be getting this fix into any of the boards we have in our inventory, and for future builds.

Cheers,
Elias

1 Like

Hi @happy_kass and @paulvha thank you again for your support.

I successfully flashed the ATTiny, now the NFC Reader works.

Some additional info for anyone else coming here:

  1. I have used an Arduino Nano instead of a Mega (pinouts / cabling below)
  2. As it is not mentioned in happy_kass solution: there are several board URLs for the ATTiny, but some of them are outdated and throw compile errors. I have used this one: https://drazzy.com/package_drazzy.com_index.json (add URL to Preferences/Additional Board URLs and then download the “ATTinyCore” by Spence Konde via Board Manager), I used version 1.5.2 without issues
  3. From “Tools/Board” select the “ATTinyCore/ATTiny24/44/84(a) (No Bootloader)”

For Arduino Nano, you need to:

  1. In ArduinoISP sketch:
    1. enable #define USE_OLD_STYLE_WIRING
    2. enable #define SPI_CLOCK (128000/6)
    3. disable #define SPI_CLOCK (1000000 / 6)
    4. leave MOSI, MISO, SCK as it is (11, 12, 13)
  2. connect the Arduino Nano board to the NFC Reader as followed:

nfc reader => mega ; nano
3v3 => 3v3
gnd => gnd
mini pin/miso => mega (cipo/50) ; nano (cipo/d12)
sda/mosi (51) => mega (copi/51) ; nano (copi/d11)
scl => mega (sck/52) ; nano (sck/d13)
rst => mega (ss/d10) ; nano (ss/d10)

happy_kass writes that on the Qwiic board, the mini pin is the “MOSI” pin, but it is the MISO pin.

With “mini pin/miso” I refer to the little special pin left below the “I2C” label. I soldered a tiny cable there.

In addition to a capacitor (I used a 470uF, minus/stripe goes to GND) I have added a 10kOhm resistor between 5V and D10 as described in the posting here ( Arduino Nano ISP Dongle : 5 Steps - Instructables )

1 Like