<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60790/update-nfc-content-on-the-fly</link><description>I want update NFC payload on-the-fly. 
 My test firmware based on nRF5_SDK_14.2.0_17b948a\examples\nfc\record_text (unable to update SDK. Legacy part.) 
 At firmware start: 
 
 
 I am try update NFC payload: 
 
 nfc_t2t_payload_set is return NRF_ERROR_INVALID_STATE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 May 2020 13:29:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60790/update-nfc-content-on-the-fly" /><item><title>RE: Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/thread/251729?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 13:29:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9a7c0d5-624c-492c-88a2-2d6eaa9f2ec6</guid><dc:creator>Batov</dc:creator><description>&lt;p&gt;I have found a issue.&lt;/p&gt;
&lt;p&gt;Details at nRF5_SDK_14.2.0\components\nfc\t2t_lib\nfc_fixes.h.&lt;/p&gt;
&lt;p&gt;I do not have BOARD_PCA10040 define for my custom board.&lt;/p&gt;
&lt;p&gt;HAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND define fix my issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/thread/249280?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 17:19:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fb33171-71da-45ed-8fe4-5604c2171544</guid><dc:creator>Batov</dc:creator><description>&lt;p&gt;Thanks a lot for you help!&lt;/p&gt;
&lt;p&gt;You example works fine for my case. I will try find issue at my code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/thread/248735?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 13:34:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0c74639-07de-46a3-92d9-f5a93db79c1b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I made a modified version of the NFC record_url example, but I&amp;#39;m not able to reproduce the issue you are seeing:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: NFC URL start
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_OFF
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_stop
&amp;lt;info&amp;gt; app: nfc_t2t_emulation_start
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_ON
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_DATA_READ
&amp;lt;info&amp;gt; app: NFC_T2T_EVENT_FIELD_OFF&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the project I used (SDK 14.2.0):&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-22766f6639964f7c9020c66006426ccc/record_5F00_url_5F00_update.zip"&gt;devzone.nordicsemi.com/.../record_5F00_url_5F00_update.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Can you share the project you used to reproduce this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/thread/247394?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 14:57:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:049b5c1e-e453-458e-9e87-593befdfcf12</guid><dc:creator>Batov</dc:creator><description>&lt;p&gt;I have call nfc_t2t_emulation_stop from application context.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nfc_init(&amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;);
nrf_delay_ms(5000);
nfc_start(&amp;quot;3&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nfc.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void nfc_callback(void * p_context, nfc_t2t_event_t event, const uint8_t * p_data, size_t data_length)
{
    (void)p_context;

    switch (event)
    {
        case NFC_T2T_EVENT_FIELD_ON:
            NRF_LOG_DEBUG(&amp;quot;NFC_T2T_EVENT_FIELD_ON&amp;quot;);
            break;
        case NFC_T2T_EVENT_FIELD_OFF:
            NRF_LOG_DEBUG(&amp;quot;NFC_T2T_EVENT_FIELD_OFF&amp;quot;);
            break;
        case NFC_T2T_EVENT_DATA_READ:
			NRF_LOG_DEBUG(&amp;quot;NFC_T2T_EVENT_DATA_READ&amp;quot;);
			break;
        case NFC_T2T_EVENT_STOPPED:
			NRF_LOG_DEBUG(&amp;quot;NFC_T2T_EVENT_STOPPED&amp;quot;);
			break;
        default:
            break;
    }
}

void nfc_init(char *p_fw_ver, char *p_hw_rev)
{
	NRF_LOG_DEBUG(&amp;quot;NFC init&amp;quot;);

	uint32_t  err_code;
	uint32_t  len = sizeof(m_ndef_msg_buf);

	err_code = nfc_t2t_setup(nfc_callback, NULL);
	APP_ERROR_CHECK(err_code);

	err_code = msg_encode(m_ndef_msg_buf, &amp;amp;len);
	APP_ERROR_CHECK(err_code);

	err_code = nfc_t2t_payload_set(m_ndef_msg_buf, len);
	APP_ERROR_CHECK(err_code);

	err_code = nfc_t2t_emulation_start();
	APP_ERROR_CHECK(err_code);
}

void nfc_start(char *test)
{
	NRF_LOG_DEBUG(&amp;quot;NFC start&amp;quot;);

	uint32_t  err_code;
	uint32_t  len = sizeof(m_ndef_msg_buf);

	err_code = nfc_t2t_emulation_stop();
	NRF_LOG_DEBUG(&amp;quot;nfc_t2t_emulation_stop: 0x%x&amp;quot;, err_code);

	err_code = msg_encode(m_ndef_msg_buf, &amp;amp;len);
	APP_ERROR_CHECK(err_code);

	err_code = nfc_t2t_payload_set(m_ndef_msg_buf, len);
	APP_ERROR_CHECK(err_code);

	err_code = nfc_t2t_emulation_start();
	APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;logs with issue:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; [00000000] &amp;lt;debug&amp;gt; NFC: NFC init
00&amp;gt; [00001374] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_FIELD_ON
00&amp;gt; [00001491] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_DATA_READ
00&amp;gt; [00005110] &amp;lt;debug&amp;gt; NFC: NFC start
00&amp;gt; [00005110] &amp;lt;debug&amp;gt; NFC: nfc_t2t_emulation_stop: 0x0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;logs without issue:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; [00000000] &amp;lt;debug&amp;gt; NFC: NFC init
00&amp;gt; [00003898] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_FIELD_ON
00&amp;gt; [00004017] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_DATA_READ
00&amp;gt; [00004402] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_FIELD_OFF
00&amp;gt; [00005014] &amp;lt;debug&amp;gt; NFC: NFC start
00&amp;gt; [00005014] &amp;lt;debug&amp;gt; NFC: nfc_t2t_emulation_stop: 0x0
00&amp;gt; [00009423] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_FIELD_ON
00&amp;gt; [00009541] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_DATA_READ
00&amp;gt; [00009806] &amp;lt;debug&amp;gt; NFC: NFC_T2T_EVENT_FIELD_OFF&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Issue: Unable to update NFC payload after NFC_T2T_EVENT_FIELD_ON event. Tag is unavailable for any readers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NFC content on-the-fly</title><link>https://devzone.nordicsemi.com/thread/247344?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 12:44:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfdf12c7-5c8c-4575-a03f-eabac169a4ef</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did you check the return code from call to nfc_t2t_emulation_stop? It may be that you cannot call these functions from interrupt context. Can you try to set a flag in the event handler, and do the payload update in the main context?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>