RFID MFRC522 - Component Update and Fix

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

RFID MFRC522 - Component Update and Fix

Post by Benj »

Hello,

We have had several reports over the years of problems with the MFRC522 component. We have recently managed to bring the component a bit more up to date and also confirmed that UID reading and MIFARE Read/Write is now up and running reliably.

The component has had some significant changes and so previously working programs might need a bit of refactoring to work with the new component.

Here is the latest component.
RFID_MFRC522.fcpx
(19.35 KiB) Downloaded 300 times
Copy to your “Flowcode 7/components” directory. If Flowcode is running then you must also restart Flowcode to load the component changes.

Here are two new example programs which have both been tested with MIFARE 1K type cards on an Arduino Uno platform.
MFRC522_UID_Test.fcfx
(15.27 KiB) Downloaded 304 times
MFRC522_Read_Write.fcfx
(24.67 KiB) Downloaded 300 times

User avatar
celebriums
Posts: 125
Joined: Sun Sep 25, 2016 3:50 pm
Has thanked: 71 times
Been thanked: 33 times
Contact:

Re: RFID MFRC522 - Component Update and Fix

Post by celebriums »

Hi Benj
Thank you for MFRC522 Components updates.
I will try this update shortly.
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

casper
Posts: 1
Joined: Wed Mar 06, 2019 12:07 pm
Contact:

Re: RFID MFRC522 - Component Update and Fix

Post by casper »

Hi Benj,
I am using an Arduino Uno with a RFID-RC522 board. I need to increase the gain on the RFID board to gain some distance . Apparently this can be done. Can you please advise how to do it in Flowcode 8.
Thank you

Reinier Ott
Posts: 8
Joined: Sat Mar 19, 2011 10:14 am
Been thanked: 1 time
Contact:

Re: RFID MFRC522 - Component Update and Fix

Post by Reinier Ott »

Hi Benj,

Is there any solution to use the new RFID_MFRC522.fcpx component for Flowcode v6 ?

In August of 2016 I find also bad data with the component RFID_MFRC522.fcpx component using the Arduno board.
(I will use to program a PIC 16f1937 with a multi programmer eb006)
I'm happy that there is a new component and hopefully this gives a solution for me after nearly 3 years.
I copied this recent component to my Flowcode 6 library. But I see that the component is not compatible. (Message : I have not the right license)

With kind regards and I hope that there is a solution for me.

Reinier

Reinier Ott
Posts: 8
Joined: Sat Mar 19, 2011 10:14 am
Been thanked: 1 time
Contact:

Re: RFID MFRC522 - Component Update and Fix

Post by Reinier Ott »

Dear Benj,

There are no any problems with the hardware connection. I use a PIC 16f1937 and a 3,3volt level separator of the MFRC522 board.

I tried your new routine and see that I can display the 4 bytes [0 to 3] of the UID of a 1k Mifare card as well. (compare it with my eb052) . This sounds good!

But I see still difference with the other bytes (no. 4 to 15) using the routine (same problem as in the year 2016 with the previous (old) routine of the MFRC522 ) using "ReadUIDByte(byte_number)" of the page 0 block
I Understand also that the 5th byte (= byte 4) is the BCC byte of a Mifare card and contains a XOR byte check to make clear if the 4 UID bytes are correctly.

For instance, one of a my tags gives the UID : 0xe4 , 0x09a, 0xf6, 0xb8 Thus, I expect a value of 0x30 as BCC check, but I get a value of 0x0b with the MFRC522 , why?
(but, in contradiction, my eb052 gives the expected value of 0x30 !)

Of course, because the routines of the macro RFID_MFRC522.fcpx are slightly different of the my existing RFID.fcpx (eb052) and it is possible that I'am unknown with it and use it wrong.
I tried also to use the routine ReadMifare(BlockAddress, Buffer, BufferIndex) but I have no documentation and tried to understand the routine with your example "MFRC_read_write.fcfx"
I interpreted the parameters as follow, but, of course, I'm not sure:
- Block address: Absolute address of a block (0 = UID of 16 bytes) to 63 of a 1k Mifare card
- Buffer: All 16 bytes contain of a block [ byte 0 to 15] , all preset to 0 (as I see in your example)
- Buffer index: Number of bytes : I set this parameter to 16
I supposed that after the action of "ReadMifare" the buffer must be filled with the 16 bytes of data and the returned byte value is the status only?
I tried the ReadMifare routine with many cards / tags on several block addresses , but they are always still 0x00. Of course, these tags are prewritten with my eb052 reader/writer.

My question is what does I wrong or what could be wrong? .

I appreciate your answer very well.

With kind regards.

Reinier Ott

rcott@dutch.nl

Reinier Ott
Posts: 8
Joined: Sat Mar 19, 2011 10:14 am
Been thanked: 1 time
Contact:

Re: RFID MFRC522 - Component Update and Fix

Post by Reinier Ott »

Dear Benj,

Unfortunately, I have the same behavior with the try version of flowcode 8.
Only the 4 UID bytes will be given properly, but other data is not clear for me. I Did not understand.

I Tried with several Mifare 1k card and a tag.

Especially the BCC check of byte 5 is good to show the mismatch.

Some examples of cards with the UID bytes of (in hex)
90 91 4D 6D : I expect 21, but I get 0B [hex]
D4 9A F6 B8 : I expect 30, but I get 0B [hex]
04 00 47 22 : I expect 61, but I get 0B [hex]
CA 3B A1 CB : I expect 9B, but I get 0B [hex]

With my eb052 board in fc6, I get the expected values.

Second test:
If I select block address 3 (sector 0) of the security part with unlocked (no key setting) cards: I expect the values of the 16 [hex] bytes : 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF but I get[hex] bytes : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

I Understand that the middle bytes : FF 07 80 are standing for fully card access and must be right for unwritten new cards. Also Key B is inverted from key A and must be also right.

With my eb052 board in fc6, I get the expected values.

Of course, it is possible that I did something dramatically wrong or understand not as well. I'm not an expert with RFiD indentification and I try to learn more about the 1k Mifare tags. (In 2015 I ordered the EB 829 Instruction book of Matrix)

I hope to understand why I did not get the good values. After understanding, I will try writing cards. Not before.

(I 'm also sent this message as private account, but I get not a return message that it was sending properly. sorry to perhaps sending twice)

Many thanks for your help.

With kind regards,

Reinier Ott
Attachments
ContentViewMF1_MFRC522_16F1937_reading_fc8.fcfx
(26.21 KiB) Downloaded 220 times

Post Reply