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

A UICR write operation has been requested but UICR has not been erased

There are already a few threads about this problem but none of them helped.

I want to use GPIO9 + 10 as .. well .. GPIO.

Here's what I did:

  • added CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS in Makefile
  • added a section in linker script:

UICR_NFCPINS(r) : ORIGIN = 0x1000120C, LENGTH = 0x04

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

  • set the constant in main.c: const uint32_t UICR_ADDR_0x20C attribute ((section(".uicrNfcPinsAddress"))) attribute((used)) = 0xFFFFFFFE;

And after all, still it didn't help, I always had the "A UICR write operation..." message and the GPIOs didn't work.

Finally I did nrfjprog --memwr 0x1000120c --val 0xFFFFFFFE --family nrf52 --verify That helped but is not best practice, I guess - and still the message did not disappear (but the GPIOs work at least)

Any help please?

Parents
  • @chrismakaio: You should only have to add CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS to the Makefile, the nRF52 will then run this snippet on startup(see the system_nrf52.c file)

    #if defined (CONFIG_NFCT_PINS_AS_GPIOS)
            if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == 
                   (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NVIC_SystemReset();
            }
        #endif
    

    However, adding

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

    to main.c and modifying the linker script by adding

    UICR_NFCPINS(r) : ORIGIN = 0x1000120C, LENGTH = 0x04
    

    under MEMORY in the linker script and adding

    .uicrNfcPinsAddress : 
      { 
         KEEP(*(.uicrNfcPinsAddress)) 
      } > UICR_NFCPINS
    

    under SECTIONS should also work. Are you using nrfjprog to flash the compiled hexfile?

  • Alternatively, you can run make erase and then make flash.

Reply Children
No Data
Related