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

Flash hex file with nrfjprog command; not able to access UICR

I have issue to program nrf52832 with nrfjprog command line.


my program use nrf52formesh sdk.
I developed with Segger Embedded Studio with GCC on the Linux PC.
I modified my_nrf52832.ld file to use UICR and GPIO function on the NFC antenna pins

my_nrf52832.ld file----------------------------------------
MEMORY
{
    . . . .
  UICR (r) : ORIGIN = 0x10001080, LENGTH = 0x4
  UICR_NFCPINS(r) : ORIGIN = 0x1000120C, LENGTH = 0x04
}
SECTIONS
{
    . . . .
  .uicr_customer :
  {
    KEEP(*(.uicr_customer))
  } > UICR

  /* Write the bootloader address in UICR. */
  .uicrNfcPinsAddress :
  {
         KEEP(*(.uicrNfcPinsAddress))
  } > UICR_NFCPINS
}

 my_code.c file--------------------------------------------

volatile uint32_t uicr_data  __attribute__ ((section(".uicr_customer"))) = (0x000000FFUL & (uint32_t)(0x53));

const uint32_t UICR_ADDR_0x20C __attribute__ ((section(".uicrNfcPinsAddress"))) __attribute__((used));

------------------------------------------------------------

With the Segger Embedded Studio, compile, build, flash and run without issue.

Now, I'd like to flash the hex file with nrfjprog command as below
$> nrfjprog -f nrf52 --eraseall
$> nrfjprog -f nrf52 --program my_build.hex

I also able to read/write the UICR as below..
nrfjprog -f nrf51 --memwr 0x10001088 --val oxo2
nrfjprog -f nrf52 --memrd 0x10001088 -n 2



After flash the hex files using "nrfjprog" command, my code not able to access the UICR value.
- again, if I downlod hex files using the Segger studio, no problem to access the UICR value.
Could you help me how can I program using nrfjprog command in this case?

Related