RC522 RFID-RC522 Switching SPI to UART interface or i2c ! POSSIBLE !

Hello,

I've been working with those modules from a while.
Not very expensive, i've paid 1$ for a piece. And it is not exactly genuine IC on it, no markings at all :slight_smile:

Works perfect.

So I've been thinking about using that module with other interface than default SPI.

After searching the documentation I know chow to change the interface.

Depending on signals on pins 32 - EA, and 1 - I2C it is possible to set the module in desired mode.

For those 1$ modules the most easy conversion is from standard SPI to UART, because you only need to cut out one trace that we have easy acces.

That is the only trace that goes to the pin 32, it is tricky because that trace goes from left and is covered by white paint so hard to see at the first look.

Si in 2 seconds we have got UART, and still can use SPI if we fix back our cutting.

If we want I2C what would be better in many cases, than we need to desolder the MRFC522 IC, because I2C enable line is grounded (set LOW) under the chip, and we need to reflow the IC after cutting.

It is not so hard, and i'm doing it with hot air with my GAS hot air gun/soldering iron from DREMEL.

There is no temperature controll so just needs to check not to burn the IC by overheating.

Just posting here for people who needs save 3 pins , because UART or I2C takes less than SPI.

And conversion to uart is so simple...

Post your code here, because we have got library for SPI, and there is not much for UART or I2C, i'll post the code for I2C because i have got some when i finish testing.

Have a good fun.

N37

below photos of how to change the connections.

1 Like

Thanks for your job.

Can you tell us what is the function of the pin EA ???

I whant to use this RFID module with I2C protocl, but I don't know How.

thanks for your help :wink:

8.1.4.5 7-Bit addressing

page 19

https://www.nxp.com/documents/data_sheet/MFRC522.pdf

During the I2C-bus address procedure, the first byte after the START condition is used to
determine which slave will be selected by the master.
Several address numbers are reserved. During device configuration, the designer must
ensure that collisions with these reserved addresses cannot occur. Check the I
2C-bus
specification for a complete list of reserved addresses.
The I2C-bus address specification is dependent on the definition of pin EA. Immediately
after releasing pin NRSTPD or after a power-on reset, the device defines the I2C-bus
address according to pin EA.
If pin EA is set LOW, the upper 4 bits of the device bus address are reserved by
NXP Semiconductors and set to 0101b for all MFRC522 devices. The remaining 3 bits
(ADR_0, ADR_1, ADR_2) of the slave address can be freely configured by the customer
to prevent collisions with other I2C-bus devices.
If pin EA is set HIGH, ADR_0 to ADR_5 can be completely specified at the external pins
according to Table 5 on page 9. ADR_6 is always set to logic 0.
In both modes, the external address coding is latched immediately after releasing the
reset condition. Further changes at the used pins are not taken into consideration.
Depending on the external wiring, the I2C-bus address pins can be used for test signal
outputs.

So short answer is , state of EA PIN defines if we are defining the i2c addr if there are other devices wit the same addr, or we do not want to change anything and we are using standard i2c addres.

Thank you for information! Could you please recommend any library for communication with RC522 via UART?

I gave this a try, trying to convert to UART without much success. I used this project to verify but couldn't really get anything to work:

Do you have any tips on how I better and more reliably verify this mod?

Nice work @Netoperz

For I2C you definitely need to cut the trace grounding I2C (pin 1), but you don't have to unsolder the IC.
Just drill a neat little hole from the bottom side of the PC through the trace.
I used a 0.9 mm drill in a pin vise (that's a little holder like a jeweler's screwdriver, no motor).
Just drill carefully until you hit the copper, then keep on drilling until the copper is gone.
The location is just on the bottom of where the nice photos show the cut trace.

Photo shows location of drill hole, to the upper right of the center of the chip.

First, thank you all for sharing!! I really want to use I2C for the RC522 (as I want to connect many to an single arduuino), but have been struggling to find any good information anywhere else.

@Renate-USB, super thanks for the drilling tip. If I do this, do I still need to solder something to the I2C pin on the top to set it high? Or is just breaking the ground enough for the unit to run in I2C mode?

I can confirm that drilling the hole to cut the connection to pin 1 and cutting the trace to pin 32 puts the RC522 into I2C mode with address 0x2B after power-on. It's a matter of some minutes. A small screw driver and a scalpel was everything I needed. Thanks for this tip, I already wanted to heat up the gas soldering iron.

1 Like

I need help with a project using UART and the RFID RC-522. Did you succeed?

farthinder:
I gave this a try, trying to convert to UART without much success. I used this project to verify but couldn't really get anything to work:

GitHub - zodier/MFRC522-UART-Arduino: Arduino library for MFRC522 based modules via UART interface.

Do you have any tips on how I better and more reliably verify this mod?

ck0n3, i was really excited when i saw your comment of succes and i thought i should give it a try. here is my experience...
i drilled with a small screwdriver the hole as it is on the image. i then checked with a DM that the i2c(pin1) is no longer tied to ground. then i cut the line from EA(pin32) to Vcc as sugested. i then did the following solderings, i2c(pin1) to Vcc, EA to Ground, and lastly pins 30,29,28 to Ground just not to be floated(cause from the datasheet i see that if you tie EA low, then those pins define the address,adress0,adress1,adress2, so i did). then i was very thorough to check that there is no short circuit anyware. evrything seemed fine. unfortunately, i2c scanner doesnt find the device and sometimes it stucks in the for loop(maybe waiting response from the mfrc522??) until i disconnect or reset the mfrc522. i tried also with pullup resistors 1,2 and 4k7 only to witness tha same results. i thought that i damaged the chip in the process, so i restored the connections for spi, and it worked again flawlessly.
i am out of guesses/options. i would like some help...

