This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

peer_manager_pds: Could not initialize flash storage. fds_init() returned 0x860A

When the application is started I get the following error:

<error> peer_manager_pds: Could not initialize flash storage. fds_init() returned 0x860A.
00>
00> <error> peer_manager: pm_init failed because pds_init() returned NRF_ERROR_STORAGE_FULL.
00>
00> <error> app: ERROR 3 [NRF_ERROR_INTERNAL] at C:\Users\Samo\Documents\nRF52_SDK\examples\ble_peripheral\ble_Indu4s_improved3\main.c:2689
00>
00> PC at: 0x0002065B
00>
00> <error> app: End of error report

In my application, I wrote some data in flash. More precisely, I reserved 8kB for my data from 0x2E000 to 0x30000. This is 8kB which means that I have two pages. The first page goes from 0x2E000 to 0x2F000and from 0x2F000 to  0x30000. Because I use the nrf52811 chip (s112) these flash addresses are located at the end of the flash. Now comes the most interesting part. If I erase the flash before peer_manager_init is called then the error does not occur. Due to this fact, I believe that the problem is somehow related to the flash but I do not know what exactly can be the cause of the problem. According to my knowledge the flash addresses above 100kB and not reserved. I will appreciate for help.

err_code = nrf_fstorage_erase(&fstorage, 0x2F000, 1,NULL);
APP_ERROR_CHECK(err_code);
wait_for_flash_ready(&fstorage);

Here is my memory layout. Why such periodicity occurs at the top of flash memory? This periodicity is generated when peer_manager_init() method is called.

Parents
  • Hi, 

    This is expected behavior. You need to provide erased pages for the system to be able to setup. FDS requires fully erased pages, and it will not erase any unknown pages by itself. You can erase the flash pages before flashing the application, or you can use the NVMC driver. When FDS initializes the pages it will use, the pages will be tagged with a "magic word" that FDS recognizes.

    -Amanda H.

  • Thanks for the reply. Every time I load the program the entire flash is erased. Due to this fact, I think that this is not the problem. I am wondering why error NRF_ERROR_STORAGE_FULL is thrown from pm_init method. If the problem lies in the fact that the pages are not erased then fstorage_init should throw an error and not peer_manager_init(). Which addresses the peer_manager occupies for storing the data in the flash? Thanks for your help in advance.

  • Hi,

    control said:
    Every time I load the program the entire flash is erased.

    How do you erase the entire flash?

    Do you run 'nrfjprog --eraseall' command on your board or Erasing the kit before flashing the application?

    control said:
    If the problem lies in the fact that the pages are not erased then fstorage_init should throw an error and not peer_manager_init(). Which addresses the peer_manager occupies for storing the data in the flash?

    <error> peer_manager_pds: Could not initialize flash storage. fds_init() returned 0x860A.

    The log indicates the error comes from fds_init(). Error 34314 (0x860A) means FDS_ERR_NO_PAGES. Does pages_init() return NO_SWAP and fds_init() quit with FDS_ERR_NO_PAGES? If so, it seem you didn't erase the page fully at first, and the nrf_fstorage_erase did that later. 

     -Amanda H.

  • The chip is erased with the help of Erasing the kit.  I have one concern regarding erasing the chip. Please let me know if I have to erase the chip just the first time or every time it is restarted. At the moment, I erase the chip just the first time (this is actually done with the help of Erasing the kit and in code) and then I start adding some data in flash.  if I reset the chip I get the mentioned problem. Please note, when the module is reset the erase function is not called just read the data from flash.  Is it ok or I have to ease the flash every time it is reset of course after the data are read from flash.

  • Hi,

    Do you see any errors? 

    Reset will not erase the device/flashIf you initial FDS after the reset, it might be better to erase the flash every time. 

    -Amanda H.

Reply Children
  • I observed the following situation. I using flash on the following addresses

    #define FLASH_START_ADD 0x2E000

    #define FLASH_HISTORY_ADD 0x2F000
    #define FLASH_END_ADD 0x2FFFF

    It means that my entire space is 8kB which means that 2 pages are reserved just for arbitrary data. If the write and the read command is executed in the first page address starts at 0x2E000 I do not get any kind of error even the chip is restarted. The error occurs just in case when the writing command is executed on address 0x2F000 ahead. I am wondering why erasing is not necessary after the chip restarts as long as the flash is used just on the first page.

    I do some additional tests. I changed the range of flash to one 4kB which is one page and addresses are the following ones

    #define FLASH_START_ADD 0x2E000
    #define FLASH_END_ADD  0x2EFFF

    when I check the flash without peer_manager_init it shows that the addresses which I reserved for my data are reserved and this behavior is expected.  If I add peer_manager_init and do not change FLASH_START_ADD and FLASH_END_ADD constants the addresses 0x2F000 and ahead are reserved. I suspect that this reservation id made by peer_manager_init, is it true?  Why these addresses are reserved and who reserved them? As I asked in my previous post, which flash memory is reserved for peer_manager?

  • Hi, 

    Yes, those id is reserved for the peer manager to store bond information for example. See this and this for more information and Restrictions on keys and IDs doc.

    -Amanda H.

  • Is the following statement really true?

    Record keys should be in the range 0x0001 - 0xBFFF. The value 0x0000 is reserved by the system. The values from 0xC000 to 0xFFFF are reserved for use by the Peer Manager module and can only be used in applications that do not include Peer Manager.

    My program is written based on ble_periperal_template and default FDS settings are used such as:

    FDS_VIRTUAL_PAGES 3
    FDS_VIRTUAL_PAGE_SIZE 1024

    It means that the peer manager will not reserve addresses from 0xC000 to 0xFFFF because this is one page more than it is actually needed. Is my observation correct? If so please let me know what is the starting address in this case? Is it 0xD000 instead of 0xC000?

  • Hi, 

    The FDS pages are allocated from the end of flash as shown here

    FDS address range on the 52810 is 0x2D 000 - 0x30 000 if the have set FDS_VIRTUAL_PAGES=3

    In my application, I wrote some data in flash. More precisely, I reserved 8kB for my data from 0x2E000 to 0x30000.

    It sounds like you are writing some other user data that are overlapping with the FDS. You are probably corrupting the filesystem. 

    You can use the FDS_VIRTUAL_PAGES_RESERVED option to allocate a free area for the other data.

     

    -Amanda H.

Related