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

Only one device is getting paired with nrf51422

I have read the previous questions regarding the above subject, i found that changing the maximum bonding devices limit defined in device_manager_cnfg.h will work, but it did not worked for me. I have edited the ble_app_uart example code to support passkey pairing.

I also found the bounding info is stored in flash memory. So I erased the flash and reprogrammed it but still it is pairing with only that device which was paired before erasing flash. Kindly help to fix this

iam attaching my project file, kindly find the same.nRF_DK.rar

Thanks in advance, Sunil Kumar

Parents
  • static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            xl_appl_send_rtc_time();
            xl_isconnectec_to_app_b = true;
            send_active_event_num_flag_b = true;
            break;
        case BLE_GAP_EVT_DISCONNECTED:
            err_code = bsp_indication_set(BSP_INDICATE_IDLE);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
    
            xl_isconnectec_to_app_b = false;
            break;
    
        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported       
           
      //      sec_param_ret = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_BR_EDR_IN_PROG,&register_param.sec_param , &p_sec_keyset);
            APP_ERROR_CHECK(sec_param_ret);
            break;
        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
           //  No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;
    
        case BLE_GAP_EVT_AUTH_KEY_REQUEST:
            sd_ble_gap_auth_key_reply(m_conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY,passkey);
        break;//todo: PASSKEY
        
        case BLE_GAP_EVT_PASSKEY_DISPLAY:{
                 //       memcpy(passkey1, p_ble_evt->evt.gap_evt.params.passkey_display.passkey, PASSKEY_LENGTH);
                //        passkey1[PASSKEY_LENGTH] = 0;
                 //       break;
            }
        default:
            // No implementation needed.
            break;
    }
    

    }

Reply
  • static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            xl_appl_send_rtc_time();
            xl_isconnectec_to_app_b = true;
            send_active_event_num_flag_b = true;
            break;
        case BLE_GAP_EVT_DISCONNECTED:
            err_code = bsp_indication_set(BSP_INDICATE_IDLE);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
    
            xl_isconnectec_to_app_b = false;
            break;
    
        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported       
           
      //      sec_param_ret = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_BR_EDR_IN_PROG,&register_param.sec_param , &p_sec_keyset);
            APP_ERROR_CHECK(sec_param_ret);
            break;
        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
           //  No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;
    
        case BLE_GAP_EVT_AUTH_KEY_REQUEST:
            sd_ble_gap_auth_key_reply(m_conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY,passkey);
        break;//todo: PASSKEY
        
        case BLE_GAP_EVT_PASSKEY_DISPLAY:{
                 //       memcpy(passkey1, p_ble_evt->evt.gap_evt.params.passkey_display.passkey, PASSKEY_LENGTH);
                //        passkey1[PASSKEY_LENGTH] = 0;
                 //       break;
            }
        default:
            // No implementation needed.
            break;
    }
    

    }

Children
No Data
Related