<?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>fstorage page info</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27211/fstorage-page-info</link><description>I am attempting to integrate examples/peripheral/flash_fstorage into my project (SDK 14.1.0). 
 When calling nrf_fstorage_write I get NRF_ERROR_INVALID_LENGTH in response. I assume because I am only trying to write 20 bytes not ~2K. However, for some</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Apr 2019 14:00:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27211/fstorage-page-info" /><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/182750?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2019 14:00:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9191205e-2295-40a0-a93c-10e628543ebf</guid><dc:creator>SimonEMB</dc:creator><description>&lt;p&gt;I changed the program_unit of m_flash_info in nrf_fstorage_sd.c &lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Flash device information. */
static nrf_fstorage_info_t m_flash_info =
{
#if   defined(NRF51)
    .erase_unit   = 1024,
#elif defined(NRF52_SERIES)
    .erase_unit   = 4096,
#endif
    .program_unit = 1,
    .rmap         = true,
    .wmap         = false,
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/121306?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 17:00:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7309758d-26f4-49ee-a39b-4268ae6aacda</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;SDK 14.2.0 was released before this was discovered, the next release is SDK 15.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/121081?ContentTypeID=1</link><pubDate>Fri, 16 Feb 2018 13:36:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38608f61-4d27-4944-b3d9-bd5372f02892</guid><dc:creator>naman.trivedi</dc:creator><description>&lt;p&gt;I am using NRF52 with SDK14.2.0 with Softdevice 5.0. I am also getting&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_LENGTH while writing the data to flash. Value of lenth parameter is 8.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the init function inside the nrf_fstorage_sd.c file,&amp;nbsp;&lt;strong&gt;p_fs-&amp;gt;p_flash_info = &amp;amp;m_flash_info;&amp;nbsp;&lt;/strong&gt;line is inside the if loop. So I want to know if this bug is fixed in SDK 14.2.0?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107303?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2017 12:04:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0541b4b-92d5-4452-a1c3-a4bda6bf33ab</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Please see my edited answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107302?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 02:46:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:106ef1b2-2f1c-42e8-990f-cb13f80e2b0e</guid><dc:creator>rdecker</dc:creator><description>&lt;hr /&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;app_error.h&amp;gt;
#include &amp;lt;nrf_fstorage.h&amp;gt;                                                                                                                                                         
#include &amp;lt;nrf_fstorage_sd.h&amp;gt;                                                                                                                                                      
#include &amp;lt;nrf_soc.h&amp;gt;

#define ETH_FLASH_START 0x3e000                                                                                                                                     
#define ETH_FLASH_END   0x3ffff
 
static void fstorage_evt_handler(nrf_fstorage_evt_t * p_evt);

NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =                                                                                                                                       
  {                                                                                                                                                                                 
      /* Set a handler for fstorage events. */                                                                                                                                      
      .evt_handler = fstorage_evt_handler,                                                                                                                                          
                                                                                                                                                                                    
      /* These below are the boundaries of the flash space assigned to this instance of fstorage.                                                                                   
       * You must set these manually, even at runtime, before nrf_fstorage_init() is called.                                                                                        
       * The function nrf5_flash_end_addr_get() can be used to retrieve the last address on the                                                                                     
       * last page of flash available to write data. */                                                                                                                             
      .start_addr = ETH_FLASH_START,                                                                                                                                                
   };

void main() {
...
ret_code_t rc;
      rc = nrf_fstorage_init(&amp;amp;fstorage, &amp;amp;nrf_fstorage_sd, NULL);
      APP_ERROR_CHECK(rc);
...
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107301?ContentTypeID=1</link><pubDate>Tue, 21 Nov 2017 12:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2bae735-1b09-4852-b97c-55d253d7f6a3</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;How exactly have you defined your fstorage instance?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107300?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2017 21:06:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:039c1cef-0c50-4154-bfa9-f0ebd6685a69</guid><dc:creator>rdecker</dc:creator><description>&lt;p&gt;Upon calling nrf_fstorage_init() a second time I get undefined values.&lt;/p&gt;
&lt;p&gt;Moving the &amp;quot;p_fs-&amp;gt;p_flash_info = &amp;amp;m_flash_info;&amp;quot; line in the init function of nrf_fstorage_sd.c above the if statement seems to have fixed my issue. This prevents p_flash_info from being uninitalized on subsequent calls to nrf_fstorage_init. I have left the NRF_ATFIFO_INIT line inside the if block. Am I doing something incorrect or is this a bug in the supplied library code? I&amp;#39;d appreciate you guys looking into it. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107299?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2017 15:33:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d64b48b6-1061-4039-9824-6a6253f55bab</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It should be possible to call nrf_fstorage_init() for every instance you want, but how exactly have you defined your instance? It sounds like you have some undefined values of nrf_fstorage_t?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107298?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 00:31:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d231fa30-8c8d-4ba0-8acc-351f4c0536ab</guid><dc:creator>rdecker</dc:creator><description>&lt;p&gt;I did some more digging and it turns out that p_flash_info is 0x00000000 and so program_unit is some &amp;quot;random&amp;quot; value. I see that it should be set to 4 in nrf_fstorage_sd.c which I am including in my build system.&lt;/p&gt;
&lt;p&gt;Edit: with some logging it seems that the init function is being called twice (once for peer_manager, and once for my code?). &lt;em&gt;However&lt;/em&gt; in the second call the if !m_flags.initialized branch is not taken and thus p_flash_info is not set (nrf_fstorage_sd.c:380). This seems incorrect to me. I was under the impression multiple fstorage instances could be constructed and used in different application modules.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107297?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2017 23:46:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae23cc98-5c5e-4011-a95c-4a1943ae5cd2</guid><dc:creator>rdecker</dc:creator><description>&lt;p&gt;I tried switching the length to be a multiple of 4. In my test I am using &amp;quot;nrf_fstorage_write(&amp;amp;fstorage, 0x100000, data, 24, NULL)&amp;quot; and I still get ERROR 9 [NRF_ERROR_INVALID_LENGTH]. According to the 14.0 migration guide the length should be in bytes, thus I am doing 24.&lt;/p&gt;
&lt;p&gt;As far as I know the program unit (2277 bytes) retrieved from p_flash_info is read only and cannot be changed. Attempting to set it makes gcc say &amp;quot;error: assignment of member &amp;#39;program_unit&amp;#39; in read-only object&amp;quot;. How would I lower the program unit to be 4 bytes and not 2k?&lt;/p&gt;
&lt;p&gt;I am using &amp;amp;nrf_fstorage_sd in my nrf_fstorage_init line. I am using the s140 soft device with ble in other parts of my code base.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage page info</title><link>https://devzone.nordicsemi.com/thread/107296?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2017 15:09:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a04c04e-e43f-4a8b-a5c2-bc8802cec8e3</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;The program unit should be the word size, which is 4 bytes. The length has to be a multiple of 4 bytes, like the length of m_hello_world.&lt;/p&gt;
&lt;p&gt;Edit 29.11.2017:&lt;/p&gt;
&lt;p&gt;This is a bug. The fix is (as you figured out) to put p_fs-&amp;gt;p_flash_info = &amp;amp;m_flash_info; before the if in the init function of nrf_fstorage_sd.c&lt;/p&gt;
&lt;p&gt;This will be fixed in the next SDK release.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>