Persistent storage

Hello,

I have develop a solution that uses openThread with UDP. I want to keep in memory the UDP address of the last device that communicates with me. Thus in case of reset, my device will join again the network and send a sort of "ping" message to this UDP.

Sadly I have hard time storing this simple data. What is the simplest/best option ?

I have tried to use the nvmc of the nrfx library to write my data in the UICR register. But I have a problem: when doing an erase of the uicr register, firmware is crashing (in the z_arch... file so it gives me no hint).

Can you help on this ?

Thanks !

Parents
  • Hi,

    UICR is not intended for writing data that will be frequently updated, as it is required to erase the full UICR page each time you write one register (it works like flash, where each bit can only be written from 1 to 0, 0 to 1 requires page erase). The flash have limited endurance of 10 000 write/erase cycles, which will wear out your UICR page quite quickly if you update the data every time communication from the last device changes.

    If it is correct that you are using nRF Connect SDK (like your tags indicate), I would recommend that you look into Non-Volatile Storage (NVS) for storing data. This allows you to spread the writes over one or multiple pages, increasing the flash lifetime of your device. See the NVS: Non-Volatile Storage Sample for how to use the library.

    Best regards,
    Jørgen

  • Hi  ,

    I know UICR works like flash and has a low amount of cycles. In my product, the address would be updated very rarely in fact because network is never supposed to be stopped.

    Despite this, I guess you are right about using the NVS solution (or Settings subsystem). I will take a look at this. The disadvantage is that implementation is less simple (IMO) and take more memory space.

    I still want to understand why the erase uicr makes my device crashing. Is this because CPU is halted ? If yes, same problem will appear with the NVC solution as it will erase (less frequently) the flash.

    Is there an "incompatibility" with openthread / l2 layer and UICR erase or flash erase ?

    Thank you !

Reply
  • Hi  ,

    I know UICR works like flash and has a low amount of cycles. In my product, the address would be updated very rarely in fact because network is never supposed to be stopped.

    Despite this, I guess you are right about using the NVS solution (or Settings subsystem). I will take a look at this. The disadvantage is that implementation is less simple (IMO) and take more memory space.

    I still want to understand why the erase uicr makes my device crashing. Is this because CPU is halted ? If yes, same problem will appear with the NVC solution as it will erase (less frequently) the flash.

    Is there an "incompatibility" with openthread / l2 layer and UICR erase or flash erase ?

    Thank you !

Children
No Data
Related