2023-09-23 12:57 PM
Hi,
I'm trying to read the UID of an RFID tag (ISO14443A) using an RFID click (CR95HF). Click board is communicating with PIC18F46Q43. I tried to use an example provided by the MPLAB MCC code configurator. The problem from the beginning is that the function below returns a response only after a second read request. On the second read request, the function returns "04 00 28 00 00 03 A1". This should be an answer from "26 07" and not after the second read request from "93 20 08".
Can someone please explain what am I doing wrong?
bool RFID_EXAMPLE_CheckNFCTag(void) // Call within while(1) loop in Main.c
{
// Read the tag ID
// [0] [1]
uint8_t passedData [2] = {0x26, 0x07};
uint8_t responseData [5] = {0};
uint8_t responseSize = 0x00;
RFID_SendCommand(RFID_SEND_RECV, sizeof(passedData), passedData);
RFID_BlockingReadReadyPollingSoftware();
responseSize = RFID_ReadCommand(responseData);
// [0] [1] [2]
uint8_t passedData2 [3] = {0x93, 0x20, 0x08};
RFID_SendCommand(RFID_SEND_RECV, sizeof(passedData2), passedData2);
RFID_BlockingReadReadyPollingSoftware();
responseSize = RFID_ReadCommand(responseData);
if(responseData[0] == 0x80)
{
memcpy(lastNfcIdTag, responseData + 1, 5); // Copy Id for Use
return true;
}
else
{
return false;
}
}