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

Protect UICR

Hello i have a rigado BMD-300 module and i would like to flash a new version of softdevice app and bootloader but i want to protect the UICR memory because that is where the MAC addr of the module is stored. 

Is there any way to flash everything without touching the UICR ?

If so can you tell me a better way do to this ?

Thanks for the help

  • UICR will be deleted if you erase all. However if you erase only the pages you use for your application you should be able to flash again without erasing the uicr. i.e. use the sector erase option when programming with nRFjprog.

         --program <hex_file> [--sectorerase | --chiperase | --sectoranduicrerase]
                                 [--qspisectorerase | --qspichiperase]
                                 Programs the specified hex_file into the device.
                                 If the target area to program is not erased, the
                                 --program operation will fail unless an erase
                                 option is given. Valid erase operations for
                                 the internal flash memory are --sectorerase,
                                 --sectoranduicrerase and --chiperase. If
                                 --chiperase is given, all the available user
                                 non-volatile memory, including UICR, will be
                                 erased before programming. If --sectorerase is
                                 given, only the targeted non-volatile memory pages
                                 excluding UICR will be erased. If
                                 --sectoranduicrerase is given, only the targeted
                                 non-volatile memory pages including UICR will be
                                 erased. Note that the --sectoranduicrerase and
                                 --sectorerase operations normally take
                                 significantly longer time compared to --chiperase
                                 operation so use them with caution. If your
                                 device is equipped with a QSPI peripheral and an
                                 external memory device is present, data targeting
                                 the XIP region will be written to the external
                                 memory device. The first address of the XIP region
                                 is considered as address 0 of the external memory
                                 device. To determine if an external memory device
                                 is present, nrfjprog checks the MemSize paramter
                                 from QspiDefault.ini file or from the QSPI
                                 configuration ini file given with the --qspiini
                                 option. If the target area to program is not
                                 erased, the --program operation will fail unless
                                 an erase option is given. Valid erase operations
                                 for the external memory device are --qspichiperase
                                 and --qspisectorerase. If --qspichiperase is
                                 given, the external memory device will be erased.
                                 If the --qspisectorerase is given, only 4kB pages
                                 pages from the targeted external memory device
                                 will be erased. Note that --qspichiperase
                                 operation may take several minutes. The --program
                                 command can be combined with the --verify
                                 operation. It can also be combined with either the
                                 --reset or the --debugreset operations. the reset
                                 will occur after the flash operation in order to
                                 start the execution.
                                 Limitations:
                                 For nRF51 devices, the --sectoranduicrerase
                                 operation is not available.
                                 For nRF51 devices, if the hex_file provided
                                 contains sectors belonging to region 0, the
                                 --program operation will fail.
                                 For nRF51 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available.
                                 For nRF52 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available
                                 unless the device is equipped with a QSPI
                                 peripheral and an external memory is connected. To
                                 determine if an external memory is present, the
                                 MemSize parameter from QspiDefault.ini file or
                                 from the QSPI configuration ini file given with
                                 the --qspiini option is evaluated

  • Can provide an example of the command? Lets said I would like to protect my serial number from been erased.

    And the example of the serial I will write to is as below:

    nrfjprog -f nrf52 --memwr 0x10001080 --val 0xCAFEBABE

Related