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

RESETREAS works differently on NRF52840-DK vs custom board with same code

Starting with the dev kit, where I get correct behavior. First, I make sure the RESETREAS register is all zeros. I do this like so:
NRF_POWER->RESETREAS = 0xFFFFFFFF;
while (1);

I use nrfjprog to check the value in some registers like so:
nrfjprog --memrd 0x10000100 --n 4
nrfjprog --memrd 0x40000400 --n 4

result:
0x10000100: 00052840
0x40000400: 00000000

Then I flash a new program to the board, which is similar to this:
nrf_delay_ms(10000);
NVIC_SystemReset();

After the system resets, I use nrfjprog to check the value in some registers like so:
nrfjprog --memrd 0x10000100 --n 4
nrfjprog --memrd 0x40000400 --n 4

result:
0x10000100: 00052840
0x40000400: 00000004

This looks good to me. Next I take the exact same steps on my custom board.

final result:
0x10000100: 00052840
0x40000400: 00000000

The value stored in RESETREAS is always 0. Any ideas where to start looking for why the result would be different on the DK vs my custom board? I flash the custom board through the nrf52840-dk with the command :
nrfjprog -f nrf52 --program ./build/nrf52840_xxaa.hex --sectorerase

Parents
  • You might find these notes I made helpful:

    // Reset Reason NRF_POWER->RESETREAS is changed to SWI 4 after the SystemInit() function as it handles chip errata by software resets
    // Unless cleared, the RESETREAS register will be cumulative. A field is cleared by writing '1' to it. If none of
    // the reset sources are flagged, this indicates that the chip was reset from the on-chip reset generator, which
    // will indicate a power-on-reset or a brownout reset

    See void SystemInit(void). A second power cycle may give the result you expect

Reply
  • You might find these notes I made helpful:

    // Reset Reason NRF_POWER->RESETREAS is changed to SWI 4 after the SystemInit() function as it handles chip errata by software resets
    // Unless cleared, the RESETREAS register will be cumulative. A field is cleared by writing '1' to it. If none of
    // the reset sources are flagged, this indicates that the chip was reset from the on-chip reset generator, which
    // will indicate a power-on-reset or a brownout reset

    See void SystemInit(void). A second power cycle may give the result you expect

Children
No Data
Related