ERROR 12291 [Unknown error code]

Hi All,

I  have a question that when BLE connected it will show an error.

Accroding to the error,it show main.c : 163 have problem.

This is a characteristic in my custom service,I want it to use notify,so I reference battery service code.

Can anyone help me to review code?

SDK : 17.1.0

IDE : Segger

The attachment is my project, which contains customer service Header & C source

8053.test.zip

Parents
  • Hi,

    The APP_ERROR_CHECK() on line 163 checks the return value of the call to ble_cs_error_check_update() on line 156, so you should debug  inside that function to see what happens. For where within there does the return value 12291 (BLE_ERROR_INVALID_ATTR_HANDLE .) come from? Can you track it further?

    Looking at the code I do not see that the handle has any sensible value:

            hvx_params.handle = p_cs->error_char_handles.value_handle;

    the above is never set, and so I expect this fails in your error_messages_send() where sd_ble_gatts_hvx() is called with a invalid handle. You should debug to validate. To fix this, ensure to add the characteristic properly. See this old post.

Reply
  • Hi,

    The APP_ERROR_CHECK() on line 163 checks the return value of the call to ble_cs_error_check_update() on line 156, so you should debug  inside that function to see what happens. For where within there does the return value 12291 (BLE_ERROR_INVALID_ATTR_HANDLE .) come from? Can you track it further?

    Looking at the code I do not see that the handle has any sensible value:

            hvx_params.handle = p_cs->error_char_handles.value_handle;

    the above is never set, and so I expect this fails in your error_messages_send() where sd_ble_gatts_hvx() is called with a invalid handle. You should debug to validate. To fix this, ensure to add the characteristic properly. See this old post.

Children
Related