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 Reply Children
  • Hello,

    Sorry, I should have been more clear on this point. For this test I run a makefile that contains the commands:
    nrfjprog -f nrf52 --program ./build/nrf52840_xxaa.hex --sectorerase
    nrfjprog -f nrf52 --reset

    Regarding the response from hmolesworth who says:
    "this indicates that the chip was reset from the on-chip reset generator, which
    // will indicate a power-on-reset or a brownout reset"

    I have other reasons to suspect that the board may have problems with its power rail. Is it possible my chip is browning out during its reset sequence or some case such as that?

  • Hi,

     

    If you suspect that there's a bad connection or similar on the power rail, you should see instabilities while entering debug mode and halting/breaking in the program.

    Could you try entering debug mode and see if there's any issues during the debug session?

     

    Kind regards,

    Håkon

  • I have successfully opened a debug session on the custom board, with the peripheral/blinky example. I started a GDB server with openOCD through the dev kit (this is what I am most familiar with) as so:
    openocd -f interface/jlink.cfg -c "transport select swd" -f target/nrf52.cfg

    and was able to attach to the debug port using the command:
    arm-none-eabi-gfb build/nrf52840_xxaa.out
    target extended-remote localhost:3333

    I am able to set breakpoints and it appears that the CPU is halted at the breakpoint.

    However, I also have a black magic probe, which I can also test with. The black magic probe is unable to flash the chip when the nrf52 is operating at 3.3V. It appears as though the flash is erased, but programming fails. Or maybe the flash is partially erased, since after attempting to program with the BMP, it will begin to operate at 1.8V, in spite of my program setting the GPIO voltage to 3.3 at the very beginning. When I try to attach using this probe it indicates that the target voltage is 3.1V (doesn't seem right). It appears that I am able to attach to the port, however, and halt with cntl-c.

    After the programming fail, and the nrf52 is running at 1.8V, flashing the chip will be successful with the BMP.

  • I'm glad to hear that one of the debug probes atleast worked without issues.

    How did the program run, in terms of the NRF_POWER->RESETREAS behavior?

  • The behavior is the same.. The RESETREAS register is always 0. At this point given the issues I had with the black magic probe I believe there is probably something wrong with the board. Please let me know if you have any other ideas or suggestions for how to debug this. If not, you can close the ticket. But please before you do, can you answer me, what is the electrical difference in the startup sequence between Power-on-Reset that RESETREAS will be 0 but with other reset events it will be nonzero? Thank you

Related