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?

  • Still I would like answers to the questions above. If possible I will move to newer versions of the chip, but for now I am just interested in getting the job done. My most pressing question is where do s120v1.01 and s120 v2.0 differ because I can get scanning to work with s120 v1.01.

  • Tried setting clear_persistent_data = false to no avail. It seems I am not getting any callbacks from the softdevice. Can that be?

  • @Leon: For the differences between S120 v2.0 vs S110 v1.0 you can have a look at the release note in the S120 v2.0 zip file.

    We haven't tested the S120 on XLR1 so we actually don't know about the behaviour when you run S120 on the chip. Some functions may work some may not, and glitch may occurs at some point when running.

  • I can understand that you have not tested it on older hardware. However I would like to gain some insight about what can be done because as it happens we have that hardware. We are inquiring with RF Digital if they have more recent hardware in the models sold at the moment. Until then I must do with what I have. I have a working application on the same hardware with softdevice 1.01. That would be the end of it if not for the fact that this version breaks the connection after 1 minute. So if you can help get that resolved, I am happy too. Still there must be something you can tell me why the same code (except for the necessary changes) would make it possible to scan for devices on s120 v1 and not on v2. It looks like I am not getting any events from the softdevice. I suspect something with the vector table but I cannot find what I should add or change to get it working.

  • Hi Leon,

    I would suggest you to go through some steps for debugging:

    For S120 v1.0 that you got a disconnection after 1 minute:

    • Get a sniffer trace to see what happens over the air.

    • Add a break point when the disconnected event occurs and check what the reason of the disconnection.

    For the S120 v2.0:

    Try to avoid device manager to erase the bond information, so you don't have the queue for pstorage, or you can manually remove the check for count in pstorage_access_status_get(&count); in scan_start().

    You can also test pstorage by creating a fresh project and only test pstorage if you can erase & write something to flash.

Related