Reply BLE pair params error

I'm using pc-ble driver-master for programming.
The hardware uses 52840 dongle and calls SD_API_V5.
After I successfully connected, I sent a pairing request using the sd_ble_gap_authenticate() function, The sd_ble_gap_sec_params_reply() function is then used in the "BLE_GAP_EVT_SEC_PARAMS_REQUEST" event.
But this function has an error message 0x07, I try to check or use other parameters to reply will get an error.

Parents Reply Children
  • Hi, Susheel Nuguru.

    I use nRF Connect BLE app try to pair my dut. There seems to be nothing wrong with it. After that, I close the app and tried to program to realize the same action, but he reported an error, so now I am not sure if there is any problem. I also read the help document, and I think my process is OK. But the passing of parameters can be problematic.

    This code, when run under "sd_ble_gap_sec_params_reply()", gets an error :0x10.

    uint32_t pair(){
        uint32_t err_code;
        memset(&m_sec_params, 0, sizeof(ble_gap_sec_params_t));
    
        m_sec_params.bond = 0;
        m_sec_params.mitm  = 0;
        m_sec_params.lesc  = 1;                                // Use LE Secure Connection
        m_sec_params.io_caps = BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY;   // Setting I/O capabilities may vary
                                                               // depending on your device
        m_sec_params.oob          = 0;                           // Do not use OOB
        m_sec_params.keypress     = 0;  // Disable keypress notifications
        m_sec_params.min_key_size = 7;                           // Minimum key size
        m_sec_params.max_key_size = 16; // Maximum key size
        m_sec_params.kdist_own.enc = 0;                           // Own encryption key distribution
        m_sec_params.kdist_own.id  = 0;  // Own identity key distribution
        m_sec_params.kdist_peer.enc = 0; // The encryption key of the peer end is distributed
        m_sec_params.kdist_peer.id  = 0;  // The identity key of the peer end is distributed
    
        err_code = sd_ble_gap_authenticate(m_adapter, m_connection_handle, &m_sec_params);
        if (err_code != NRF_SUCCESS)
        {
            DEBUG_PRINT("Failed to initiate authentication 0. Error: %d\n", err_code);
            return err_code;
        }
        
        err_code = wait_trigger_evt(BLE_GAP_EVT_SEC_PARAMS_REQUEST);
        if (err_code != NRF_SUCCESS)
        {
            DEBUG_PRINT("Failed to initiate authentication 1. Error: %d\n", err_code);
            return err_code;
        }
        return err_code;   
    }
    
    
    
    static void on_sec_params_reply(ble_gap_sec_params_t sec_params)
    {   
        uint32_t err_code;
    
        err_code = sd_ble_gap_sec_params_reply(m_adapter, m_connection_handle,
                                               BLE_GAP_SEC_STATUS_SUCCESS, NULL, &m_keyset);
    
        if (err_code != NRF_SUCCESS)
        {
            DEBUG_PRINT("Failed to reply to security parameter request. Error: 0x%02X\n", err_code);
            return;
        }
    
    }

  • Sorry to trouble you, I made a very low-level mistake that led to this problem, please close this post.

    So sorry about than. Thanks for your halp!

Related