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

GPIO wakeup from system OFF under FreeRTOS restarts at address 0x00000A80

Hello -

We are using SDK 15.3.0, FreeRTOS and the nRF52840-DK board with SES. We implemented wakeup from System Off sleep using the nrf_gpio_cfg_sense_input() API, which seems to work:

nrf_gpio_cfg_sense_input(pin, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);

When we run our debug build and wakeup from System Off sleep by pressing the button, the debugger breaks at address 0x00000A80, the third line of assembly below:

BF20        wfe
E7FD        b 0x00000A7C
4B06        ldr r3, [pc, #24]

Pressing the continue button in SES also works as expected. The app restarts and the reset cause is correct.

But when I run the same basic flow using the SDK ram_retention app, which isn't running FreeRTOS, the app breaks at the Reset_Handler after pressing the button. Our .emProject file is configured for the Reset_Handler entry point:

gcc_entry_point="Reset_Handler"

Is there another configuration option to make a FreeRTOS app break in the Reset_Handler under these circumstances? It seems that the reset handler gets invoked before main().

Regards,

Brian

Parents
  • The  System OFF mode does not work in debug mode. It is just emulated as mentioned here.

    So it is recommended that if have an infinite while loop just after calling the SYSTEM_OFF mode in your application. That way when you start your program in debug mode, the instructions after the SYSTEM_OFF call are also executed. Most likely in your application the main function is exited causing the CPU to execute illegal instructions causing hardfault. Address 0x00000A80 seems to be the hardfault handler address inside the MBR in the softdevice.

    but in non debug mode, the instructions after the SYSTEM_OFF call are never reached.

Reply
  • The  System OFF mode does not work in debug mode. It is just emulated as mentioned here.

    So it is recommended that if have an infinite while loop just after calling the SYSTEM_OFF mode in your application. That way when you start your program in debug mode, the instructions after the SYSTEM_OFF call are also executed. Most likely in your application the main function is exited causing the CPU to execute illegal instructions causing hardfault. Address 0x00000A80 seems to be the hardfault handler address inside the MBR in the softdevice.

    but in non debug mode, the instructions after the SYSTEM_OFF call are never reached.

Children
No Data
Related