BLE_GAP_SEC_STATUS_TIMEOUT issue

      I used ble_app_hrs Demo to test bonding.  However, I have been unable to bpnd successfully.  I'll give you my bonding parameters.  

#define SEC_PARAM_BOND 1

#define SEC_PARAM_MITM 1

#define SEC_PARAM_LESC 1

#define SEC_PARAM_KEYPRESS 0

#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY

#define SEC_PARAM_OOB 0

#define SEC_PARAM_MIN_KEY_SIZE 7

#define SEC_PARAM_MAX_KEY_SIZE 16

static void peer_manager_init(void)
{
ble_gap_sec_params_t sec_param;
ret_code_t err_code;

err_code = pm_init();
APP_ERROR_CHECK(err_code);

memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));

// Security parameters to be used for all security procedures.
sec_param.bond = SEC_PARAM_BOND;
sec_param.mitm = SEC_PARAM_MITM;
sec_param.lesc = SEC_PARAM_LESC;
sec_param.keypress = SEC_PARAM_KEYPRESS;
sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
sec_param.oob = SEC_PARAM_OOB;
sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
sec_param.kdist_own.enc = 1;
sec_param.kdist_own.id = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id = 1;

err_code = pm_sec_params_set(&sec_param);
APP_ERROR_CHECK(err_code);

err_code = pm_register(pm_evt_handler);
APP_ERROR_CHECK(err_code);
}

      At the same time, I use another device, can bind successfully.  The parameters are the same.

 

Parents
  • Hi,

    BLE_GAP_SEC_STATUS_TIMEOUT itself indicates that a security procedure timed out, but does not provide more information than that, so we need to digg a bit deeper. Can you upload the full sniffer trace for both a failing and working case?

    Which device do you see this issue with (for instance phone model and OS version)? And with which device do you use to test when it works?

  • tried to get the specific request, but the log did not see it.  

    The test master I used was an Android phone-XiaoMi 9.

  • This is the test video

  • Hi,

    I see. If the code changes from your original post reflects all the changes you did, then this is expected. When using LESC and both devices having full I/O capabilities, you will use numeric comparison. But you do not have any code on the nRF that handles that, so it will time out.

    Do you have both a display capability and input (at least yes/no) on your nRF product? If not, you should use another MITM mechanism or no MITM at all.

    If you do have a display and buttons, so that the I/O capabilities you have specified is correct, then you can reply using sd_ble_gap_auth_key_reply() as explained in this post. Note that doing this without the required HW will not add any security, and so it is better to use a different combination (if you have for instance only a display), or no MITM at all.

Reply
  • Hi,

    I see. If the code changes from your original post reflects all the changes you did, then this is expected. When using LESC and both devices having full I/O capabilities, you will use numeric comparison. But you do not have any code on the nRF that handles that, so it will time out.

    Do you have both a display capability and input (at least yes/no) on your nRF product? If not, you should use another MITM mechanism or no MITM at all.

    If you do have a display and buttons, so that the I/O capabilities you have specified is correct, then you can reply using sd_ble_gap_auth_key_reply() as explained in this post. Note that doing this without the required HW will not add any security, and so it is better to use a different combination (if you have for instance only a display), or no MITM at all.

Children
No Data
Related