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

Central and Peripheral disconnect error!

Hello,

I have a central and Peripheral beacon on nrf52832. I am usıng nus services on both devices. After the data transfer I call the

 uint8_t err_code = sd_ble_gap_disconnect(m_ble_nus_c.conn_handle,
                        BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);

ıt works fluently on the central side. But at the Peripheral side disconnection reason become

BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED          0x3E

and beacon reseting itself.

but if I managed somehow timeout the connection beacon also works fluently.

Also my beacon works with nfr uart app.

I couldnt find a solution.

Thank you for your support!

Parents
  • Hi,

    ıt works fluently on the central side. But at the Peripheral side disconnection reason become

    This is not clear to me. Can you clarify if the nRF acts as a central or peripheral when this error occurs?

    If the nRF acts as a central that connects to a peripheral, then you would typically get this reason if the peripheral ignores the connection request, for instance if it uses a whitelist and the initiator is not in the whitelist.

    There could also be other problems you could see in either role, where no packets are exchanged after the connection request due to some other error (clock drift, interference, etc.)

  • This is not clear to me. Can you clarify if the nRF acts as a central or peripheral when this error occurs?

    Both devices are nrf52832. I am doing some flash operations and changing advertising data after the connection after the disconnection. When i am doing with nrf uart app Peripheral is making all flash operations and other processes but if i use the central nrf52832 i am transfering data perfectly after i call

     uint8_t err_code = sd_ble_gap_disconnect(m_ble_nus_c.conn_handle,
                            BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);

    Then Peripheral does not changing the advertising data and pheripheral's disconnection reason is 0x3E BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED (in uart app disconnection reason is 0x13 which is BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION).

    On the otherhand if I dont use sd_ble_gap_disconnect and somehow manage to timeout the connection, then pheripheral gets 0x08 BLE_HCI_CONNECTION_TIMEOUT as a disconnect reason and pheripheral doing all flash operations and changing advertising data.

Reply
  • This is not clear to me. Can you clarify if the nRF acts as a central or peripheral when this error occurs?

    Both devices are nrf52832. I am doing some flash operations and changing advertising data after the connection after the disconnection. When i am doing with nrf uart app Peripheral is making all flash operations and other processes but if i use the central nrf52832 i am transfering data perfectly after i call

     uint8_t err_code = sd_ble_gap_disconnect(m_ble_nus_c.conn_handle,
                            BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);

    Then Peripheral does not changing the advertising data and pheripheral's disconnection reason is 0x3E BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED (in uart app disconnection reason is 0x13 which is BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION).

    On the otherhand if I dont use sd_ble_gap_disconnect and somehow manage to timeout the connection, then pheripheral gets 0x08 BLE_HCI_CONNECTION_TIMEOUT as a disconnect reason and pheripheral doing all flash operations and changing advertising data.

Children
  • Hi,

    You will get BLE_HCI_CONNECTION_TIMEOUT if there is a supervision timeout. However, if there was never any packets successfully transferred after the connection request, the timeout is shorter, and the reason will be BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED. This post describes it well. More details form the BT spec (4.2):

    The Connection Failed to be Established error code indicates that the LL
    initiated a connection but the connection has failed to be established.

    If you only see this when doing a lot of(?) flash operations, it could be that the SoftDevices schedules flash writes so that ble events are missed.

Related