<?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>nrf9160 - NVS read/write error code 22</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68215/nrf9160---nvs-read-write-error-code-22</link><description>Hi, I&amp;#39;m working on an application (Zephyr) that uses nvs storage and it&amp;#39;s been working just great for awhile (months) without any major issues. Today I noticed that when reading or writing using nvs_read or nvs_write, I am suddenly getting a return code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Nov 2020 16:36:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68215/nrf9160---nvs-read-write-error-code-22" /><item><title>RE: nrf9160 - NVS read/write error code 22</title><link>https://devzone.nordicsemi.com/thread/279574?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 16:36:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16af4049-af39-400c-a194-725ebb0495f3</guid><dc:creator>ryan_g</dc:creator><description>&lt;p&gt;I can&amp;#39;t verify if the full erase would resolve the issue since it seems to be fixed now.&lt;/p&gt;
&lt;p&gt;I am thinking it is related to the sector_count + size definitions since I was defining the sector_count = 7 and the sector_size is 4096 with the offset being at 0x000FA000 (limit being 0x000FF000). I was pointed down this path from &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48781/nrf9160-nvs-errors-out-when-using-different-sector-counts"&gt;this post&lt;/a&gt; and am guessing that the issue I was seeing was the address I was trying read/write from was on a sector that was out of the address range.&lt;/p&gt;
&lt;p&gt;This would cause an error which happened to be -22 and would explain why the sample application worked, it was only using 3 sectors and they would be within the allowed range and accessing the IDs that were out of the sector range, updated them to be within the right address space.&lt;/p&gt;
&lt;p&gt;Does this seem probable as to what was happening?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 - NVS read/write error code 22</title><link>https://devzone.nordicsemi.com/thread/279493?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 13:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ac7c350-dd25-4874-a09a-05e8af3698eb</guid><dc:creator>Kenneth</dc:creator><description>[quote user=""]Technically the issue is &amp;#39;resolved&amp;#39; now but now I&amp;#39;m not sure why it was even happening in the first place or why I needed to run the sample app to fix the issue.[/quote]
&lt;p&gt;Good to hear that it now works, I don&amp;#39;t know why there initially was an issue no. Maybe do a full erase (e.g. nrfjprog --eraseall --coprocessor CP_APPLICATION) of the application and check that it is indeed resolved?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>