<?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>NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126895/nvs-write-fails-error--22-when-building-with-sysbuild</link><description>nRF54L15 - ncs 3.02 - toolchain 3.02 
 I changed my build settings from no sysbuild to sysbuild in order to use serial recovery and/or FOTA. I thought everything was OK until I tried saving settings to NVS where I now get error -22 
 (Before asking why</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Feb 2026 14:14:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126895/nvs-write-fails-error--22-when-building-with-sysbuild" /><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/561252?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2026 14:14:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f20b7603-63d2-4de5-acae-c80a4100cc80</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;Claude beat you to it I&amp;#39;m afraid. I have ditched using NV entirely as I found out I can just use Zephyr&amp;#39;s settings subsystem for persistent storage. All my settings data is stored in a single structure, so&amp;nbsp;&lt;span&gt;settings_save_one() and&amp;nbsp;settings_load_one() work for me.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/561249?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2026 13:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64a292ac-418f-4915-8895-e3760351ed17</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;I can confirm I&amp;#39;ve recreated this on the DFUTest sample you uploaded now. The error seems to come from the &lt;strong&gt;nvs_prev_ate&lt;/strong&gt;() in &lt;strong&gt;nvs&lt;/strong&gt;.c. The settings use one sector, the app can&amp;#39;t use three sectors of the storage_partition when using settungs, If you want/need to use the settings here, max sector_count can only be 2U with the following:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; fs.sector_size = info.size;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;fs.sector_count = 2U;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you change this, the error will be resolved. Moving over to sysbuild&amp;nbsp;&lt;strong&gt;and&lt;/strong&gt; adding the BT DIS settings is what toppled the application here. You can get a better overview of your systems storage and partitions in the &lt;strong&gt;memory&amp;nbsp;report&lt;/strong&gt;&amp;nbsp;which is part of the nRF Connect extension in VS Code.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/561086?ContentTypeID=1</link><pubDate>Fri, 13 Feb 2026 09:35:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08ad780b-4b06-41d5-8a24-f6640a67f600</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;I think you might be missing or maybe evading the point here...&lt;/p&gt;
&lt;p&gt;Yes the sample runs correctly, I actually ran the zms not nvs, but I&amp;#39;m sure both will work. As will Blinky and the rest of the samples - but that&amp;#39;s completely irrelevant to my actual problem!&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t stripped BLE from my project. I spent half a day stripping out code section by section until I ended up with the simplest bit of code that will reproduce my problem and that is what I have uploaded. I can&amp;#39;t upload the project itself as it contains a lot of proprietary IP including custom protocols, PSK etc. In this project I use a lot of subsystems including crypto, uart, i2c, gpio ppi, timers, GAP/GATT, DIS, wdt so you can appreciate it&amp;#39;s a bit of a headache trying to isolate conflicts.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/126895/nvs-write-fails-error--22-when-building-with-sysbuild/561074"]Probably because the NVS tries accessing addresses expected to be used by CONFIG_SETTINGS.[/quote]
&lt;p&gt;Is this speculation or something you know to be so? Sounds like a bug to me if two subsystems are trying to use the same memory especially considering it is all macro driven. If&amp;nbsp;true,&amp;nbsp;then surely all I have to do is adjust my NVS partition offset if there is a way to reliably do that at compile time or run time (I do NOT want to just choose some arbitrary value). Currently the offset is defined by macro:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NVS_PARTITION			storage_partition
#define NVS_PARTITION_DEVICE	FIXED_PARTITION_DEVICE(NVS_PARTITION)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Alternatively is there another way I can store 100 bytes or so non volatile? In hindsight I wish I had added an external EEPROM to my board but it&amp;#39;s too late for that now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/561074?ContentTypeID=1</link><pubDate>Fri, 13 Feb 2026 07:32:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d89f8e7-926c-43a1-b2b9-577a4da8765a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;If you stripped out BLE from your project, why would you also have configs for Bluetooth settings like&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_BT_DIS_SETTINGS"&gt;&lt;span&gt;CONFIG_BT_DIS_SETTINGS&lt;/span&gt;&lt;/a&gt;. I think the selection of the settings subsystem which this config sets is what causes it to fail on your end. Probably because the NVS tries accessing addresses expected to be used by CONFIG_SETTINGS.&lt;/p&gt;
&lt;p&gt;Have you used the NVS sample for reference to see how the NVS subsystem should be used. I&amp;#39;d try to get that up and running with sysbuild before incorporating the Bluetooth controller.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560937?ContentTypeID=1</link><pubDate>Wed, 11 Feb 2026 15:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6306f9d7-1483-4596-924b-cf51b9123348</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;So... I&amp;#39;ve stripped everything including BLE out of my project apart from one build (nRF54L15DK) and the NVS routine. Make sure the build has sysbuild enabled - it seems to revert if I make a copy of the folder.&lt;/p&gt;
&lt;p&gt;Every time I make a change I clean the build configuration, run a pristine build and erase the target before flashing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The NV write fails if I have&amp;nbsp;&lt;code&gt;CONFIG_BT_DIS_SETTINGS=y&lt;/code&gt; in my prj.conf&lt;/li&gt;
&lt;li&gt;If I comment it out it works&lt;/li&gt;
&lt;li&gt;If I change the build configuration to &amp;quot;No sysbuild&amp;quot; it works&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Zip attached...&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/DFUtest.zip"&gt;devzone.nordicsemi.com/.../DFUtest.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560867?ContentTypeID=1</link><pubDate>Wed, 11 Feb 2026 07:50:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15905efa-ca28-41ef-ae0c-3db13db93871</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you show me what parameters are being entered to the &lt;strong&gt;nvs_write&lt;/strong&gt;() function on your end, or potentially upload your project here (with instructions for how to build it on my end) so we can take a closer look at our end?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560837?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 18:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:049015e7-9a7c-4eed-b8e1-aae6c4bbd8e7</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;I&amp;#39;ve spent several hours looking at this now. There was a potential issue where I was compiling for 54L15 but my prototypes actually had 54L10 due to component shortages, but that&amp;#39;s now fixed (am building for 54L10) and it doesn&amp;#39;t make any difference.&lt;/p&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;NVS_PARTITION_DEVICE maps correctly to /soc/rram-controller@5004b000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;NVS_PARTITION_OFFSET matches the offset of the storage partition&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;My app compiles to 205k, so smaller than the partition slots. I am writing only 50 bytes or so to flash so no danger of overflow.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I hacked my code to write a simple array like so:&lt;pre class="ui-code" data-mode="text"&gt;	struct nvs_fs fs;
	struct flash_pages_info info;

	fs.flash_device = NVS_PARTITION_DEVICE; //&amp;amp;__device_dts_ord_122 maps to /soc/rram-controller@5004b000

	if (!device_is_ready(fs.flash_device)) {
		printk(&amp;quot;Flash device %s is not ready\n&amp;quot;, fs.flash_device-&amp;gt;name);
		return 1;
	}

	fs.offset = NVS_PARTITION_OFFSET; //0xfd000 matches storage in ram report
	rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &amp;amp;info);

	if (rc) {
		printk(&amp;quot;Unable to get page info, rc=%d\n&amp;quot;, rc);
		return rc;
	}

	fs.sector_size = info.size;
	fs.sector_count = 3U;
	rc = nvs_mount(&amp;amp;fs);

	if (rc) {
		printk(&amp;quot;Flash Init failed, rc=%d\n&amp;quot;, rc);
		return rc;
	}

	printk(&amp;quot;FS nvs mount rc %d\n&amp;quot;,rc);
	uint8_t test[100]={0x55};

	rc = nvs_write(&amp;amp;fs, 1, &amp;amp;test, sizeof(test));
	printk(&amp;quot;NVS write rc %d\n&amp;quot;,rc);

	return rc;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But I always get invalid argument error -22....?&lt;/p&gt;
