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

OpenThread and Flash Operations in Upcoming SDK

Hi Nordic,

I was reading the Wiki page for porting OpenThread to a new hardware platform (github.com/.../Porting-Guide) and I noticed there isn't a "flash.h" header file and a static library specifically for handling flash operations included in the 0.10.0 SDK for OpenThread.

Is the flash operation implemented already somewhere else for saving non-volatile OpenThread related information (if so, how can I access the these commands?) or is this something that will be added into the upcoming SDK 14? Or, is this something that is expected of the developer to implement?

Also, as a side question, will the flash operations have a probability of failing with OpenThread radio being active as seen with BLE SoftDevices and flash operations?

Thank you.

  • Hello Jay!

    Thread protocol in general requires to keep some information in the non-volatile memory e.g. Operational Dataset (Channel, Pan ID) or security information (e.g. frame counters).

    OpenThread exposes only platform/settings.h file which is used by higher layers to store Thread-specific information. Flash.h header that you refer to is the internal file used by default implementation of settings module (examples/platforms/utils/). Note that OpenThread allows to replace this implementation to platform specific one.

    Because of that i do not recommend to use settings.h API to store application-specific information.

    Instead i would recommend to reserve some space in a flash region and use libraries implemented in our SDK to store an application-data there.

    1. In case you want to create Thread-only application (without concurrent BLE) you can use NVMC module from SDK (components/drivers_nrf/hal/nrf_nvmc.h) directly.

    2. In case you want to create application that utilizes dynamic multiprotocol solution (Openthread and Softdevice simultanously) you can use either fstorage or fds modules or make direct SVC calls to SoftDevice e.g. by using sd_flash_write API.

    In both cases make sure you choose flash region other that one used by OpenThread (to not override them). Currently we use 4 last pages of the flash region for that purpose.

    Regarding to your side question, the behaviour of flash operations performing by SoftDevice should not be different in case you have BLE only or BLE and Thread application. There is however bigger chance that the sd_flash_write operation will return NRF_ERROR_BUSY error due to flash operation already scheduled by Thread stack.

    Give me know if you have more questions!

Related