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

BLE Connection Sequence

I have modified the Multisim example code slightly, and I am using it to make some demo code for myself. I installed the Nordic Bluetooth sniffer, and everything seems to be working OK (I can connected, disconnect, read and write data). I'm new to Bletooth LE, and I have a question about the connection sequence in Wireshark.

I noticed that several lines after the CONNECT_REQ, the Master sends a "GATT Characteristic Declaration, Handles: 0x0009..0xffff" , and the Slave responds with "Attribute List Length: 1". The Master then sends a second GATT Characteristic Declaration this time with handles starting at 0x000c. The Slave responds with "Attribute Not Found, Handle: 0x000c".

Later the Master sends "Write Request, Handle: 0x000e". The Slave responds "Error Response - Insufficient Authentication, Handle: 0x000e".

I have attached the Wireshark capture with all the empty packets filtered, as I didn't think those were important.

Can anyone tell me what these two errors mean?

Bluetooth errors.pcapng

  • I did not look at the log, but I can tell you this from the general flow of BLE traffic.

    When you do a characteristic discovery, you ask for all the characteristics in a certain range. This range should be from the the service start handle +1 to the handle of the next service, but in some cases the end handle is 0xFFFF because there are no following services. You might also just be interested in every characteristic regardless of the services, and it makes sense to just put 0xFFFF then as well.

    Since the response has limited space, you will not always get all the characteristics back in a single query. So you take the characteristics you just discovered, pick the last one, and send a new request, starting right after it - but with the same end handle. You repeat this until you get the error "Attribute handle not found", which means there are nothing left to discover in that range you specified, and you are done! This is completely normal.

    The insuficcient authentication error means that the attribute value is protected by security, e.g. by using the macro BLE_GAP_CONN_MODE_SET_ENC_NO_MITM(). When you receive such an error, you should initiate security, pair or bond, then retry the request. This is done automatically by iOS and Android usually.

Related