UICR won't be completely erased (APPROTECT)

It seems that not all UICR registers are erased on this nRF52840 chip

nrfjprog -f nrf52 --recover

Just make sure one more time:

nrfjprog -f nrf52 --eraseuicr

nrfjprog -f nrf52 --readuicr uicr.bin --log
Storing data in 'uicr.bin'.

Displaying uicr:

It's indeed there

nrfjprog -f nrf52 --memrd 0x10001208 --w 8 --n 4    

0x10001208: 5A 00 00 00                                       |Z...|

And it can't be overwritten:

What's happening here?

The APPROTECT register should show 0xFF!

This is the chip:

0FAA as INFO.VARIANT (https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fficr.html&anchor=register.INFO.VARIANT)

I now also found https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Frev_history.html that 0x5A (HwDisabled) is an option for "Hardware disable of access port protection for devices where access port protection is controlled by hardware and software"

My problem is that after each power cycle it failed to flash without clearing UICR first.

Parents
  • I think part of the problem here is that we want the tools to be useful for both development and production programming, and due to backwards development compatiblity if you like, some of the parameters might not do what you intuitively expect. E.g. if recover and eraseuicr did erase flash main block/uicr, then it would quickly become a hazzle for anyone developing an application and for instance were debugging. That is why they disable readback protect when used, this is also mentioned for the recover parameter (not for eraseuicr though):

    --recover Erases all user available non-volatile memory and
    disables the read back protection mechanism if
    enabled.

    So how to enable readback protection from nrfjprog?

    Any other value than 0x5A to the APPROTECT register will enable readback register, so there is no need to set this register to 0xFF to enable it really. This means that to enable readback protection you can use the rbp parameter with ALL to set the register to 0 after programming, thereby readback will be enabled after a power on reset.

    In general I also recommend to check out:
    https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#concept_udr_mns_1s 

    Best regards,
    Kenneth

Reply
  • I think part of the problem here is that we want the tools to be useful for both development and production programming, and due to backwards development compatiblity if you like, some of the parameters might not do what you intuitively expect. E.g. if recover and eraseuicr did erase flash main block/uicr, then it would quickly become a hazzle for anyone developing an application and for instance were debugging. That is why they disable readback protect when used, this is also mentioned for the recover parameter (not for eraseuicr though):

    --recover Erases all user available non-volatile memory and
    disables the read back protection mechanism if
    enabled.

    So how to enable readback protection from nrfjprog?

    Any other value than 0x5A to the APPROTECT register will enable readback register, so there is no need to set this register to 0xFF to enable it really. This means that to enable readback protection you can use the rbp parameter with ALL to set the register to 0 after programming, thereby readback will be enabled after a power on reset.

    In general I also recommend to check out:
    https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html#concept_udr_mns_1s 

    Best regards,
    Kenneth

Children
Related