A question arose in the process of reading card information by applying the RFID RC522 module to a beaglebone board, not an Arduino.
First, codes such as initializing the RFID RC522 module, checking whether a taggable card exists, and reading card UID information were written.
At this time, each data was read into tx_data using the unique data pattern values (0x0F, 0x52, 0x93) of RFID RC522.
Can you get the information you want using the data pattern command values mentioned above?
// MFRC522 initialize
void MFRC522Init() {
uint8_t tx_data[] = {0x0F}; // Data value for sending softreset command to MFRC522
uint8_t rx_data[sizeof(tx_data)];
if (SpiTransfer(tx_data, rx_data, sizeof(tx_data)) < 0) {
printf("Failed to send SPI message\n");
return;
}
usleep(5000); // wait a while
}
// Check if the card exists
int PiccIsNewCardPresent() {
uint8_t tx_data[] = {0x52}; // Data pattern value for transmitting the corresponding function to MFRC522, 0x52 : find all the cards antenna area
uint8_t rx_data[sizeof(tx_data)];
memset(rx_data, 0, sizeof(rx_data));
if (SpiTransfer(tx_data, rx_data, sizeof(tx_data)) < 0) { // To determine whether card existence cannot be confirmed when SPI communication fails.
printf("Failed to transfer data\n");
return -1;
}
return rx_data[1];
}
// Read card UID information
int PiccReadCardSerial(uint8_t* uid) {
uint8_t tx_data[] = {0x93}; // Data pattern value for transmitting the corresponding function to MFRC522, 0x93 : election card
uint8_t rx_data[sizeof(tx_data)];
memset(rx_data, 0, sizeof(rx_data));
if (SpiTransfer(tx_data, rx_data, sizeof(tx_data)) < 0) {
printf("Failed to transfer data\n");
return -1;
}
memcpy(uid, &rx_data[1], 4);
return 0;
}
Solved! Go to Solution.
Hi @hhh_hy Yes, you can get the information you want using the data pattern command values mentioned above. The data pattern values (0x0F, 0x52, 0x93) are used to send specific commands to the RFID RC522 module. Here's a brief explanation of each command:
The code snippets you provided are using these data pattern command values correctly. The functions MFRC522Init(), PiccIsNewCardPresent(), and PiccReadCardSerial() are sending the respective commands to the RFID RC522 module and processing the responses accordingly.
As long as the SPI communication between the BeagleBone board and the RFID RC522 module is working correctly, you should be able to get the desired information (card presence and UID) using these data pattern command values.
Kind Regards,
This project interfaces the MFRC522 RC522 RFID reader with Arduino and reads NUIDs of MIFARE-compatible cards and key fobs. We also demonstrate a simple ... New Subway Menu and its prices
Hi @hhh_hy Yes, you can get the information you want using the data pattern command values mentioned above. The data pattern values (0x0F, 0x52, 0x93) are used to send specific commands to the RFID RC522 module. Here's a brief explanation of each command:
The code snippets you provided are using these data pattern command values correctly. The functions MFRC522Init(), PiccIsNewCardPresent(), and PiccReadCardSerial() are sending the respective commands to the RFID RC522 module and processing the responses accordingly.
As long as the SPI communication between the BeagleBone board and the RFID RC522 module is working correctly, you should be able to get the desired information (card presence and UID) using these data pattern command values.
Kind Regards,