&lt;p&gt;Here are the prj.conf entries related to flash&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#NVRAM / Flash
CONFIG_FLASH=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH_MAP=y
# Explicitly disable external flash drivers
CONFIG_SPI_NOR=n
CONFIG_NORDIC_QSPI_NOR=n

CONFIG_NVS=y
CONFIG_ZMS=n&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Just for fun I tried reverting back to ZMS but that doesn&amp;#39;t work either.&lt;/p&gt;
&lt;p&gt;Now I can&amp;#39;t think of anything else that may be the cause?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560767?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 09:42:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba85f445-6551-434d-853d-7238090ef61c</guid><dc:creator>Nick_RA</dc:creator><description>&lt;h1 id="mcetoc_1jh3e4jf80" class="css-g931ng"&gt;&lt;span style="font-size:75%;"&gt;Migrating from multi-image builds to sysbuild&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;I&amp;#39;ve had a look at that, it&amp;#39;s not a whole lot of help. My application wasn&amp;#39;t a multi-image build to start with until I changed to sysbuild. The Serial Recovery &amp;amp; DFU mechanisms obviously now generate multiple images but that&amp;#39;s done under the hood as far as I can tell.&lt;/p&gt;
&lt;p&gt;This all works fine for Blinky in the Dev Academy samples but not for NVS which needs to address a particular area of memory.&lt;/p&gt;
&lt;p&gt;The section that &lt;em&gt;does&lt;/em&gt; reference DFU also doesn&amp;#39;t say much. Here it is in its entirety:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Multi-image builds for DFU&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Support for creating multi-image build files for Device Firmware Update (DFU) was moved to sysbuild. The following Kconfig options are available:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Kconfig option&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Description&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_BUILD&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Enables building a DFU multi-image package&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_APP&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Include application update in package&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_NET&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Include network core image update in package&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_MCUBOOT&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Include MCUboot update in package&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;Include nRF70 firmware patch update in package&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;You must update your application to select the required Kconfig options at the sysbuild level to have this file generated.&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I do recall partition management was mentioned in one of the training presentations but can&amp;#39;t find it in the&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-1-dfu-over-uart/"&gt;DevAcademy&lt;/a&gt;&amp;nbsp;course.&lt;/p&gt;
&lt;p&gt;Also why does flash_get_page_info_by_offs() and&amp;nbsp;&lt;span&gt;nvs_mount&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;) return successfully but not nvs_write()?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560744?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 07:50:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f0d7583-c63d-4947-8dee-d83ec162ded4</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The parameters of &lt;strong&gt;nvs_write&lt;/strong&gt;() should be: a pointer to the file system, id of the entry to be written, pointer to the data to be written and number of bytes to be written. If either of these are invalid in your application, that will return a -22 error.&lt;/p&gt;
&lt;p&gt;Since it&amp;#39;s only an issue when using sysbuild, please go through the Sysbuild migration guide available here, as there are some changes necessary.&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity/migration/migration_sysbuild.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity/migration/migration_sysbuild.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560679?ContentTypeID=1</link><pubDate>Mon, 09 Feb 2026 14:31:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdd6ca43-5056-4889-bb6a-07459c277b40</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;The error is from&lt;/p&gt;
&lt;p&gt;&lt;code&gt;rc = nvs_write(&amp;amp;fs, NVS_SETTINGS_ADDR, &amp;amp;mybuf, sizeof(mybuf));&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;(ignore typo mybuff in original post)&lt;/p&gt;
&lt;p&gt;It works 100% fine if my build setting is &amp;quot;no sysbuild&amp;quot;, but fails if I build using sysbuild.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVS write fails error -22 when building with sysbuild</title><link>https://devzone.nordicsemi.com/thread/560665?ContentTypeID=1</link><pubDate>Mon, 09 Feb 2026 13:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70489473-4eec-4708-9ec8-8e9aed48f476</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The error message -22 points to an invalid argument being entered in whatever function is returning this error message. Can you share the log, what function returns error -22, and what you are inputting into this function on your end.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>