This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52 Reset

Hi, I have been trying to figure out how to get the IF BOOT/RESET button on the nRF52 micro-controller working. I have defined "CONFIG_GPIO_AS_PINRESET" under C/C++ in the target options as suggested here: infocenter.nordicsemi.com/index.jsp, I am running the Blinky example. However after I flash onto the board and the LEDs blink as expected, I try pushing the reset button but nothing happens. Is that intended or have I missed a step in enabling the reset functionality? I expect it to revert to the state before anything was flashed onto it, hence "reset" but maybe I have the wrong idea of what this button does. Could someone clarify that as well?

Thank you very much!

  • A [system] reset is basically just switching the power off and on again. You'd need to erase the chip with a tool or boot into some sorta bootloader mode and erase the chip in a program to do what you figured the reset button would do.

    See POWER — Power management in the Product Specification for more information about Pin reset.

    image description

  • For what it's worth, I found your question while looking for a solution to this problem. Simply adding the CONFIG_GPIO_AS_PINRESET to define in C/C++ section of the project settings did not enable the reset. I realize you may have solved your problem, but perhaps this will help others.

    First thing to check is whether the PSELRESET[0] and PSELRESET[1] registers hold the correct values. Mine held 0xFFFF FFFF, which was most definitely not going to work. You can check these registers by running your code in Debug mode and opening up the register viewer for UICR. The two registers are at the bottom of the list. Expand the register in viewer and you will see two items: pin id and connect/disconnect status. You will want the pin id to be 21 (0x15), or whatever else you desire, and the connect/disconnect bit to be 0 (active low). So for pin 21 to be reset, both registers must read 0x00000015. If this is already set, then your reset should be working.

    Please note that the documentation will show the pin value as 21 by default, but the register viewer in Keil says 0x1F which is not 21. So simply clearing the MSB will not work (pin 31 will be reset).

    If these are not set correctly even with the pre-processor option added, you will need to change it manually. If you are using the DK, you can open up nRFgo Studio and do it through there. There is a button for doing this there:

    Reset pin enable in nRFgo

    If you are not using the DK, or you do not see the button, then you will have to do it manually through nrfjprog.exe (this is part of nRFgo Tools). I would suggest doing an Erase All in nRFgo and reflashing the softdevice back onto the chip (if you are using a SD).

    For nrfjprog.exe commands, you will want the following:

     nrfjprog.exe --memwr 0x10001200 --val 0x00000015
     nrfjprog.exe --memwr 0x10001204 --val 0x00000015
    

    You can do a readback to verify that the write was successful:

    nrfjprog.exe --memrd 0x10001200
    nrfjprog.exe --memrd 0x10001204
    

    Of course, if you want a pin other than 21 to be the reset, use a proper value instead of 0x00000015. Lastly, UICR maintains values between reprogramming and reset cycles, but not if you do an erase all (it.. erases all?).

  • Excellent answer, but I have a short comment. Even though the PSELRESET[0] and PSELRESET[1] register has a PIN field, the only legal value of this field is 21. This means that P0.21 is the only pin that can be used as a reset pin, and the PSELRESET registers can only be used to enable or disable reset on that pin.

  • Are you sure that only pin 21 is allowed as reset pin? I couldn't find a clear statement about that. The SDK itself configures the pin 21 as reset with CONFIG_GPIO_AS_PINRESET, but the description of PSELRESET doesn't limit the reset function to this pin. Where in documentation is written that the reset is limited to pin 21?

Related