connect/disconnect reasons

Dear All

I am trying connect/disconnect function with the DK, it gives me some reason codes, my app is based on central_multilink, which I cannot find their meanings, could someone point me to the right direction please? some messages are shown below: some are connected and then disconnected, some doesn't connect at all.

Failed to connect to EF:A1:9A:8B:2E:F9 (public) (2)

Connected (1): AC:23:3F:56:1A:BF (public)

Disconnected: AC:23:3F:56:1A:BF (public) (reason 0x13)

Connected (1): 02:67:15:4B:4E:76 (public)

Disconnected: 02:67:15:4B:4E:76 (public) (reason 0x3e)

Disconnected: 02:67:15:4B:4E:76 (public) (reason 0x16)  

 out of these, I only know the reason 0x16, which is disconnected by me.

Thank you.

Ping

  • Hi,

    Those are error codes defined by Bluetooth SIG and part of the Bluetooth specification. In particular:

    0x13 is "remote user terminated connection", and means the other device ended the connection (or stopped broadcasting packets.)
    0x16 is "connection terminated by local host", and means your device ended the connection (or stopped broadcasting packets.)
    0x3e is "connection failed to be established", and means the attempt to set up a connection failed.

    For a full list of these error codes, see the Bluetooth Core Specification, Volume 1, Part F Controller error codes. There is a short listing in section 1 Overview of error codes, and longer descriptions of the various codes in section 2 Error code descriptions.

    Please note that from the central point of view, the connection is considered established when a connection request has been successfully sent (e.g. as a response to a connectable advertising.) In other words the central considers the connection established without any confirmation from the peripheral. If the peripheral never replies, this will be seen from the central side as a successful connection where the peripheral timed out leading to disconnection, while from the peripheral's perspective there was no connection in the first place.

    Regards,
    Terje

  • Hi, Terje

    Thank you for your information!

    I tried to connect some peripherals 1 by 1, for some, connection is established & confirmed by call back function, but then it is disconnected with reason code 0x13 - remote user terminated, any ides why it is disconnected by remote user?

    And for another one - it returns error code 0x3e. again, not sure why.

    Also tried multiple connection, is it possible to have multiple connections at same time?  And disconnect any freely? what is the limitation please?

    Regards!

    Ping

  • Hi,

    PingISTL said:
    for some, connection is established & confirmed by call back function, but then it is disconnected with reason code 0x13 - remote user terminated, any ides why it is disconnected by remote user?

    This could be multiple reasons, as it is the peer device deciding to end the connection. Some devices will end the connection if the connection parameters are outside the range they want. Some will end the connection for other reasons. You could use a BLE Sniffer for figuring out what happens with the connection up to the disconnect. For instance the nRF Sniffer which uses an nRF DK or Dongle as sniffer hardware.

    PingISTL said:
    And for another one - it returns error code 0x3e. again, not sure why.

    This happens when the connection times out because the central gets no packets from the peripheral. E.g. when sending a connection request, and the internal API considers the connection to start, but the peripheral never got the message. When the timeout happens, this is the code you get on the central side, along with a disconnected event.

    PingISTL said:
    Also tried multiple connection, is it possible to have multiple connections at same time?  And disconnect any freely? what is the limitation please?

    You can have up to 20 concurrent connections. You need to decide compile time how many connection slots as central and how many connection slots as peripheral. Then those can be filled up runtime. Each connection is then handled individually.

    Regards,
    Terje

  • Hi, Terje

    Thanks for your reply!

    I have installed sniffer and seems able to capture some data, but I am struggling to interpret them. I have attached them, sorry if you feel it is too big to see them. The device address is AC:23:3f:56:1A:BF, dk833 is running central firmware and try to connect to it, I use dk52 to sniff the whole process of connect and disconnect. I hope it is not too much data for you to look at.

    I will try to change the connection interval and try again.

    Ping


    BFconnect&Disconnect.pcapng

Related