<?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>ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/128077/zms-data-loss-ate-id-0x1a80-overwritten</link><description>Environment: nRF54 SDK v3.0.0, Zephyr Memory Storage (ZMS) 
 
 Config: 4 sectors &amp;#215; 4KB = 16 KB partition 
 
 Record IDs involved: 0x1A80 (SRAP data, 253 bytes), 0x1A21 (pairing info, 408 bytes) 
 
 Observed behavior: Data is correct after power-on. After</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 May 2026 07:41:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/128077/zms-data-loss-ate-id-0x1a80-overwritten" /><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566383?ContentTypeID=1</link><pubDate>Fri, 15 May 2026 07:41:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d01100d-cf82-415f-8ac3-72b932af78b5</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have not been able to run it. I would need the rest of your application (the minimal sample to reproduce the issue).&lt;/p&gt;
&lt;p&gt;Can you zip the application folder where you tested this (including the CMakeLists.txt, prj.conf, board files, if any, etc...) and upload that here, so that I can build it for nrf54l15dk/nrf54l10/cpuapp and flash it to an nRF54l15 DK and reproduce the issue please?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566381?ContentTypeID=1</link><pubDate>Fri, 15 May 2026 07:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e96e28c-750c-4c51-a0d1-9ea9a9401c20</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;Hi, is this issue reproducible? Awaiting your feedback.&lt;/p&gt;
&lt;p&gt;Beat regards&lt;/p&gt;
&lt;p&gt;Pang&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566365?ContentTypeID=1</link><pubDate>Thu, 14 May 2026 06:57:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc5b6319-aacb-477f-97e3-03517e92f2ef</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The file zms_test.ccontains a minimal code snippet to reproduce the issue.&lt;br /&gt;Could you please take a look and let me know if you can replicate the behavior on your side?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/zms_5F00_test.c"&gt;devzone.nordicsemi.com/.../zms_5F00_test.c&lt;/a&gt;Beat regards&lt;br /&gt;Pang&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566327?ContentTypeID=1</link><pubDate>Wed, 13 May 2026 11:24:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d32546b9-a416-4c67-899c-399f8100eb80</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Can you upload the application that you are using to reproduce the issue please?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566324?ContentTypeID=1</link><pubDate>Wed, 13 May 2026 11:06:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cee22a8f-7c3e-4a15-b026-9227c5e91aab</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;&lt;span&gt;Got it. Here is the test case I used to reproduce the issue:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I wrote a function that directly calls our ZMS library APIs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Setup:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Mount ZMS with &lt;/span&gt;&lt;span&gt;4 sectors&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Erase all sector contents before starting.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Steps to reproduce:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;After mounting ZMS, write one entry with a length &lt;/span&gt;&lt;span&gt;greater than 8 bytes&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Trigger &lt;/span&gt;&lt;span&gt;3 GC cycles&lt;/span&gt;&lt;span&gt;, then power off (to force a full remount on the next boot).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;After reboot, read the entry &amp;mdash; the data is correct at this point.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Write one more different entry.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Result: the previously written entry is corrupted/overwritten.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;I also ran our real application using the same workflow, and the issue reproduces reliably there as well.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Beat regards&lt;/p&gt;
&lt;p&gt;Pang&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566297?ContentTypeID=1</link><pubDate>Wed, 13 May 2026 06:44:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ddb522f-d510-48a6-8d86-468b2077b3c7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I see. Thank you for clarifying. It may be that this is a bug that is in fact not yet patched. However, I can&amp;#39;t say without being able to reproduce the issue. Is it possible for you to give an application that reproduces the issue? You can strip out sensitive information if you prefer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566289?ContentTypeID=1</link><pubDate>Wed, 13 May 2026 02:12:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:799494cd-5ab4-4c62-81a3-77c6a4fb6950</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the suggestion. We tried adding the ebw_required check as you recommended, but unfortunately the data corruption still occurs 100% of the time with our test case.&lt;/p&gt;
&lt;p&gt;Just to clarify, the current code in NCS v3.0.0 already includes the byte-by-byte erase_value check in the while loop (lines 1249-1268 in zms_init). So our test was already running with that logic in place.&lt;/p&gt;
&lt;p&gt;The core issue we&amp;#39;re seeing is that after recovery with gc_done_marker = true, writing one more entry overwrites existing data. We&amp;#39;ve confirmed this is directly related to zms_recover_last_ate() starting its scan at the wrong position.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the layout we consistently see in the active sector after GC + power loss:&lt;/p&gt;
&lt;p&gt;- sector_end - ate_size: empty_ate&lt;br /&gt;- sector_end - 2*ate_size: close_ate&lt;br /&gt;- sector_end - 3*ate_size: valid data ATE &amp;larr; MISSED by zms_recover_last_ate&lt;br /&gt;- sector_end - 4*ate_size: scan starts here&lt;/p&gt;
&lt;p&gt;The function receives addr pointing to the close_ate position (sector_end - 2*ate_size), then does &amp;quot;*addr -= 2 * fs-&amp;gt;ate_size&amp;quot;, which places the scan start at sector_end - 4*ate_size. This skips the valid ATE at sector_end - 3*ate_size every time.&lt;/p&gt;
&lt;p&gt;Here is the relevant code in zms_recover_last_ate():&lt;/p&gt;
&lt;p&gt;/* skip close ATE */&lt;br /&gt; *addr -= 2 * fs-&amp;gt;ate_size; // addr = sector_end - 2*ate_size (close_ate)&lt;br /&gt; // After -= 2: sector_end - 4*ate_size &amp;larr; starts here&lt;br /&gt; // Skips sector_end - 3*ate_size &amp;larr; MISSED!&lt;/p&gt;
&lt;p&gt;ate_end_addr = *addr;&lt;br /&gt; data_end_addr = *addr &amp;amp; ADDR_SECT_MASK;&lt;br /&gt; *data_wra = data_end_addr;&lt;/p&gt;
&lt;p&gt;while (ate_end_addr &amp;gt; data_end_addr) {&lt;br /&gt; // scan downward from sector_end - 4*ate_size&lt;br /&gt; // NEVER reaches sector_end - 3*ate_size&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;Here is the actual flash dump from the active sector after recovery with gc_done_marker = true:&lt;/p&gt;
&lt;p&gt;Address Content (hex) Interpretation&lt;br /&gt;------ ----------------------------------------------------------------- -------------------------------&lt;br /&gt;4080 54 2E FF FF FF FF FF FF 00 00 00 00 01 42 00 00 Empty ATE (cycle=0x2E)&lt;br /&gt;4064 67 2D 00 00 FF FF FF FF A0 0D 00 00 FF FF FF FF close_ATE (cycle=0x2D, offset=3488)&lt;br /&gt;4048 D0 2E FD 00 80 1A 00 00 00 00 00 00 00 00 00 00 ID=0x1A80, len=253, offset=0, cycle=0x2E &amp;larr; MISSED by scan&lt;br /&gt;4032 C7 2E 04 00 05 1A 00 00 01 00 00 00 00 00 00 00 ID=0x1A05, len=4 (inline), cycle=0x2E&lt;br /&gt;4016 F1 2E 00 00 FF FF FF FF 00 01 00 00 FF FF FF FF GC_DONE (cycle=0x2E, offset=256)&lt;br /&gt;4000 A1 2E 98 01 21 1A 00 00 00 00 00 00 00 00 00 00 ID=0x1A21, len=408, offset=0, cycle=0x2E&lt;/p&gt;
&lt;p&gt;Because the ATE at 4048 is missed, zms_recover_last_ate starts at 4032 and only finds the ATEs below it. The last data ATE it finds (0x1A21 at 4000) has offset=0, so data_wra gets reconstructed as aligned_size(408), completely ignoring that 0x1A80&amp;#39;s data at offset=0 with len=253 already occupies that region. When the next write happens, data_wra points to the wrong location and overwrites existing data.&lt;/p&gt;
&lt;p&gt;When we change &amp;quot;-= 2&amp;quot; to &amp;quot;-= 1&amp;quot;, the scan correctly includes the ATE at 4048, and writing one more entry no longer corrupts data.&lt;/p&gt;
&lt;p&gt;Could you please take another look at this? I understand the code hasn&amp;#39;t changed in v3.3.0, but our reproducible test case consistently shows the data ATE at sector_end - 3*ate_size being missed, leading to incorrect data_wra reconstruction and subsequent data overwrite. The dump above clearly shows this happening.&lt;/p&gt;
&lt;p&gt;Thanks again for your time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566271?ContentTypeID=1</link><pubDate>Tue, 12 May 2026 13:58:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2cbaee1-d871-40ce-b962-e3aff83a76bd</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am not convinced that would be the proper fix. I am more afraid of there being a bug in the state machine, where if a GC or recovery fails, or something like that. Perhaps changing the -2 to -1 masks away the error, but I would not say that it is a proper solution. Particularly since this is still the same value in the latest NCS release (v3.3.0), I wouldn&amp;#39;t change that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you try to apply this commit:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/commit/a5f0c965c5efa9018d7e899bb7e2a12dd5d22bb1"&gt;https://github.com/zephyrproject-rtos/zephyr/commit/a5f0c965c5efa9018d7e899bb7e2a12dd5d22bb1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And see if the issue still persists? Remember to revert the -1 to -2 in this snippet:&lt;br /&gt;&lt;span&gt;/* skip close and empty ATE */&lt;/span&gt;&lt;br /&gt;&lt;span&gt;*addr -= 2 * fs-&amp;gt;ate_size;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566248?ContentTypeID=1</link><pubDate>Tue, 12 May 2026 10:33:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f3b6e2b-c467-46e4-98c0-3e4b3a49352e</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi ，&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I haven&amp;rsquo;t tested this on &lt;/span&gt;&lt;span&gt;NCS v3.1.0&lt;/span&gt;&lt;span&gt; yet. Adopting the change may involve additional evaluation and testing of some related interfaces.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However, I compared the &lt;/span&gt;&lt;span&gt;ZMS-related code&lt;/span&gt;&lt;span&gt; between the currently used &lt;/span&gt;&lt;span&gt;NCS v3.0.0&lt;/span&gt;&lt;span&gt; (which consistently reproduces the issue) and &lt;/span&gt;&lt;span&gt;v3.1.0&lt;/span&gt;&lt;span&gt;, and I did not observe any changes in this part.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The test method described above can reproduce the problem &lt;/span&gt;&lt;span&gt;100% of the time&lt;/span&gt;&lt;span&gt;, and after applying the proposed modification, the issue no longer occurs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you please take a look and let me know if this fix looks reasonable?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Pang&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566245?ContentTypeID=1</link><pubDate>Tue, 12 May 2026 09:45:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d48f180-ce22-4060-bfc7-015d57aaa467</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;It could be related, but I can&amp;#39;t say 100% whether this will fix the issue. Can you try to run it in NCS v3.1.0 or later?&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566234?ContentTypeID=1</link><pubDate>Tue, 12 May 2026 08:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:deb8072c-559b-483f-886a-f22ef70aa293</guid><dc:creator>Pang0</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My colleague and I are working on a data corruption issue in ZMS together, and we now have a 100% reproducible test case.&lt;/p&gt;
&lt;p&gt;Setup: 3 sectors. Write ID=0x1A80 in the first sector, then keep writing other data entries. Manually monitor free space and trigger GC. After 2 GC cycles complete, power off and restart.&lt;/p&gt;
&lt;p&gt;After reboot, ID=0x1A80 has been correctly migrated to the active sector by GC &amp;mdash; reading it returns the correct data. However, if we then write ONE more entry (any new data), the data at 0x1A80 gets corrupted/overwritten.&lt;/p&gt;
&lt;p&gt;We tested this specifically when the code path `gc_done_marker = true` is hit during recovery.&lt;/p&gt;
&lt;p&gt;Looking at the zms code, I noticed something in zms_recover_last_ate() that I think might be related:&lt;/p&gt;
&lt;p&gt;/* skip close and empty ATE */&lt;br /&gt; *addr -= 2 * fs-&amp;gt;ate_size;&lt;/p&gt;
&lt;p&gt;The function is called during recovery with addr pointing to the close_ate position (sector_size - 2*ate_size). After subtracting 2*ate_size, the scan starts at sector_size - 4*ate_size. But this skips one valid ATE position at sector_size - 3*ate_size &amp;mdash; right below the close_ate.&lt;/p&gt;
&lt;p&gt;Could this cause data_wra to be reconstructed incorrectly during recovery after a GC + power loss, so that the next data write ends up overwriting existing data? Would the correct fix be to change &amp;quot;-= 2&amp;quot; to &amp;quot;-= 1&amp;quot;?&lt;/p&gt;
&lt;p&gt;Would appreciate any insights.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566200?ContentTypeID=1</link><pubDate>Mon, 11 May 2026 13:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3d3c7cc-6b65-4fda-9dd5-acd94f718653</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Some more context. There was a bug where if a partition was mounted after it&amp;#39;s initial mount, this could lead to a bug showing what you are seeing. But I am not 100% sure that is actually what you are seeing, which is why I would like to verify whether using NCS v3.1.0 has the same behavior or not.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ZMS Data Loss — ATE ID 0x1A80 Overwritten</title><link>https://devzone.nordicsemi.com/thread/566199?ContentTypeID=1</link><pubDate>Mon, 11 May 2026 13:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b30034c1-a0ce-4ea3-a0d3-2343e8a5cc7b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I suspect that this is patched in this commit:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/commit/15cbe9fd18e2a319811a3cd877f238543050da18"&gt;https://github.com/zephyrproject-rtos/zephyr/commit/15cbe9fd18e2a319811a3cd877f238543050da18&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which is included in NCS v3.1.0.&lt;/p&gt;
&lt;p&gt;Do you have an application where I can reproduce the issue on an nRF54L15 DK? Alternatively, can you see if running your application in v3.1.0 fixes the issue, or if it is still present?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>