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

ble app uart peripheral does not automatically reconnect to central after disconnection

Hi

I have a nRF52832-DK based central node and multiple nrf52832 based peripheral nodes implemented using a combination of ble app uart c + multilink central at the central node and ble app uart at the peripheral node. While the central is able to connect to multiple devices and get the data, I would also like to have a feature where the central will allow peripherals to reconnect automatically if the peripheral goes out of range and returns back to range. I can confirm that the peripheral keeps advertising when it loses connection, but a connection could not be established. However, if I do a hard reset on the central node, it reconnects to the peripherals. Upon debugging the central node, i got the following message on debug window:

<info> app: Disconnected.
<info> app: Start scanning for device name Taurus_Care.
<info> app: LBS central link 0x0 disconnected (reason: 0x8)

Following is the code within BLE_GAP_EVT_DISCONNECTED event.

        // Upon disconnection, reset the connection handle of the peer which disconnected, update
        // the LEDs status and start scanning again.
        case BLE_GAP_EVT_DISCONNECTED:
        {
                NRF_LOG_INFO("NUS central link 0x%x disconnected (reason: 0x%x)",
                             p_gap_evt->conn_handle,
                             p_gap_evt->params.disconnected.reason);

                if (ble_conn_state_central_conn_count() == 0)
                {
                        err_code = app_button_disable();
                        APP_ERROR_CHECK(err_code);

                        // Turn off the LED that indicates the connection.
                        bsp_board_led_off(CENTRAL_CONNECTED_LED);
                }

                scan_start();
        } break;

Please help me on what configuration needs to be changed to achieve automatic reconnection once the peripheral comes back into range of the central node. 

Regards

Vignesh

Related