STM32F446 and MFRC522 Authenticate Function is not working.

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
celebriums
Posts: 42
http://meble-kuchenne.info.pl
Joined: Fri Dec 18, 2020 7:33 am
Has thanked: 23 times
Been thanked: 7 times

STM32F446 and MFRC522 Authenticate Function is not working.

Post by celebriums »

Hello Dear Flowcode Family

In my project with STM32F446 and MFRC522, while I can read unique IDs differently, I noticed that the Authenticate function is not working. The result of the Authenticate A function is always returning as an error. Even though I set the Authenticate keys to the default keys of six 0xFF, and tried other keys, I am unable to read these RFID cards in any way. When looking at the supported function, I can confirm through loops that this function is working correctly and can recognize the cards. I also uploaded a video regarding this issue. I am providing the link to this video below. Could you please provide information regarding topics related to this error? This is definitely not a simple mistake.

https://youtube.com/shorts/Y93zDFydUiU?feature=share
Attachments
STM32F446RE-RFID_READER.fcfx
(93.81 KiB) Downloaded 9 times

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: STM32F446 and MFRC522 Authenticate Function is not working.

Post by medelec35 »

Hello.
I know you are using a different target device to the training course.
You can change the target device, but the course has some examples, which did work for me when testing on PIC and Uno
The files can be downloaded from here
Select the Resources tab.

If no examples work for you then I will see if I can replicate your setup.
Martin

celebriums
Posts: 42
Joined: Fri Dec 18, 2020 7:33 am
Has thanked: 23 times
Been thanked: 7 times

Re: STM32F446 and MFRC522 Authenticate Function is not working.

Post by celebriums »

https://www.flowcode.co.uk/wiki/index.p ... (Wireless)
Dear Martin
I am doing it according to two examples here, by the way you can find the final version of the software in the attachment.

In 2 software: I did it by increasing the BlockAdress value sequentially but unfortunately the result is the same.

Autenticate
Read

MFRC522 reader is a very popular reader,


IsNewCardPresent.. is working
ReadCardSerial.. is working
GetTypeCard.. is working
ReadUIDByte.. 11. value= MIFARE SAK VALUE working
GetTypeCard.. working

Autenticate... command is not true working.. so ReturnValue=1 err

Command: RFID_MFRC522_V2 :: PICC_CMD_MF_AUTH_KEY_A
BlockAdress: 12,13,14,16,17,18
Key: AutkeyA ... {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}

MifareRead

BlockAdress:
Buffer:DataBufferIn
BufferSize:DataBufferSize
Attachments
STM32F446RE-RFID_READER_2.fcfx
(95.74 KiB) Downloaded 7 times

celebriums
Posts: 42
Joined: Fri Dec 18, 2020 7:33 am
Has thanked: 23 times
Been thanked: 7 times

Re: STM32F446 and MFRC522 Authenticate Function is not working.

Post by celebriums »

I think I found the error. Error in this component


ENABLE_CS;
WriteByte(0x12); // FIFODataReg address (write)

WriteByte(0x60); // Command: PICC_AUTH_KEY_A
WriteByte(0x04); // Block address (example: 4. block)
WriteByte(0xFF); // Key A (6 bytes)
WriteByte(0xFF);
WriteByte(0xFF);
WriteByte(0xFF);
WriteByte(0xFF);
WriteByte(0xFF);

WriteByte(UID[0]); // UID0
WriteByte(UID[1]); // UID1
WriteByte(UID[2]); // UID2
WriteByte(UID[3]); // UID3
DISABLE_CS;


Read UIDBytes for Autenticate cannot be written to this command. Since it is not written, the MFRC522 cannot process the correct command. When you open the component you will see that the UIDBytes variable is kept as 6 bytes. But in this command only
Command:
BlockAdress:
Key:

// Enable Mifare Auth Mode
FCV_RETVAL = FCD_08061_RFID1__Authenticate(96, 4, FCV_AUTHKEYA, 6);

but the read UID Unique ID number is not processed in this command.

You can find it if you examine the software I made, look inside the MFRC_AUTH_A macro.
I defined a 2nd SPI. I sent commands from there.

IRQ_Check (0x84)
ERROR_REG(0x86)
STATUS2REG (0x88) You will see if you examine the sections.
Attachments
STM32F446RE-RFID_READER_3.fcfx
(138.71 KiB) Downloaded 7 times

Post Reply