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

S120 Persistent storage initial clear command never executes

I am using S120 v2 with SDK 6. Initialization of the softdevice and device manager return no errors. However when I want to start a scan for devices, the function checks the status of pstorage with pstorage_access_status_get and finds that the initial storage clear operation initiated by device_manager_central in dm_init when the option clear_persistent_data is set to true, has not been processed yet!

Looking into the workings of pstorage shows that a queued operation is executed only when a system event occurs (pstorage_sys_event_handler). This does not happen between start of the application and my scan request.

I cannot find any flaw in the initialization code of the softdevice, device manager and pstorage.

I hope someone has a clue as to what I am doing wrong or what I am missing. It might make a difference, I am using the scheduler.

PS Because the scan actually does not run (as it waits for pstorage to finish), the scan_stop function that runs on timer expiration, results in an application error caught by app_error_handler. The error says WRONG STATE, which of course is correct while scanning is not running at the moment of the stop request. Should I keep track of state or is there some function to check state?

  • In my application a RFDigital 22301module is used. I cannot read the markings unless I open one. With S120 v1.01 everything works except that the connection is dropped after 1 minute. So I thought it best to move to v2.0. I have not tested pstorage with s110.

  • Hi Leon,

    I would suggest you to also post the question on http://forum.rfduino.com/

    If the chip inside the module 's the first version of the chip (XLR1) it won't work properly with S120. You can have a look at this matrix table. To be able to know which chip version the board is you can use nrfjprog with this command: nrfjprog.exe --memrd 0x1000005c It will readout the HWID that you can find at Table 2 in the matrix table pdf file.

    Do you have any problem running the S120 without holding the bond erase button (no page erasing will be queued) ?

    I would suggest you to make some simple test with pstorage to see if you can write & erase a page.

  • nrfjprog.exe --memrd 0x1000005c, returns FFFF001D which suggests it is a revision 1 chip. So if I understand you correctly, I will not be able to get this to work correctly. I would be happy if you could help me get things working correctly with either s120 v1.01 or v2.0. I do not require much, just be able to scan and connect and read/write 2 attributes. As I already mentioned, everything works fine on s120 v1.01 except that the connection resets after 1 minute (connection parameters negotiation ??) Could I do without pstorage?

  • On second thought, with s120 v1.01 scanning works and in v1.01 pstorage and device manager are already used. So what makes it different s120 v2.0?

  • Hi Leon,

    As I mentioned earlier, if you avoid the button 1 (Bond erase button) being set, you should be able to skip the pstorage bond erasing (this part of the code in device_manager_init() // Clear all bonded devices if user requests to. init_param.clear_persistent_data = ((nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0)? true: false);

    Then you can try to use the S120 to scan, connect, read attribute as you want. But there is no guarantee that the S120 stack would work properly on your XLR1 chip. I would suggest you to get hold of new development kit, such as the nRF51 DK which has XLR3+.

    XLR1 is discontinuted and for production you will need to use XLR3 anyway.

Related