#include <SPI.h> // Serial Peripheral Interface
#include <cie_PN532.h> //For read CIE's NIS with PN532 NFC RFID Module
#define PN532_SCK (D5)
#define PN532_MISO (D6)
#define PN532_MOSI (D7)
#define PN532_SS (D4)
cie_PN532 cie(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);
word bufferLength = EF_ID_SERVIZI_LENGTH;
byte NIScode[EF_ID_SERVIZI_LENGTH];
void setup(void) {
Serial.begin(115200);
cie.begin();
}
void loop(void) {
bool cardDetected = cie.detectCard();
if (!cardDetected) {
//No card present, we wait for one
delay(100);
return;
}
//Good! A card is present, let's read the NIS!
if (!cie.read_EF_ID_Servizi(NIScode, &bufferLength)) {
Serial.print("Error reading EF.ID_SERVIZI"); Serial.println(); Serial.println();
delay(1000);
return;
}
Serial.print(F("EF.ID_Servizi: "));
String NIS_cie = "";
for(int n = 0; n < bufferLength; n++){
NIS_cie += String(NIScode[n]);
}
Serial.println(NIS_cie);
Serial.println("Read complete, you can remove the card now");
Serial.println();
}
I've the following issue:
Trying to read three different CIEs, one of these NIS cannot be read.
This is the output from Serial Monitor:
11:52:23.583 -> Tag number: 1
11:52:23.939 -> EF.ID_Servizi: 57<censored><censored>6
11:52:23.939 -> Read complete, you can remove the card now
11:52:23.939 ->
11:53:00.175 -> Tag number: 1
11:53:00.406 -> File or application not found 0x6A 0x82 //Error reading this second CIE's NIS
11:53:00.406 -> Couldn't select the IAS application
11:53:00.406 -> Error reading EF.ID_SERVIZI
11:53:00.406 ->
11:53:08.652 -> Tag number: 1
11:53:09.043 -> EF.ID_Servizi: 56<censored><censored>9
11:53:09.043 -> Read complete, you can remove the card now
11:53:09.043 ->
I'm using a ModeMCU - ESP8266 board with this NFC reader: https://it.aliexpress.com/item/33014782756.html?spm=a2g0s.9042311.0.0.6d6e4c4dy4vnIS
and running this code:
I've the following issue: Trying to read three different CIEs, one of these NIS cannot be read. This is the output from Serial Monitor:
How can I fix it?
Thank you in advance