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

Breakpoint triggers fault handler

Hello,

I'm using a NRF52832 with SoftDevice s132 v7.0. I also have freertos. I have an app which advertises and scans. The app is set up to trigger a break point on assertions as well - by using app_error_weak.c

I noticed that if I put a breakpoint in the scan event handler, once i single step i go into the assert handler. However, without the breakpoint the program doesn't assert. I know this because the scan event handler is passing messages to an rtos task. I can breakpoint in the rtos task and verify that I received a message. However, in the rtos task, once I step the debugger I go into a assert there too. What could be causing this?  

note:

I stepped through app_error_weak.c's app_error_fault_handler and found that the id was NRF_FAULT_ID_SD_ASSERT, so  it appears that the softdevice is throwing an assert when the program halts on a breakpoint. 

  • Hi,

    The SoftDevice is expected to assert when pausing execution, as it uses timers to check that it conforms to timing constraints. If for instance the SoftDevice is unable to prepare a data packet and send it out at the correct time for a connection event, it will assert. Any timing failure is considered an indication of critical failure where the SoftDevice may be in an undetermined state. Attempts to recover could lead to undefined behavior, hence the assert (which in a production device will lead to reset.)

    What this means for development, is that pausing execution while the SoftDevice is enabled, in a debug session, in most instances makes the SoftDevice assert shortly after resuming code execution.

    It is possible to run the SoftDevice in the background, with what is called monitoring mode debugging (MMD). However I do not have experience with MMD in the context of FreeRTOS.

    Regards,
    Terje

Related