issuing eraseuicr from openocd

On Seeed Xiao nRF52840, I'm attempting to use reset (P0.18) as GPIO in a Zephyr (ZMK) app.

I've set 

```

&uicr {
/delete-property/ gpio-as-nreset;
nfct-pins-as-gpios;
};
```
in my overlay, and I need to erase the UICR. I do not have a jlink debugger. I have successfully connected using a cmsis-dap debugger, but I am unsure of the register I need to set to issue the eraseuicr command.
https://docs.nordicsemi.com/bundle/ps_nrf52840/page/nvmc.html indicates
ERASEUICR 0x514

Register for erasing user information configuration registers

I ran `nrf52.dap apreg 1 0x04 0x01`, but I only have a uf2 to flash the application from, so I have to install the adafruit boot loader, which seems to reenable the reset behavior in UICR.

I think what would be helpful is to determine how to map the 0x514 register to a form that nrf52.dap apreg could understand.

Any assistance would be greatly appreciated.

Parents
  • Upon examination of the Debug and Trace section of the nRF52840 Product Specification
    from the Nordic website, it seems that eraseuicr is not a part of the ap register? Is it possible to set this in some other way? 

    I ran `nrf52.dap apreg 1 0x04 0x01`, and then flashed the application without a boot loader, but the application doesn't seem to boot, despite flashing verifying as successful in both hex and bin formats. I believe the application has been built correctly as when I flash a boatloader and then the application from the same build in uf2 format, it works as expected.

  • Hi,

    wlp said:
    from the Nordic website, it seems that eraseuicr is not a part of the ap register? Is it possible to set this in some other way? 

    Correct, it is not a part of the AP registers. If you want to only erase the UICR, you need to write to the NVMC registers, first NVMC.CONFIG to enable erase, then NVMC.ERASEUICR to start the UICR erase. Performing the ERASEALL through the control access port (nrf52.dap apreg 1 0x04 0x01`) will erase both the FLASH and UICR.

    wlp said:
    I believe the application has been built correctly as when I flash a boatloader and then the application from the same build in uf2 format, it works as expected.

    Did you change the application's start address to 0x0 when programming it without the bootloader?

    Best regards,

    Vidar

Reply
  • Hi,

    wlp said:
    from the Nordic website, it seems that eraseuicr is not a part of the ap register? Is it possible to set this in some other way? 

    Correct, it is not a part of the AP registers. If you want to only erase the UICR, you need to write to the NVMC registers, first NVMC.CONFIG to enable erase, then NVMC.ERASEUICR to start the UICR erase. Performing the ERASEALL through the control access port (nrf52.dap apreg 1 0x04 0x01`) will erase both the FLASH and UICR.

    wlp said:
    I believe the application has been built correctly as when I flash a boatloader and then the application from the same build in uf2 format, it works as expected.

    Did you change the application's start address to 0x0 when programming it without the bootloader?

    Best regards,

    Vidar

Children
Related