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

Process for flashing important information in Flash Memory

Hi,

I would like to store important information (few MAC addresses) in flash memory at manufacturing stage. Then my program will be able to read these information thanks to fstorage or FDS.

How to proceed? Is it best to compile a program in parallel in order to write to the flash memory before running my application meaning that it must be done in 2 steps? Or write a file (binary) and import in my project ?

These information must be non-erasable if possible so I am wondering if there is a way to secure this...

Thanks.

BR

  • Hi,

    For small amounts of persistent information it may be better to use the UICR. That can be written in production like any other par of the flash, but is never erased in the field.

    If you want to use FDS instead (though I would not recommend it for this specific use case), then you need to either hand craft a valid FDS page that contain the information as valid FDS records (FDS is quite simple so it is not difficult) and write that in production, or uses a separate app to do it. I think the first approach would make most sense in most cases if you want to use FSD for this. Note that FDS records can always be erases, so it would be up to your application to just not do it in this case.

  • Hi,

    Thanks. Ok I will study UICR more in details. Can you clarify how it will works exactly? Example from my imagination: create binary or hex file, implement code in application or in separate file to write to UICR using binary file, launching of my application, etc...

  • If you want to program a lot of information is a single go you should put it in a hex file and then  program it like you write. The UICR is just like any other flash when it comes to programming.

    If it is just a few words you could script this around single nrfjprog --memwr commands, but the problem is that you can only write a single 4 byte word at a time. For instance you could write and read back like this:

    >nrfjprog --memwr 0x10001080 --val 0xcafebabe
    Parsing parameters.
    Writing.
    
    >nrfjprog --memrd 0x10001080 --n 4
    0x10001080: CAFEBABE                              |....|

Related