This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Discovery service dosen't work always

When I keep this function :

static void vMain_iInitDeviceManager_Exe(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);

err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);

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

register_param.sec_param.bond         = SEC_PARAM_BOND;
register_param.sec_param.mitm         = SEC_PARAM_MITM;
register_param.sec_param.lesc         = SEC_PARAM_LESC;
register_param.sec_param.keypress     = SEC_PARAM_KEYPRESS;
register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob          = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler            = device_manager_evt_handler;
register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

err_code = dm_register(&m_app_handle, &register_param);
APP_ERROR_CHECK(err_code);
}

the discovery service works, if not it dosen't work.

SDK11 , hrs_app image description

Parents
  • If you don't use devicemanager, have you handled BLE_GATTS_EVT_SYS_ATTR_MISSING event ? This is needed in the case that the CCCD is not initialized. Usually you can call err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0); Please follow what we do in the ble_app_uart example.

    If you already handled that even could be that the device crashed, could you check if there if it still run after that ? If it didn't crash, could you tell which disconnected reason it is ? (inside DISCONNECTED event check for the reason inside p_ble_evt)

Reply
  • If you don't use devicemanager, have you handled BLE_GATTS_EVT_SYS_ATTR_MISSING event ? This is needed in the case that the CCCD is not initialized. Usually you can call err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0); Please follow what we do in the ble_app_uart example.

    If you already handled that even could be that the device crashed, could you check if there if it still run after that ? If it didn't crash, could you tell which disconnected reason it is ? (inside DISCONNECTED event check for the reason inside p_ble_evt)

Children
No Data
Related