I am trying to customise a raw read transaction with a mifare card using a PN7150. I am using the NXP NCI MCUXpresso example project, which is successfully working with the device.
In the NXP-NCI MXUXpresso example project (detailed in AN11990) there is a function in nfc_task.c called PCD_MIFARE_scenario. The read section looks something like this:
void PCD_MIFARE_scenario (void)
{
#define BLK_NB_MFC 4
#define KEY_MFC 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
#define DATA_WRITE_MFC 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
bool status;
unsigned char Resp[256];
unsigned char RespSize;
/* Authenticate sector 1 with generic keys */
unsigned char Auth[] = {0x40, BLK_NB_MFC/4, 0x10, KEY_MFC};
/* Read block 4 */
unsigned char Read[] = {0x10, 0x30, BLK_NB_MFC};
/* Authenticate */
status = NxpNci_ReaderTagCmd(Auth, sizeof(Auth), Resp, &RespSize);
if((status == NFC_ERROR) || (Resp[RespSize-1] != 0))
{
PRINTF(" Authenticate sector %d failed with error 0x%02x\n", Auth[1], Resp[RespSize-1]);
return;
}
PRINTF(" Authenticate sector %d succeed\n", Auth[1]);
/* Read block */
status = NxpNci_ReaderTagCmd(Read, sizeof(Read), Resp, &RespSize);
if((status == NFC_ERROR) || (Resp[RespSize-1] != 0))
{
PRINTF(" Read block %d failed with error 0x%02x\n", Read[2], Resp[RespSize-1]);
return;
}
PRINTF(" Read block %d:", Read[2]); print_buf(" ", (Resp+1), RespSize-2);
Is there documentation for this command format? For example, how should I know that the AUTH command starts with 0x40, but the read command starts with 0x10? Where can I find out more about these raw commands?
Hi Joel Fergusson,
Hope you are doing great, please check the following document https://www.nxp.com/docs/en/user-guide/UM10936.pdf
here you can find the information regarding the commands and parameters needed for each. also if you want to know more about the structure of the commands you can check the NFC Forum NCI specification.
please let me know if you have more questions.
Have a great day !
Br
Jonathan