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

Using customer registers to pass initialization data

Hello,

I have this scenario : I want each of my board to have a set of unique data, that I want to write along with the program, at the board initialization (this data will be uses the first time the board boots).
I have understood that I could use customer registers (in UICR) for that.

If I program my board (with "nrfjprog --program ..."), then try to write to customer registers, nrfjprog tells me they are protected, which I get.
So I tried the contrary : 
- erasing all
- writing to customer register
- program the board
- read from customer register from app

Unfortunately, I succeed writing to customer register, but they are overwritten after programming.

NRF52811
SD s112 7.0.1
SDK 16.0.0

$ nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
$ nrfjprog --memwr 0x80 --val 0x195B6635
    Parsing parameters.
    Writing.
$ nrfjprog --memrd 0x080 --n 8
    0x00000080: 195B6635 FFFFFFFF |5f[.....|
$ nrfjprog --program .my_app_bl_sd_app.hex --verify --chiperase (containing app+settings+bootloader+softdevice)
    Parsing hex file.
    Erasing user available code and UICR flash areas.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.
    Verifying programming.
    Verified OK.
$ nrfjprog --memrd 0x080 --n 8
    0x00000080: 000007FB 00000805 |........|

What am I missing ? 
Thanks !

Parents
  • Hi,

    0x80 is a main flash memory. Here's the right way to write UICR:

    nrfjprog --memwr 0x10001080 --val 0x195B6635

    But --chiperase will clear UICR as well...

  • Thanks ! I missed that address information in the documentation


    Indeed it works with :

    $ nrfjprog --eraseall
        Erasing user available code and UICR flash areas.
        Applying system reset.
    $ nrfjprog --memwr 0x10001080 --val 0x195B6635
        Parsing parameters.
        Writing.
    $ nrfjprog --program .my_app_bl_sd_app.hex --verify (without --chiperase, not necessary in this case)
        Parsing hex file.
        Reading flash area to program to guarantee it is erased.
        Checking that the area to write is not protected.
        Programming device.
        Verifying programming.
        Verified OK.
    $ nrfjprog --memrd 0x10001080 --n 8
        0x10001080: 195B6635 FFFFFFFF |5f[.....|

    Perfect !

Reply
  • Thanks ! I missed that address information in the documentation


    Indeed it works with :

    $ nrfjprog --eraseall
        Erasing user available code and UICR flash areas.
        Applying system reset.
    $ nrfjprog --memwr 0x10001080 --val 0x195B6635
        Parsing parameters.
        Writing.
    $ nrfjprog --program .my_app_bl_sd_app.hex --verify (without --chiperase, not necessary in this case)
        Parsing hex file.
        Reading flash area to program to guarantee it is erased.
        Checking that the area to write is not protected.
        Programming device.
        Verifying programming.
        Verified OK.
    $ nrfjprog --memrd 0x10001080 --n 8
        0x10001080: 195B6635 FFFFFFFF |5f[.....|

    Perfect !

Children
No Data
Related