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

timer during pstorage operations? What happens?

What happens if I call app_timer_start() to start a repeated timer. And at the same time I do a pstorage_clear() and pstorage_store()? Will the timer events get halted during the pstorage operations?

And will the timer events get piled up and be executed rapidly after the pstorage operations are finished?

Parents
  • Hi,

    Both the app_timer and the pstorage module will queue operations. The timer instance will most likely be started first, and two operations will be queued into the internals of the pstorage, and then in a FIFO fashion be scheduled using the sd_flash API in the softdevice.

    The SoftDevice will then try to schedule the flash operation in between connection intervals to avoid that you miss any events on-air.

    If you have a connection interval which is low (let's say 7.5 ms) and you're queueing a FLASH_ERASE_PAGE operation, which takes ~22 ms on nRF51 (note: CPU IS HALTED during flash operations!), the above scheduling will never add up. The softdevice will then skip connection events in order to perform the flash operation, and return back to maintain the link again.

    There's some mention of this in the SDS as well: infocenter.nordicsemi.com/.../flash_api_timing.html

    Cheers, Håkon

Reply
  • Hi,

    Both the app_timer and the pstorage module will queue operations. The timer instance will most likely be started first, and two operations will be queued into the internals of the pstorage, and then in a FIFO fashion be scheduled using the sd_flash API in the softdevice.

    The SoftDevice will then try to schedule the flash operation in between connection intervals to avoid that you miss any events on-air.

    If you have a connection interval which is low (let's say 7.5 ms) and you're queueing a FLASH_ERASE_PAGE operation, which takes ~22 ms on nRF51 (note: CPU IS HALTED during flash operations!), the above scheduling will never add up. The softdevice will then skip connection events in order to perform the flash operation, and return back to maintain the link again.

    There's some mention of this in the SDS as well: infocenter.nordicsemi.com/.../flash_api_timing.html

    Cheers, Håkon

Children
No Data
Related