Spurious restarts on nRF52832 with ble_app_uart example if no BLE device connected

I was developing application very similar to the basic ble_app_uart_pca10040_s132 example when I started getting random restarts and Segger Embedded Studio breaks at a strange location. Without SES the device just restarts without breaking after several minutes.

This happens also with the stock ble_app_uart example and the stack and memory range are weird (not sure from memory map where they actually belong).

RESETREAS is always 0x10004 which seems that the reset is from software.

It never hits the asserts or app_error_handler or app_error_fault_handler though like here.

I tried to debug it by stepping, but that causes softdevice to memfault.

The call stack and disassembly where SES breaks looks like this always:

It also does not seem to be any of the faults like HardFault.

Then the code continues back to main().

Weirdest part is that the restarts do not happen if a BLE device is connected to the Nordic UART. Only if no device is connected, then after several minutes it restarts.

  • I think we misunderstood each other here. There is no direct assert in sleep_mode_enter(), I was demonstrating it on the unmodified ble_app_uart example (which doesn't have explict assert).

    It's however not possible to enter System OFF mode while the chip is in debug mode, so this will lead to an assertion and cause the program to reset in the default error handler.

    Though this part is not what what is happening. Regardless whether Release or Debug configuration is chosen, both times sleep_mode_enter() ends up resetting without triggering any assert. I've tried this for s112 and s132 softdevices just to be sure. At least in the latest SDK_17.1.0 and gcc toolchain used as compiler.

  • I should have clarified that I was referring to the chip's Debug Interface mode,  and not the FW's build configuration. So as long as you are debugging the application, you will only be able to enter what's called "Emulated System OFF mode". This is why sd_power_system_off() will return with an error instead of actually going to sleep if you try to debug the app.

Related