Unexpected error assertion crashes SDK6 application
ID: LPCBARESDK-1159
Status: Open
First reported: 6.0.24.1464
Fixed in: TBD
Affected devices
All DA1453x and DA1458x devices.
Description
The BLE firmware can crash when an unexpected status occurs for
GAPC_CMP_EVT in gapc_cmp_evt_handler. The SDK currently treats
this as a fatal error and triggers a reset.
These cases should use ASSERT_WARNING instead of ASSERT_ERROR so
they can be detected during debugging and handled in the application
(for example in app_process_catch_rest_cb). In production builds,
this should not cause a device crash or reset.
Workaround
In gapc_cmp_evt_handler inside app_task, the issue occurs because
an unexpected BLE security error leads to ASSERT_ERROR(0), which
crashes the firmware.
Replacing it with ASSERT_WARNING(0) prevents a hard crash and allows
the firmware to continue running instead of entering a reset loop.
Apply the following change:
diff --git a/sdk/app_modules/src/app_common/app_task.c b/sdk/app_modules/src/app_common/app_task.c
--- a/sdk/app_modules/src/app_common/app_task.c
+++ b/sdk/app_modules/src/app_common/app_task.c
@@ -303,11 +303,11 @@ static int gapc_cmp_evt_handler(ke_msg_id_t const msgid,
// param->operation = GAPC_DISCONNECT
// param->status = GAP_ERR_COMMAND_DISALLOWED
// In that case it is better to continue, instead of ending up to
- // the ASSERT_ERROR() breakpoint that follows.
+ // the ASSERT_WARNING() breakpoint that follows.
}
else if (param->status != GAP_ERR_NO_ERROR)
{
- ASSERT_ERROR(0); // unexpected error
+ ASSERT_WARNING(0); // unexpected error
}
CALLBACK_ARGS_4(catch_rest.cb, msgid, param, dest_id, src_id);
}