<?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>Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75854/flash-address-change-issue-in-nrf-connect-sdk</link><description>Hi, 
 I need to store the 1kB of data in the flash storage and it need to be read anytime and change the data anywhere. 
 I am using nrf52840 DK and also nrf5340 DK to perform these Flash storage 
 I found the example code in this link 
 https://developer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 24 Jun 2021 12:53:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75854/flash-address-change-issue-in-nrf-connect-sdk" /><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/316997?ContentTypeID=1</link><pubDate>Thu, 24 Jun 2021 12:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ba4c3f1-366e-44d7-8f38-46ff18f8b079</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For how NVS works, please see the zephyr documentation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/storage/nvs/nvs.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/storage/nvs/nvs.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is more complex than writing to a specific address and reading that back. there is a specific protocol and behavior that is running behind the scenes here.&lt;/p&gt;
&lt;p&gt;If you want to write directly to the flash, you can look at the zephyr/samples/drivers/soc_flash_nrf/, although this does not integrate well into other applications that use flash storage modules (like storing bonds)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/316697?ContentTypeID=1</link><pubDate>Wed, 23 Jun 2021 11:34:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c9d79c3-b020-4922-83b5-8b3e214b694e</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Thanks for the fast response.&lt;/p&gt;
&lt;p&gt;I have one last question&lt;/p&gt;
&lt;p&gt;I worked in nRF5 SDK flash_fstorage&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int8_t mas[12];
      for (int i = 0; i&amp;lt;12; i++)
      {
          mas[i] = i+1;
      }
      /* Let&amp;#39;s write to flash. */
      NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%x\&amp;quot; to flash.&amp;quot;, mas);
      rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3f500, &amp;amp;mas, sizeof(mas), NULL);
      APP_ERROR_CHECK(rc);

      wait_for_flash_ready(&amp;amp;fstorage);
      NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);
    
    NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%s\&amp;quot; to flash.&amp;quot;, m_hello_world);
    rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3f000, m_hello_world, sizeof(m_hello_world), NULL);
    APP_ERROR_CHECK(rc);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Like this &lt;br /&gt;&lt;br /&gt;How can I write the array of data in the particular address &lt;/p&gt;
