This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC_T4T_EVENT_NDEF_READ event not working every time

Hello,

i am working on an app using Android to read and write an NDEF record using SDK 14 type 4 tag.

I start the process by reading the record with the following Android sequence:

Ndef ndef = Ndef.get(mTag);
ndef.connect();
NdefMessage ndefMessage = ndef.getNdefMessage();
ndef.close();

This produces an NFC_T4T_EVENT_NDEF_READ event on the Nordic side as expected.

After this, i write a record to the NRF52. The record is received. This produces an NFC_T4T_EVENT_NDEF_UPDATED event as expected.

After this, i update the record on the NRF52. Then i read the record with the exact same sequence as before. This time, no NFC_T4T_EVENT_NDEF_READ event is produced, even though my debugs in hal_nfc_t4t.c clearly show, that the record is read and sent properly to the Android device.

Is this some known feature or bug? It seems that only one NFC_T4T_EVENT_NDEF_READ event is produced per session when using Android Ndef library. After the NRF52 NFC interface has been reset, i can get one event. The record read works just fine, and the Android SW receives the correct data. Only the event is missing, which i need for my control flow.

Has anyone else encountered this problem, and found a solution or at least a workaround?

BR, tommi

  • Ok. Now i actually understood your earlier comment, even though i read it multiple times before. The once per session part did not hit me at first :)

    What is the cause of this implementation? Why is this only once per session?

    I will have to work out a way to cheat the NRF52 to think that the session has ended to be able to reproduce the event and get on with my application.

    BR tommi

  • Well, we did not see any valid use case for such implementation. However, the NFC_T4T_EVENT_NDEF_READ event generation will be changed in future SDK releases. This event will appear when the last byte of NDEF message is read (without once per session limitation).

    If you are interested in using NFC to exchange the data without the use of NDEF layer, you can use NFC T4T Library In Raw mode. The data is transfered in this case using just the ISO-DEP protocol. There is an nfc_uart example that shows how to exchange custom data over NFC. And Android SDK also provides API for ISO-DEP exchanges.

  • Hi,

    If you are still interested in this functionality, you may consider switching to the newest nrf5 SDK (v15.0.0). Here is an excerpt from release notes:

    "Modified behavior of the NFC_T4T_EVENT_NDEF_READ event: the event is always triggered when the last byte of the NDEF File is sent to an NFC Reader device - even if the Reader repeats the read operation multiple times in one session, i.e. before the Reader sends a DESELECT or SLP_REQ frame."

    The NFC_T4T_EVENT_NDEF_READ event behaviour should be improved now, so you can give it a try.

Related