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

Bootloader Resets Once Right After Program

I am running SDK 15.2 on an nRF52840. I have programmed my secure dfu bootloader, application, settings.hex, and softdevice via jtag. During the first run after programming the bootloader runs, resets, runs, and then successfully executes my application. This reset only occurs on the first run after programming the bootloader. I am trying to understand why this reset is occurring. I was thinking it had something to do with the master boot record not being initialized. Either that or possibly something with my settings.hex. I think settings.hex is less likely but here how I am creating it.

nrfutil settings generate --family NRF52840 --application app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

Parents Reply Children
  • I traced down the double reset after a flash program issue. It is actually a deliberate reset by the main app initialization code, due to using the NRF I/O pins as GPIO and not NRF.
    In system_nrf52840.c SystemInit(), line 153 checks to see if the pins are configured as GPIO. If so, it checks, then clears bit 0 of the NFCPINS register (addr 0x1000120c). When a full chip erase is performed, this bit is set by default. Due to this register being a UICR, any modifications are only implemented after a reset. So, this routine forces a chip reset at line 161.
    Since the UICR is non-volatile flash, no subsequent chip power-ups or resets go through the deliberate reset.
Related