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

ble_db_discovery_start doesn't complete with specific phone

My project uses nRF52840-DK to connect, bond and discover a custom service with two characteristics (TX and RX) and RX Characteristic has a CCCD (0x2902).

The flow of the software goes as follow:

1) the nRF connects to the phone

2) the nRF bonds to the phone

3) the nRF starts discovery of the service

4) the nRF reads/writes from/to the phone using the service

This works as expected with different phones I tried (Galaxy S6, S6 Edge and S7, android versions 7.0, 7.0 and 8.0). but when using Galaxy A31 android version 10.0 I can't complete discovery. I added a print to ble_db_discovery_on_ble_evt() and noticed that with the issued phone I don't get the events with BLE_GATTC_EVT_CHAR_DISC_RSP (50) and BLE_GATTC_EVT_DESC_DISC_RSP (51) which I do get with the working phones.

Furthermore, the issued phone gets a disconnect after some time with error BLE_HCI_CONNECTION_TIMEOUT, which I believe happens because the discovery prevents the nRF to maintain the connection (I saw that with out calling  ble_db_discovery_start the connection doesn't disconnect after a long time).

Does anyone have an idea why this happens?

Thanks in advance

Log of working phone:

<debug> ble_db_disc: Starting discovery of service with UUID 0x1101 on connection handle 0x0.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Primary Services Discovery Request
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 48
<debug> ble_db_disc: Found service UUID 0x1101.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Characteristic Discovery Request
<debug> nrf_ble_gq: SD GATT procedure (3) succeeded on connection handle: 0.
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 50
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Characteristic Discovery Request
<debug> nrf_ble_gq: SD GATT procedure (3) succeeded on connection handle: 0.
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 50
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Characteristic Descriptor Request
<debug> nrf_ble_gq: SD GATT procedure (4) succeeded on connection handle: 0.
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 51
<info> ble_db_disc: 0 cccd_handle 43
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Characteristic Descriptor Request
<debug> nrf_ble_gq: SD GATT procedure (4) succeeded on connection handle: 0.
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 51
<debug> ble_db_disc: Discovery of service with UUID 0x1101 completed with success on connection handle 0x0.
<info> app: Discovery complete.

Log of issued phone:

<debug> ble_db_disc: Starting discovery of service with UUID 0x1101 on connection handle 0x0.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Primary Services Discovery Request
<debug> nrf_ble_gq: Processing the request queue...
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 48
<debug> ble_db_disc: Found service UUID 0x1101.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Characteristic Discovery Request
<debug> nrf_ble_gq: SD GATT procedure (3) succeeded on connection handle: 0.
****AFTER A FEW SECONDS*****
<debug> ble_db_disc: XXXX: ble_db_discovery_on_ble_evt 17
<info> app: Disconnected. conn_handle: 0x0, reason: 0x8

Parents Reply Children
Related