Thank you Netoperz:

I too want to quickly convert qty 6 of these boards to I2C bus, to
(1) cut down the I/O to each module to four connections,
(2) add PULLUP externals - running up to x cm over RJ11 24AWG telecom interconnect and
(3) bus up to 4 devices by shorting Address Pins to either +3.3 high or GND low.

I lifted the 522 NXP chip with my HotAir quite easily
but as I started to tape up the modules DuPont pin plastics with Kapton,
I had a great IDEA.

I am going to make a small square of KAPTON, slide it UNDER pins 1(I2C select) and 32(EA)
before I reflow the IC back into original position.
Intention: avoid trace cutting with knife ( I dislike working with my BinoScope and a Blade)

The pins are close , right at the corner.
I use Kapton Tape to protect areas and components from unintentional melting
within the vicinity of my hot-air rework.

I am going to try this .
The 001 image attached is just as I am sliding the Kapton tape into place with Red LED illumination,
the 002 image is with just the White LED
and third image is the Netoperz Instruction image with overlay where Kapton tape would be placed.

Summary
the (proposed, untested) concept is to insulate pins 1 and 32 at that corner,
reflow IC using hot air with pins 1 & 32 insulated/floating open,
and then use AWG30 to short/open pins 1 & 32 to Hi or Lo.

I will report back when I have hot air bonded the IC, and shorted using the (Netoperz) rework.
This will allow me to beta test I2C or UART modes on just one board,
discover Address Pin rework, and bus multiple units on I2C
and then see what cable distance I can get out of Telecom Satin patch cable and RJ11 interconnects.

If anyone has suggestions on pull-up values, let this audience know.
I think 27K is a good place to start.

As the fall back plan, if the module I2C bus idea fails,
I will go to a 4:1 SPI Mux using [MAXIM] 350... "old school" or use SS pins in grouped selection.

thanks Netoperz for your good discovery work, and I hope I can improve the rework

John Rad (CET-III, 39yrs)

UPDATE (SPI to I2C conversion of MFRC522 board, 08 FEB 2018):
I have bench down time to return to this project:

(1) new image with my USB microscope of the IC hot-air-resoldered.

(2) *some boards contain counterfeit IC's *
which do not have the correct product code when queried.

(3)I have Pin 1 and Pin 32 set for I2C mode and the Arduino I2C address query
per the Manufacturer Spec.
(I use #30 uninsulated stripped wirewrap on both floating pins)

discovery is pending:
?can the MFRC522 set to I2C and be recognized?
?can an IC with an incorrect house code (?counterfeit) operate in I2C mode?

MFRC522_board_mod_001.jpg

Rework_usingNetoperzInstruction_withKapton.jpg

MFRC522_board_mod_004.jpg

Here is how I got it to work in I²C Mode:

  1. Follow the instructions by Netoperz, big thanks!
    (I used the big GND pad on the bottom to heat up the chip with a soldering iron and later resoldered it with the help of a lighter :slight_smile: ).

All there was left to do then was to figure out, which pins are SDA / SCL.
Looking at the Pinout of the chip found in the datasheet it is quite clear:

Fortunately for us, these pins are already on the header!

I²C : Board -> Pin on an Arduino Nano / Uno
SDA : SDA -> A4
SCL : MISO -> A5

With the EA Pin left floating the address seems to be 0x3C.
Connecting it to GND (via resistor) causes the address to change "randomly" between power-cycles.
This should MUST obviously be avoided. Currently I haven't changed anything besides what Netoperz showed in his image.
Maybe connecting the I²C address pins would be a good idea... :wink:

My other photos:




I2C_Scanner_BEST.ino (2.17 KB)

I²C Works!

I used the following library (1): GitHub - arozcan/MFRC522-I2C-Library: MFRC522 I2C Library
The library seems to be based on this popular library for SPI devices:
GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522

I attached a small sketch that prints out your card's UID [Library (1) is required].

Just as a side-note: You don't have to use / hook up the Reset Pin, it is pulled high by an on-board resistor (R2). Leaving it always high contributes towards a higher energy consumption, if you are using a battery this might be a concern. Soft power-down could be more interesting if you need to save pins.



The LED ist still turned on, it is consuming the majority of the measured ~1mA. Removing it is easy.

Please note that I have pulled EA high with a 100k resistor.

MFRC_I2C.ino (1.5 KB)

anykey:
thanks for the drilling tip. If I do this, do I still need to solder something to the I2C pin on the top to set it high?

The easiest way to make sure that the #1 pin (I2C) stays high is to glob a solder between the #1 and #2 pin (PVDD).

I leave the EA alone (high) which means that the chip loads its I2C address off the lines.
I simply scan for the correct address (which seems to stay 0x3c).
In any case, once the chip boots the address is constant for that power cycle.

Do I understand it correctly: A hassle-free solution would be to simply connect pins 1 and 2. If I don't need to configure the address this will be sufficient?

Sparkus:
If I don't need to configure the address this will be sufficient?

I had problems with the address sometimes suddenly changing (after a re-boot) when I left the I²C address-pins floating. Since the address-pins are all on one side of the IC it is quite easy to just tie all of them to GND.
As I explained in a previous post, I did experience issues when I left the EA pin floating.

Hi All
Im using stm32 as MCU the software is keil and CUBE MX as package.
Anyone have library mfrc522 i2c interface (.c & .h)?
please help me..