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?

Parents
  • Thank you for looking into this.

    I have copied the ble_app_hrs_c project from the SDK I copied the include files from S120 include folder to the project include folder for s120 I changed device_manager_central because the interface for sd_ble_gatts_sys_attr_set /get has changed. I have added value 0 as last parameter. I have added call to sd_ble_enable in main\ble_stack_init and changed the SOFTDEVICE_HANDLER_INIT to use my clock I have also added app_scheduler to the project (was missing).

    I cannot flash this project from Keil. Using NrfGo shows why

    image description I made no other changes than the ones mentioned above. The same holds for my actual project. I just added my application code.

    Hope you can help me

Reply
  • Thank you for looking into this.

    I have copied the ble_app_hrs_c project from the SDK I copied the include files from S120 include folder to the project include folder for s120 I changed device_manager_central because the interface for sd_ble_gatts_sys_attr_set /get has changed. I have added value 0 as last parameter. I have added call to sd_ble_enable in main\ble_stack_init and changed the SOFTDEVICE_HANDLER_INIT to use my clock I have also added app_scheduler to the project (was missing).

    I cannot flash this project from Keil. Using NrfGo shows why

    image description I made no other changes than the ones mentioned above. The same holds for my actual project. I just added my application code.

    Hope you can help me

Children
No Data
Related