&lt;p&gt;example &lt;br /&gt;&lt;br /&gt;Storage partition &lt;br /&gt;Flash start : 0x7a000&lt;/p&gt;
&lt;p&gt;Flash size : 0x0006000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;i want to write the int8_t arr[1000]; to the particular 0x7b000&lt;br /&gt;&lt;br /&gt;How can i assign 0x7b000 to write the array data&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In nrf connect sdk&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define ADDRESS_ID 1
#define KEY_ID 2
#define RBT_CNT_ID 3
#define STRING_ID 4
#define LONG_ID 5



	/* ADDRESS_ID is used to store an address, lets see if we can
	 * read it from flash, since we don&amp;#39;t know the size read the
	 * maximum possible
	 */
	rc = nvs_read(&amp;amp;fs, ADDRESS_ID, &amp;amp;buf, sizeof(buf));
	if (rc &amp;gt; 0) { /* item was found, show it */
		printk(&amp;quot;Id: %d, Address: %s\n&amp;quot;, ADDRESS_ID, buf);
	} else   {/* item was not found, add it */
		strcpy(buf, &amp;quot;192.168.1.1&amp;quot;);
		printk(&amp;quot;No address found, adding %s at id %d\n&amp;quot;, buf,
		       ADDRESS_ID);
		(void)nvs_write(&amp;amp;fs, ADDRESS_ID, &amp;amp;buf, strlen(buf)+1);
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How the Address_ID 1&amp;nbsp; &lt;/p&gt;
&lt;p&gt;this 1 2 3 4 5&amp;nbsp; are noting Pages or any other how the address is assigned&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/316646?ContentTypeID=1</link><pubDate>Wed, 23 Jun 2021 08:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58f484bf-5825-4d90-b5e5-4e13c88da832</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Sunil vignesh"]if 0x7a000 then what is 0x00006000&amp;nbsp; (storage size?) how it calculate in kB.[/quote]
&lt;p&gt;0x7a000 is the start address, and 0x6000 is the size (1 page = 4k (0x1000), thus 6 flash pages).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Convert to decimal, and you will get the amount of bytes available in the given partition.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Sunil vignesh"]&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and if i change the start address from 0x7a000 to 0x7000 then what will be the storage size .&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;It will be out-of-bounds. you will go outside of the total flash area of the nRF52832.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/316635?ContentTypeID=1</link><pubDate>Wed, 23 Jun 2021 08:38:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:916137dd-5d6e-46ac-a97c-64f6c83af7ce</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt;I found this lines in nrf52dk_nrf52832.dts&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;boot_partition: partition@0 {
			label = &amp;quot;mcuboot&amp;quot;;
			reg = &amp;lt;0x00000000 0xc000&amp;gt;;
		};
		slot0_partition: partition@c000 {
			label = &amp;quot;image-0&amp;quot;;
			reg = &amp;lt;0x0000C000 0x32000&amp;gt;;
		};
		slot1_partition: partition@3e000 {
			label = &amp;quot;image-1&amp;quot;;
			reg = &amp;lt;0x0003E000 0x32000&amp;gt;;
		};
		scratch_partition: partition@70000 {
			label = &amp;quot;image-scratch&amp;quot;;
			reg = &amp;lt;0x00070000 0xa000&amp;gt;;
		};
		storage_partition: partition@7a000 {
			label = &amp;quot;storage&amp;quot;;
			reg = &amp;lt;0x0007a000 0x00006000&amp;gt;;
		};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;there it show the&lt;/p&gt;
&lt;p&gt;storage_partition: partition@7a000 {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;label = &amp;quot;storage&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;reg = &amp;lt;0x0007a000 0x00006000&amp;gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;};&lt;/p&gt;
&lt;p&gt;if 0x7a000 then what is 0x00006000&amp;nbsp; (storage size?) how it calculate in kB.&lt;/p&gt;
&lt;p&gt;and if i change the start address from 0x7a000 to 0x7000 then what will be the storage size .&lt;/p&gt;
&lt;p&gt;My case i need to store the&lt;/p&gt;
&lt;p&gt;1. Bond state PM address&lt;/p&gt;
&lt;p&gt;2. 1 KB (Kilo Byte) sensor data&lt;/p&gt;
&lt;p&gt;3. 2 KB second sensor data&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/312859?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 11:42:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dd9641f-156a-48d2-9d92-39846a7d76ee</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Sunil vignesh"]isn&amp;#39;t it ?[/quote]
&lt;p&gt;Yes, that is true.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Sunil vignesh"]and during addition of DFU Bootloader how do i measure and change the flash address[/quote]
&lt;p&gt;Do you really want to change the address of the storage_partition? This will make the layout of the images differ, which is normally not a wanted scenario.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/312838?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 11:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c31bc5c9-d715-45ec-8eec-d149b332582d</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;from nRF52840&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;reg = &amp;lt;0x000f8000 0x00008000&amp;gt;;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;f8000 - flash start address &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;8000 - flash storage size &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;isn&amp;#39;t it ?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;and during addition of DFU Bootloader how do i measure and change the flash address &lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Address change issue in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/312835?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 10:49:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:447526c4-f836-430d-8e6a-1eaf1d8c5de3</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The storage partition is&amp;nbsp;statically defined by the device tree, here&amp;#39;s an example for the nRF52840:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L275-L278"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L275-L278&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll find similar definitions for other devices, like the nrf52832:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts#L220-L222"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts#L220-L222&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When doing a DFU, you need to ensure that the storage_partition does not change between the original image and the dfu image.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>