Trying to communicate with my Android app. My app sends a 32 byte md5 hash back to the Arduino. However, when I receive the response apdu, the last 9 bytes are corrupted.
Here's the relevant part of my Arduino sketch:
uint8_t response[32];
uint8_t responseLength = sizeof(response);
if (nfc.inDataExchange(message, sizeof(message), response, &responseLength)) {
Serial.print("TYPECASTED RAW: ");
for (int i = 0; i < sizeof(response); i++) {
Serial.print((char)response[i]);
}
Serial.println(" ");
This outputs:
TYPECASTED RAW: e68d3f574009cbbe0111502ÿÿÿÿÿÿÿÿÿ
As you can see the last 9 bytes are wrong. Now, I turned on the debug mode in the Adafruit NFC I2C library and it outputs 'Status code indicates an error' when I send the apdu back.
Here's the relevant part of the NFC library that throws the status code:
if (pn532_packetbuffer[5]==PN532_PN532TOHOST && pn532_packetbuffer[6]==PN532_RESPONSE_INDATAEXCHANGE) {
if ((pn532_packetbuffer[7] & 0x3f)!=0) {
#ifdef PN532DEBUG
Serial.println("Status code indicates an error");
#endif
return false;
}
Anyone has any ideas as to why my last 9 bytes are corrupted?
Thanks in advance.