<?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>Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57666/ndef-library-multiple-records-update-issue</link><description>Hello, 
 I have multiple records that I want to update during the runtime of the program. 
 
 What is working: 
 1. I can write in memory for the first time initial values. 
 2. I can update all records and it works. 
 3. I can load all records and it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Mar 2020 10:28:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57666/ndef-library-multiple-records-update-issue" /><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/241078?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 10:28:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5448c5db-5093-4885-b690-e2905bf1b5f1</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;Forgot to put static buffer in load functions&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/240474?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2020 14:55:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ad13eb4-43ed-44ba-9473-29485a52ac9f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Lyris,&lt;/p&gt;
&lt;p&gt;I am sorry for the delay. It is a puzzle. Adding some logging for the&amp;nbsp;FDS_EVT_UPDATE and&amp;nbsp;FDS_EVT_WRITE events I see it is often missing, but I don&amp;#39;t understand why. I am sure there is a perfectly reasonable root cause for what is happening, but no progress so far, unfortunately.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/240277?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 14:08:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5da8635-71ff-48d7-85b7-a86f1552e13d</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;any update on this topic ?&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;lyris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/239490?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 10:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ee2005c-0f17-4b4d-b44f-bdb53ffbabbb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your example clearly demonstrates an issue, but I have yet not been able to understand what causes this behavior. I am adding the log from your unmodified example here for my own reference. I will look more into this and get back to you.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.
&amp;lt;info&amp;gt; app: BLE Thread template example started.
&amp;lt;info&amp;gt; app: Thread version   : OPENTHREAD/20180926-01143-g8a1992e2; NRF52840; Dec 10 2019 22:48:00
&amp;lt;info&amp;gt; app: Network name     : OpenThread
&amp;lt;info&amp;gt; app: Thread interface has been enabled.
&amp;lt;info&amp;gt; app: 802.15.4 Channel : 11
&amp;lt;info&amp;gt; app: 802.15.4 PAN ID  : 0xABCD
&amp;lt;info&amp;gt; app: Radio mode       : rx-on-when-idle
&amp;lt;info&amp;gt; app: Fast advertising.
&amp;lt;info&amp;gt; app: LOADING FLASH at counter = 1
&amp;lt;info&amp;gt; flash_memory: NDEF file record &amp;lt;info&amp;gt; app: State changed! Flags: 0x009C13A5 Current role: 4

&amp;lt;info&amp;gt; app: bar8        = 0xFF
&amp;lt;info&amp;gt; app: bar16       = 0xFFFF
&amp;lt;info&amp;gt; app: bar8_array  = 0xFFFFFFFFFFFF

&amp;lt;info&amp;gt; app: LOADING FLASH at counter = 120
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 0
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 1
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 2
&amp;lt;info&amp;gt; app: bar8        = 0xB
&amp;lt;info&amp;gt; app: bar16       = 0xB5B
&amp;lt;info&amp;gt; app: bar8_array  = 0xFFFFFFFFFFFF

&amp;lt;info&amp;gt; app: NOW UPDATING FLASH
&amp;lt;info&amp;gt; flash_memory: bar8 update
&amp;lt;info&amp;gt; flash_memory: bar16 update
&amp;lt;info&amp;gt; flash_memory: bar8_array update
&amp;lt;info&amp;gt; app: LOADING FLASH at counter = 280
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 0
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 1
&amp;lt;info&amp;gt; flash_memory: Found NDEF file record for id 2
&amp;lt;info&amp;gt; app: bar8        = 0x11
&amp;lt;info&amp;gt; app: bar16       = 0x1111
&amp;lt;info&amp;gt; app: bar8_array  = 0x111111111111&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/239272?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 08:58:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04bcd228-2534-4a87-8daa-71273448eb81</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;It is version nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b&lt;/p&gt;
&lt;p&gt;To test, run the code with ses and watch the NRF_LOG_INFO outputs. I have put some commentary to hopefully guide you in the code.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_thread_5F00_dyn_5F00_template-_2D00_-flash-test.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_thread_5F00_dyn_5F00_template-_2D00_-flash-test.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/239139?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 13:48:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f90abfe-3f63-4176-add9-0be711b39659</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is excellent. Can you upload it to this thread? Which Thread and Zigbee SDK version does it work with? What is the procedure to test it to reproduce the issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/239126?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 13:33:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16813a3e-8397-486a-9c50-6915aac72329</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;hello, I have made a complete example that reproduces the problem.&lt;/p&gt;
&lt;p&gt;It was done using the sdk thread and zigbee and can be put in $(sdk_source)/example/multiprotocol/nle_thread&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/234227?ContentTypeID=1</link><pubDate>Thu, 13 Feb 2020 14:59:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3dc9a277-47e1-462e-895c-7386b92b3655</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I fail to see the logic. Can you make a simple (but complete) that reproduces this that I can test?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/234035?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 15:41:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4462f65f-b1d1-4d28-90fb-44ed9155d4ff</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;1. In an init function called once before the main loop, you load the data stored in flash. If the records are already there, then they are loaded, otherwise a default value is written in flash with value 0xFF * size of the data.&lt;/p&gt;
&lt;p&gt;2. Now let&amp;#39;s say that the memory was empty, now we have 3 records like this in memory:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint8_t data1 = 0xff;
uint16_t data2 = 0xffff;
uint8_t data_array[3] = {0xff,0xff,0xff};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3. I want to update data1:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static buffer_for_data1[1];

data1 = 0x69;

buffer_for_data1[0] = data1;
ndef_file_update(buffer_for_data1, 1, record_id_of_data1);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;4. if I load data1 I get the correct value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;data1 = 0;

uint8_t load_buffer[1];

rc = ndef_file_load(load_buffer, 1, record_id_of_data1);

data1 = load_buffer[0]; // now we get data1 = 0x69 which is correct&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;5. If I now load data2 and data_array, I get a wrong value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// loading data2 and data_array:

data2 = 0x0434; // wrong! expecting 0xFFFF
data_array = 0x043412 // wrong! expecting 0xFFFFFF&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;6. If I update data2 and data_array, every thing is fine, no more error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/233998?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 13:46:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f58fcea3-e365-4cdf-8b71-ee0c18481878</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I do not see anything problematic in the code snippet. Your&amp;nbsp;ndef_file_update() only modifies the element given by &amp;quot;id&amp;quot; of m_record_desc and m_record, and&amp;nbsp;fds_record_update() will not change any other record. The only thing it will do is write a new record with the same key and file ID as the old (but with new content), and mark the old as dirty. Existing records will not be touched, and will remain in the same flash location until garbage collection is performed.&lt;/p&gt;
&lt;p&gt;Can you make a more complete example that demonstrates the issue that I can run on a DK on my side?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/233889?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 08:16:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f2abb7b-e6ee-40c5-90c4-5c8e1169ab0a</guid><dc:creator>lyris</dc:creator><description>&lt;p&gt;I have updated my post with the code. Hope it helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ndef library: multiple records update issue</title><link>https://devzone.nordicsemi.com/thread/233789?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 14:23:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74cba904-1387-45b4-9006-6d95031ffe37</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am having problems getting a full understanding. Can you elaborate a bit, and perhaps show us your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>