i've bought the pn532 breakout board couple of months ago, and now wanted to start with it.
I'm using a PIC18F4520 mcu and connected it via I2C (voltage level is 3.3V, PullUps included, communication works fine).
My goal is to emulate a mifare card with the pn532, so that i can read data with a nfc - enabled smartphone.
For starters, i want to read the mifare card which was included in the breakout board (mifare one IC, 8K Bit EEPROM).
Communication works, the pn532 acks the command, and returns status byte / return command, but the InListPassiveTarget (D4 4A 01 00 h) response tells me that there is no target detected. I've tried another mifare card (from the 2nd board i ordered) but it doesn't work either.
Can someone have a look at my code bulding the frame (to avoid a simple mistake there..):
- Code: Select all
unsigned int dataArray2[] = {0x4A, 0x01, 0x00};
const int dataLength = 3;
int count = 0;
int dataFrame[dataLength + FRAME_OVERHEAD];
//preamble
dataFrame[0] = 0x00;
//start code
dataFrame[1] = 0x00;
dataFrame[2] = 0xFF;
//LEN = length data + 1(TFI byte = frame identifier = 0xD4)
dataFrame[3] = dataLength + 1;
//length checksum LCS, lower byte of [LCS + LEN] = 0x00
dataFrame[4] = (256 - (dataLength + 1));
//TFI
dataFrame[5] = 0xD4;
//insert data into the frame
for(i = 0; i < dataLength; i++) {
dataFrame[6 + i] = dataArray2[i];
}
//calculate DCS checksum, lower byte of [TFI + Data + DCS] = 0x00
unsigned int dataChecksum = 256 - 0xD4;
for(i=0; i< dataLength; i++) {
dataChecksum -= dataArray2[i];
}
dataFrame[6 + dataLength] = dataChecksum;
//postamble, end of data
dataFrame[7 + dataLength] = 0x00;
Any help or hint will be appriciated.
Greetings from germany.
Jul
€dit: I hope this is the right sub-forum, if not: please relocate the thread.

