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

Central device claims to have Connected but no Connection event is fired on the peripheral

I'm developing a multirole device to connect to a peripheral device that we developed earlier.

The multirole device when acting as a central device it scans for the peripheral and if found it connects, then secure the connection and bond. After several successful connections, the central says that it connects to the peripheral but before being able to secure the connection or to discovery the services it disconnects.

I've enabled the logger on both devices and added logs to see the progress of the connection and the events.

I've seen that when the problem happens, the central is showing me the BLE_GAP_EVT_CONNECTED but the peripheral doesn't show anything. it's like the central device is firing a false BLE_GAP_EVT_CONNECTED event.

I've tried with the scan_params.extended on and off and the behavior is the same.

I've confirmed that when connected from another central that works fine (using the phone with the nrfConnect application), the peripheral shows the events as expected.

Both devices are using the nrf52832

The peripheral is using the SDK 15.0.0 and the softdevice s132 6.0.0

The device acting as a central is using the SDK 16.0.0 and the softdevice s132 7.0.1

Parents
  • You are not writing anything about how frequently this occurs , but it is possible that the connection request packet from the central to the peripheral from time to time is lost (e.g. due to interference). In such case the central will first get an BLE_GAP_EVT_CONNECTED event, then shortly after get an BLE_GAP_EVT_DISCONNECTED event with disconnect reason BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED. 

    Best regards,
    Kenneth

  • Hello Kenneth, as I say before, the connection works fine for a while, I can turn off, turn on, disconnect, reconnect several times, then suddenly, it stops working, no more connection to that particular peripheral, I don't believe it's something regarding interference, both devices are close, is not like it sometimes connects and sometimes it fail, when the issue happens, it never connect again. However, without moving anything, just deleting bonds or doing a mass erase it starts working again. 

    I'm going to try to sniff the packets to check if there's something wrong that I'm not seeing in the logs, however I need to get the nrf52 DK or the dongle to do it.

    Summarizing:

    1. After a fresh mass erase or a delete bonds, everything works fine, it always find the peripheral, connect, bonds, reconnects if disconnected, you can power off and on several times and everything works

    2. Suddenly the peripheral doesn't connect anymore, the Central is able to see the advertising packets from the peripheral, however as soon as the central tries to connect, the BLE_GAP_EVT_CONNECTED is received in the Central device but the peripheral doesn't receive anything, shortly after the central disconnects

    3. The peripheral is connectable through another central

    4. Scanning and connecting for another peripheral works fine (creating and using a new bond and a new peer entry)

    5. Deleting all bonds on the central and allowing the peripheral to refresh the bond information fix the connection issues

    6. Repeat from step 1

    I haven't count how many times the connection works before getting the issue, however I'm sure that it's more than at least 10 times, but probably a lot more.

  • It sounds very much like that you have some whitelist enabled/active on the peripheral, and if for instance the peripheral is bonded with >8 devices, then it is not able to include the "older" centrals in the whitelist. Hence the "old" central will not be able to connect.

    It may also be because the central have deleted or erased it's bond data, in such case you need to allow re-pairing from the peripheral by adding the following code on the peripheral:

    https://devzone.nordicsemi.com/f/nordic-q-a/37837/sdk15-paring-problem/145821#145821 

    I assume you are not altering the GAP address on the central or peripheral here.

  • Hello Keneth, yes, I'm using a whitelist on the peripheral, however, that's not the problem, there's no other central trying connecting, and if that would be the case, disabling the whitelist on the peripheral would allow the old central to connect again, however, even disabling the whitelist on the peripheral doesn't work unles I delete all bonds on the central device.

    I've already tested the allowing repair, that's not the issue, the code doesn't even reach the event PM_EVT_CONN_SEC_CONFIG_REQ on the peripheral. before getting to that point it requires to fire at least BLE_GAP_EVT_CONNECTED or PM_EVT_BONDED_PEER_CONNECTED, whitch doesn't occour. It's like the connection request is not going out over the air, or the peripheral filter it somehow, is there a way to debug the Softdevice sd_ble_gap_connect step by step?

Reply
  • Hello Keneth, yes, I'm using a whitelist on the peripheral, however, that's not the problem, there's no other central trying connecting, and if that would be the case, disabling the whitelist on the peripheral would allow the old central to connect again, however, even disabling the whitelist on the peripheral doesn't work unles I delete all bonds on the central device.

    I've already tested the allowing repair, that's not the issue, the code doesn't even reach the event PM_EVT_CONN_SEC_CONFIG_REQ on the peripheral. before getting to that point it requires to fire at least BLE_GAP_EVT_CONNECTED or PM_EVT_BONDED_PEER_CONNECTED, whitch doesn't occour. It's like the connection request is not going out over the air, or the peripheral filter it somehow, is there a way to debug the Softdevice sd_ble_gap_connect step by step?

Children
  • I think the next step for debugging is to try download and use the nRF sniffer, so we may see if the connection request packet is indeed sent or not:

    https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE 

    On the peripheral you may also monitor the whitelist, to see if it's updated at any time during, before or after advertisement/connection.

  • I finally was able to get the sniffer traces, I can't see any connection response from the peripheral, however, the master still tries to negotiate the MTU

    traces_with_issue.pcapng

    The peripheral address is: e6:9d:93:ce:2d:c0

    and the master address is: e1:2e:95:29:49:6c

  • Everything is pointing to the connection request packet is not received (the advertisement timing indicate that the interval is not stopped at any time). The MTU exchange is just the first packet from the central, so that doesn't contradict that the connection request packet is not received.

    Presuming that whitelist is not enabled on the peripheral, then the only other explanation is some noise preventing the connection request packet to be received on the peripheral. Is the peripheral here an nRF52-DK or your own hardware? Is there any serial interfaces active near the antenna that may prevent the packet from being received?

    Best regards,
    Kenneth

  • The MTU exchange shouldn't wait for the connection response?

    The whitelist is enabled on the peripheral, but the central is a known device and it's within the whitelist of the peripheral

    The peripheral is our own hardware, It's working just fine with other central using other softdevice s132 6.0.0

    I doubt it has something to do with signal interference, the problem seems to be related with the flash storage on the central, because as soon as you do a mass erase on the central and disable the whitelist on the peripheral to allow the bond to be updated, it connects again. All this without changing anything in the environment.

    Before you ask, I've already tried disabling the whitelist on the peripheral, The peripheral doesn't even know there's a connection request.

    I've noticed that the problem happens when the central has more than one device in the whitelist,

  • nvelozsavino said:
    I've noticed that the problem happens when the central has more than one device in the whitelist,

    Do you have a sniffer log of failing and working? The next step would be to look at the content of the connection request packet from the central. The peripheral do not have any knowledge of the whitelist that may be present on the central, so this is indeed very odd.

    Kenneth

Related