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

Crash after calling pm_conn_secure()

I want to add ANCS client to my code. Like in the ble_app_ancs_c example, I start a timer after BLE_GAP_EVT_CONNECTED. The timer handler calls pm_conn_secure() if the connection is not secured. The pm_conn_secure() function returns NRF_SUCCESS but there is a crash just after that. There is SIGTRAP break at address 0x24356, previous address on call stack is 0xffffffe0 (Eclipse shows this, on the other hand the value of link register LR is 0xffffffe1 - Return to Handler mode, exception return uses floating-point-state from MSP and execution uses MSP after return). It happens every time a connection is made. Why? How can I debug it? Is this softdevice crashing?

Parents
  • Hi,

    Are you running in debug mode when this happen? Are you getting any error messages?

  • Are you setting a breakpoint? If you are setting a breakpoint when the softdevice is running you get to look at the state of things at that point, but as soon as you try to step or re-start, the softdevice finds that it have missed many time critical events and aborts.

  • I know about this behavior and I don't set any breakpoints. If I use a breakpoint, the execution jumps to app_error_fault_handler(). But this is not the case. There is no breakpoint set and mentioned handler is not called. There is SIGTRAP which happens after a connection is made. The connection itself is successful and the central device can enumerate services and characteristics. But just after that there is pm_conn_secure() called and SIGTRAP happens. Execution halts at 0x24356 which is probably SoftDevice code or unused space between SoftDevice and my code, which starts at 0x26000.

    My project is based on HRS FreeRTOS example. Maybe FreeRTOS has some influence here. The problem is easy to reproduce. Just take Nordic HRS example and add a timer started at BLE_GAP_EVT_CONNECTED event and calling sec_req_timeout_handler(), just like in the ANCS client example. You are going to get a crash at 0x24356 when a central connects.

Reply
  • I know about this behavior and I don't set any breakpoints. If I use a breakpoint, the execution jumps to app_error_fault_handler(). But this is not the case. There is no breakpoint set and mentioned handler is not called. There is SIGTRAP which happens after a connection is made. The connection itself is successful and the central device can enumerate services and characteristics. But just after that there is pm_conn_secure() called and SIGTRAP happens. Execution halts at 0x24356 which is probably SoftDevice code or unused space between SoftDevice and my code, which starts at 0x26000.

    My project is based on HRS FreeRTOS example. Maybe FreeRTOS has some influence here. The problem is easy to reproduce. Just take Nordic HRS example and add a timer started at BLE_GAP_EVT_CONNECTED event and calling sec_req_timeout_handler(), just like in the ANCS client example. You are going to get a crash at 0x24356 when a central connects.

Children
No Data
Related