<?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 Using customized flash partition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73855/nrf9160-using-customized-flash-partition</link><description>Dear all, 
 For our project we want to store information on the device in an additional flash partition. We have created a new flash partition, called factory_settings_partition, by defining it in our custom board files as follows: Now when trying to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 19 Apr 2021 13:34:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73855/nrf9160-using-customized-flash-partition" /><item><title>RE: NRF9160 Using customized flash partition</title><link>https://devzone.nordicsemi.com/thread/305569?ContentTypeID=1</link><pubDate>Mon, 19 Apr 2021 13:34:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0921ef6-58db-4b53-b077-76b01fb65329</guid><dc:creator>Maaike</dc:creator><description>&lt;p&gt;Hi Carl,&lt;br /&gt;&lt;br /&gt;Many thanks, this solved the problem and using the partition works now.&lt;br /&gt;I made the storage_partition smaller in our custom board files (as we still need to use it) and created space for our own custom partition. &lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Maaike &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Using customized flash partition</title><link>https://devzone.nordicsemi.com/thread/305483?ContentTypeID=1</link><pubDate>Mon, 19 Apr 2021 10:21:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd70c2cd-7ffa-449e-b4f4-fd6007052b4d</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi again!&lt;br /&gt;&lt;br /&gt;This is failing as the address 0x100000 is outside the&amp;nbsp;&lt;strong&gt;flash_primary&lt;/strong&gt; region. To stay within the region I suggest lowering the NVS partition size using&amp;nbsp;CONFIG_PM_PARTITION_SIZE_NVS_STORAGE and then changing the start address and size of your static partition accordingly.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For example by setting the NVS storage partition size to 0x0 the following pm_static.yml should work:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;factory_settings_partition:
   address: 0x1f7d0
   size: 0xE0830
   #span: [example]  # Only if this partition had the span property set originally.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Using customized flash partition</title><link>https://devzone.nordicsemi.com/thread/304718?ContentTypeID=1</link><pubDate>Wed, 14 Apr 2021 07:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d779839-6b6c-45e6-a11a-27ed32b4f64c</guid><dc:creator>Maaike</dc:creator><description>&lt;p&gt;Hi Carl,&lt;br /&gt;&lt;br /&gt;Thank you for your reply. &lt;br /&gt;&lt;br /&gt;I have added the partition the the pm_static.yml file and it seems that the flash configuration now works well, as I see the partition in the partitions.yml file in the build folder.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;However, I now get the following error &lt;pre class="ui-code" data-mode="text"&gt;fs_nvs: Unable to get page info&lt;/pre&gt;&lt;br /&gt;It seems that the page of the offset does not exist. &lt;br /&gt;&lt;br /&gt;This is my pm_static.yml file:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;factory_settings_partition:
   address: 0x00100000
   size: 0x000007d0
   #span: [example]  # Only if this partition had the span property set originally.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And this is what I see in partitions.yml after building&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;app:
  address: 0xc000
  region: flash_primary
  size: 0xee000
bsdlib_sram:
  address: 0x20010000
  placement:
    after:
    - spm_sram
    - start
  region: sram_primary
  size: 0x10000
factory_settings_partition:
  address: 0x100000
  region: flash_primary
  size: 0x7d0
nvs_storage:
  address: 0xfa000
  placement:
    before:
    - end
  region: flash_primary
  size: 0x6000
otp:
  address: 0xff8108
  region: otp
  size: 0x2f4
spm:
  address: 0x0
  placement:
    before:
    - app
  region: flash_primary
  size: 0xc000
spm_sram:
  address: 0x20000000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x10000
sram_primary:
  address: 0x20020000
  region: sram_primary
  size: 0x20000
sram_secure:
  address: 0x20000000
  orig_span: &amp;amp;id001
  - spm_sram
  region: sram_primary
  size: 0x10000
  span: *id001&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is how I initialize flash&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static struct nvs_fs fs;
   
static bool set_config_hwver(const char* majorString, const char* minorString)
{   
   
    fs.offset = FLASH_AREA_OFFSET(factory_settings_partition);

    int rc = 0;
    char buf[32];
    
    struct flash_pages_info info;
    rc = flash_get_page_info_by_offs(
        device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL), fs.offset, &amp;amp;info);
    if (rc) {
        printk(&amp;quot;rc: %d\n&amp;quot;, rc);
        LOG_DBG(&amp;quot;Unable to get page info&amp;quot;);
    }

    fs.sector_size = info.size;
    fs.sector_count = 3U;
    rc = nvs_init(&amp;amp;fs, DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
    if (rc) {
        LOG_DBG(&amp;quot;Flash Init failed\n&amp;quot;);
    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I am not sure what I am missing, is the offset of my partition defined badly?&amp;nbsp; &lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Maaike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 Using customized flash partition</title><link>https://devzone.nordicsemi.com/thread/304327?ContentTypeID=1</link><pubDate>Mon, 12 Apr 2021 14:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d2c6888-a485-4830-81ed-a56915c0df32</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Maaike!&lt;br /&gt;&lt;br /&gt;As Didrik mentioned in the thread you&amp;#39;ve linked to any device tree configuration of flash partitions are ignored by the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html"&gt;Partition Manager script&lt;/a&gt;. This script is used by the build system to properly allocate space for multi-image builds, and is thus used for most nRF9160 applications.&lt;br /&gt;&lt;br /&gt;I agree that his second option in general is more suitable. The partition manager documentation should cover how to &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#static-configuration"&gt;configure your own static partitions&lt;/a&gt;&amp;nbsp;and I suggest looking into that. For examples the asset_tracker example defines a &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/applications/asset_tracker/configuration/thingy91_nrf9160ns/pm_static.yml"&gt;static partition configuration for the Thingy:91&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>