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

Disconnection after BLE_GAP_EVT_LESC_DHKEY_REQUEST error 19 (0x13)

Hi all,

after call inside the BLE_GAP_EVT_LESC_DHKEY_REQUEST I got error 8, what can cause it? a CONNECTION_SUPERVISED_TIMEOUT? 

		static nrf_value_length_t peer_public_key_raw = { 0 };

		peer_public_key_raw.p_value = &p_ble_evt->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer->pk[0];
		peer_public_key_raw.length = BLE_GAP_LESC_P256_PK_LEN;

		error = nrf_crypto_ecc_public_key_from_raw(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
			&peer_public_key_raw,
			&m_peer_public_key);
		APP_ERROR_CHECK(error);
		NRF_LOG_INFO("nrf_crypto_ecc_public_key_from_raw %d\r\n", error);

		error = nrf_crypto_ecdh_shared_secret_compute(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
			&m_private_key,
			&m_peer_public_key,
			&m_dh_key);
		APP_ERROR_CHECK(error);
		NRF_LOG_INFO("nrf_crypto_ecdh_shared_secret_compute %d\r\n", error);

		error = sd_ble_gap_lesc_dhkey_reply(connectionhandle, &m_lesc_dh_key);
		APP_ERROR_CHECK(error);
		NRF_LOG_INFO("sd_ble_gap_lesc_dhkey_reply %d\r\n", error);

device nRF52, SDK13

Thanks

  • Hello,

    Could you specify what function that returned error = 0x08?

  • Hi Ed, after the BLE_GAP_EVT_LESC_DHKEY_REQUEST, I got a BLE_GAP_EVT_DISCONNECTED event from there I printf  "p_ble_evt->evt.gap_evt.params.disconnected.reason" and I got error 8 or error 19, my code was working fine until I added the code on BLE_GAP_EVT_LESC_DHKEY_REQUEST it is still unknown for me what is generating it disconnection the only I got is the error code

  • Hello,

    I understand. What device are you trying to connect to? the nRF is the peripheral in the connection? Do you try to connect to a phone acting as a central? Can you try to connect to another nRF using nRF Connect for desktop, and see if you get any information in the log there? Or can you try to provide a sniffer trace, e.g. using nRF Sniffer?

    The reason I want you to try nRF Connect for desktop is that not all devices support LESC. The nRF Connect for desktop using another DK does support this, so it is only to see if the error is on the peripheral side, or on the central side. A supervision timeout suggests that there is something missing from the central, or perhaps there is something that you are not handling correctly on the peripheral side. A sniffer trace would shed some light on this.

    Best regards,

    Edvin

  • Hey Ed, I found my central device is being forced to perform a disconnection, but I am not calling it anywhere, I commented all my sd_ble_gap_disconnect()  on my central and peripherical and it is still disconnecting reason 19 or 0x13

    What other functions can perform a disconnection besides sd_ble_gap_disconnect?

  • Commenting out all sd_ble_gap_disconnect()s will not keep the devices connected. One device will disconnect if the other one e.g. stops responing.

    Could you zoom a bit out on the sniffer log?

    It says that the slave sends the disconnect message. What device are you trying to connect the nRF to? Is it a phone or another nRF (e.g. with nRF Connect for Desktop)?

    Would it be possible to send the entire project instead of the snippet? Or something that I can reproduce the error with?

Related