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

NRF_ERROR_INVALID_PARAM with sd_ble_gap_sec_params_reply

development environment: SDK 14.2 , NRF52840 as central and NRF52832 as periph for Bonding: Passkey Entry, Central displays, and the error occur on nrf52840.

I want to know the detail  rules about NRF_ERROR_INVALID_PARAM, Any assistance will be appreciated

the code snippet as follows:


    uint32_t  err_code;
    memset(&sec_params,0,sizeof(ble_gap_sec_params_t));

    sec_params.bond = 1;
    sec_params.io_caps = BLE_GAP_IO_CAPS_KEYBOARD_ONLY;
    sec_params.max_key_size = 16;
    sec_params.min_key_size = 7;
    sec_params.oob = 0;
    sec_params.mitm = 1;


    sec_params.kdist_own.enc      = 1;
    sec_params.kdist_own.id       = 0;
    sec_params.kdist_own.link     = 0;
    sec_params.kdist_own.sign   = 0;

    sec_params.kdist_peer.enc  =  1;
    sec_params.kdist_peer.id   =  0;
    sec_params.kdist_peer.link =  0;
    sec_params.kdist_peer.sign =  0;



    
    m_sec_key_set.keys_own.p_enc_key  = &m_mcs_enc_key;
    m_sec_key_set.keys_own.p_id_key   = NULL;
    m_sec_key_set.keys_own.p_pk       = NULL;
    m_sec_key_set.keys_own.p_sign_key = NULL;

    
    m_sec_key_set.keys_peer.p_enc_key  = &m_remote_enc_key;
    m_sec_key_set.keys_peer.p_id_key   = NULL;    
    m_sec_key_set.keys_peer.p_pk         = NULL;    
    m_sec_key_set.keys_peer.p_sign_key = NULL;

    
    err_code=sd_ble_gap_sec_params_reply(conn_handle,BLE_GAP_SEC_STATUS_SUCCESS,&sec_params,&m_sec_key_set);
    //err_code=sd_ble_gap_sec_params_reply(conn_handle,BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,NULL,NULL);
    APP_ERROR_CHECK(err_code);

the code above is used on the BLE_GAP_EVT_SEC_PARAMS_REQUEST.  at the debug point(BLE_GAP_EVT_SEC_PARAMS_REQUEST), i found peer_params.min_key_size was zero.

Related