Host Card Emulation example (HCE)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Host Card Emulation example (HCE)

2,764 Views
gytiskazlauskas
Contributor II

Hello,

      I am trying to run NfcrdlibEx8_HCE_T4T example to emulate NFC Forum Type 4 Tag. Till now I am able to write and read NDEF Message from other reader (also PN7462), but the problem I am facing is that I also want to read message inside my card emulation reader and print to console, but  I don't understand how can I do that. I assume that DEBUG_PRINTF(); function should be in Application thread after AppProccessCmd(); Before calling that in AppProcessCmdCallback() I update the file :

uint8_t Data[16];  // create variable for saving the data from file.(this variable global)

(void)memcpy(Data, pRxData, wRxDataLen);

(void)memcpy(&pSelectedFile[dwFileOffset], pRxData, wRxDataLen);

where I understand that NDEF meesage received from other reader is in pRxData so with memcpy function I copy that message to Data variable and later on trying to print it but I get empty message.

Other question would be is it possible to send message back from card emulation reader to other device (reader)? Because after all I want to achieve bi-directional communication between two readers.

Thank you

I am using:

I am using PN7462 two boards (these kits: https://www.digikey.com/catalog/en/partgroup/pn7360-pn7362-pn7462-nfc-controller-development-kit/602...)

PN7462AU FW & SW Examples Full Version - v05_02_01

MCUXpresso IDE v10.0.2 [Build 411] [2017-07-11]

Labels (1)
0 Kudos
2 Replies

1,892 Views
IvanRuiz
NXP Employee
NXP Employee

Hello,

I flashed one reader with NFC Forum example and the second one with HCE_T4T, now I am able to see the NDEF message (‘www.nxp.com’) of the example on the console of the reader flashed with NFC Forum example.

pastedImage_1.png

It is being detected as a Type 4A Tag (as it should). Please take a look at those examples and the way they work, in the HCE side where the message is set and in the NFC Forum reader, where the NDEF message is being stored and printed in the console. If you want to work with a bi-directional communication, they should work in peer-to-peer mode also possible in NFC Forum example.

 

Regards,

Ivan.

0 Kudos

1,892 Views
gytiskazlauskas
Contributor II

Hello IvanRuiz,

            I try the same thing and already achieved that I can Read/Write to emulation card but also I can send from emulation card. I achieved that by creating three variables (in host card emulation reader):

uint8_t filedata[10];    //For saving received message from other reader.
uint8_t ResponseMess[16] = {0x00, 0x10, 0xD1, 0x01, 0x05, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00}; // For  setting NDEF message header
uint8_t  lop[8];  // Message which I want to send from host card emulation reader
And I use them in AppProcessCmdCallback();
(void)memcpy(&filedata[0], pRxData, wRxDataLen);  // Copy reveived message to filedata variable
(void)memcpy(&ResponseMess[6], lop, sizeof(lop));  // Make message which I want to send (Header + Message)
(void)memcpy(&pSelectedFile[dwFileOffset], ResponseMess, sizeof(ResponseMess)); // Sending Message to other reader
But I don't really understand why I get hardfault if I am trying to print some results from callback function to the console?  Otherwise I wont need to use these variables and I could print immediately from callback function. 
0 Kudos