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