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

Determine the end of an NFC Write?

Is there a way to determine the end of an NFC write besides waiting for the NFC_T4T_EVENT_FIELD_OFF event? We want to update the NDEF message from within firmware after data is written but before the NFC_T4T_EVENT_FIELD_OFF event fires. We tried doing the update on NFC_T4T_EVENT_NDEF_UPDATED when data_length is greater than 0 in nfc_callback, but that doesn't work.

UpdateNdefMessage reads the ndef message that was just written to the device, and then updates the ndef message based on what was written.

Is there a way to determine when a write is finished without relying on NFC_T4T_EVENT_FIELD_OFF?

	static void nfc_callback(
  void          * context     __attribute__((unused)),
	nfc_t4t_event_t event       __attribute__((unused)),
	const uint8_t * data        __attribute__((unused)),
	size_t          dataLength  __attribute__((unused)),
	uint32_t        flags       __attribute__((unused)))
{
	switch (event)
	{
	case NFC_T4T_EVENT_NDEF_READ:
		break;
	case NFC_T4T_EVENT_NDEF_UPDATED:
		if (dataLength > 0)
		{
			UpdateNdefMessage();
		}
		break;
	default:
		break;
	}
}
Related