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

SDK12.2 nRF52832 Central Connect and Disconnect Device Question

Hi, I use nRF52832 and SDK12.2 The Project is ble_central_and_peripheral and the link define is like below #define CENTRAL_LINK_COUNT 4
Here will connect 1 HR device and 3 CSC devices

#define PERIPHERAL_LINK_COUNT 1 Here is waiting for cell phone app

Here is what my project works. When my project power on, MCU will scan 1 HR device and 3 CSC devices and make sure the ble MAC address is my target then connect those device. The result is work and I can got the datas by 4 devices notify handle.

When I press the button to disconnect 4 devices and I wait the on_ble_central_evt’s “p_ble_evt->header.evt_id” got the “BLE_GAP_EVT_DISCONNECTED” 4 times I make sure 4 devices is disconnect.

After I disconnect 4 devices and connect to those devices again. Sometimes the project will stuck on: err_code = ble_db_discovery_start(&m_ble_db_discovery[p_gap_evt->conn_handle], p_gap_evt->conn_handle); APP_ERROR_CHECK(err_code);

And I make sure the 4 devices is advertising because I use 4 nRF51 Dongle and their Led is shiny again.

And my question is: When I disconnect the 4 devices should do some more action or just call sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); And wait on_ble_central_evt make sure device is disconnect then call sd_ble_gap_disconnect to next device and wait on_ble_central_evt again until 4 devices all in disconnect. Then I can connect those device again.

Thanks

Parents
  • I use PCA10040 EVB and I also enable nrf_log so after first time I connect to 4 devices and disconnect those devices. I do connect again the UART port log just stop like below:

    BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x180d for Connection handle 1
    BLE_DB_DISC:INFO:Service UUID 0x180d Not found
    BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x1816 for Connection handle 1
    BLE_DB_DISC:INFO:Found service UUID 0x1816
    BLE_DB_DISC:INFO:Discovery of service with UUID 0x1816 completed with success for Connection handle 1
    

    and no more connect action. If I press reset button then connect is fine but reconnect will stop like that.

    Thanks

Reply
  • I use PCA10040 EVB and I also enable nrf_log so after first time I connect to 4 devices and disconnect those devices. I do connect again the UART port log just stop like below:

    BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x180d for Connection handle 1
    BLE_DB_DISC:INFO:Service UUID 0x180d Not found
    BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x1816 for Connection handle 1
    BLE_DB_DISC:INFO:Found service UUID 0x1816
    BLE_DB_DISC:INFO:Discovery of service with UUID 0x1816 completed with success for Connection handle 1
    

    and no more connect action. If I press reset button then connect is fine but reconnect will stop like that.

    Thanks

Children
No Data
Related