example code to generate different nrf52 reset cause

Hi team, 

I am working on a feature to capture different reset reasons and take action. If someone has an example code to create these will be a great help.

Parents
  • Hi,

    We do not have example code that can be used for all reset reasons, but we have examples for the most typical use-cases.

    • OFF: System OFF example with wakeup from GPIO.
    • NFC: Wake on NFC Example
    • RESETPIN: Press the reset button on the DK (make sure CONFIG_GPIO_AS_PINRESET is defined in the project). Alternatively, you can connect a GPIO the Reset pin and assert the GPIO.
    • SREQ: Call NVIC_SystemReset() from code.
    • LOCKUP: The only way I know to cause CPU lockup is to trigger a HardFault from the HardFault handler.
    • DOG: See WDT Example. Not pressing the button within 2 seconds to feed the watchdog will cause a watchdog reset.
    • DIF: As far as I know, this can't be done from code, but will happen if you attach the debugger when in system OFF mode.
    • VBUS: Not aware of any example codes showing this, but it should be as simple as entering System OFF mode, then connect the nRF_USB port to power.
    • LPCOMP: Start out with the LPCOMP Example and extend it with going to System OFF after initialization. 

    Best regards,
    Jørgen

Reply
  • Hi,

    We do not have example code that can be used for all reset reasons, but we have examples for the most typical use-cases.

    • OFF: System OFF example with wakeup from GPIO.
    • NFC: Wake on NFC Example
    • RESETPIN: Press the reset button on the DK (make sure CONFIG_GPIO_AS_PINRESET is defined in the project). Alternatively, you can connect a GPIO the Reset pin and assert the GPIO.
    • SREQ: Call NVIC_SystemReset() from code.
    • LOCKUP: The only way I know to cause CPU lockup is to trigger a HardFault from the HardFault handler.
    • DOG: See WDT Example. Not pressing the button within 2 seconds to feed the watchdog will cause a watchdog reset.
    • DIF: As far as I know, this can't be done from code, but will happen if you attach the debugger when in system OFF mode.
    • VBUS: Not aware of any example codes showing this, but it should be as simple as entering System OFF mode, then connect the nRF_USB port to power.
    • LPCOMP: Start out with the LPCOMP Example and extend it with going to System OFF after initialization. 

    Best regards,
    Jørgen

Children
Related