0
votes

Screen grab from WireShark showing traffic when problem occurs

Short question - Referring to WireShark image, What is causing Master to send LL_CHANNEL_MAP_IND and why is it taking so long?

We are working on a hardware/software project that is utilizing the TI WL18xx as a Bluetooth controller. One of the main functions of this product is to communicate with our sensor hardware over a Bluetooth Low Energy connection. We have encountered an issue that we have had difficulty pinpointing, but feel may reside in the TI WL18xx hardware/firmware. Intermittently, after a second Bluetooth Low Energy device is connected, the response times from writing and notification of one of the characteristics on one of the connected devices becomes very long.

Details

The host product device is running our own embedded Linux image on a TI AM4376x processor. The kernel is 4.14.79 and our communication stack sits on top of Bluez5. The wifi/bluetooth chip is the Jorjin WG7831-BO, running TIInit_11.8.32.bts firmware version 4.5. It is based on the TI WL1831. The sensor devices that we connect to are our own and we use a custom command protocol which uses two characteristics to perform command handshakes. These devices work very well on a number of other platforms, including Mac, Windows, Linux, Chrome, etc.

The workflow that is causing problems is this;

A user space application allows the user to discover and connect to our sensor devices over BLE, one device at a time. The initial connection requires a flurry of command/response type communication over the aforementioned BLE characteristics. Once connected, the traffic is reduced significantly to occasional notifications of new measurements, and occasional command/response exchanges triggered by the user. A single device always seems stable and performant. When the user connects to a second device, the initial connection proceeds as expected. However, once the second device's connection process completes, we start to see that the command/response response times become hundreds of times longer on the initially connected device. The second device communication continues at expected speeds. This problem only occurs with the first device about 30% of the time we follow this workflow.

Traces

Here is a short snippet of the problem that is formed from a trace log that is a mix of our library debug and btmon traces.

Everything seems fine until line 4102, at which we see the following:

ACL Data TX: Handle 1025 flags 0x00 dlen 22 #1081 [hci0] 00:12:48.654867 ATT: Write Command (0x52) len 17 Handle: 0x0014 Data: 580fd8c71bff00204e000000000000

D2PIO_SDK: GMBLNGIBlobSource.cpp(1532) : Blob cmd sent: 1bh to GDX-FOR 07100117; length = 15; rolling counter = 216; timestamp = 258104ms .

HCI Event: Number of Completed Packets (0x13) plen 5 #1082 [hci0] 00:12:49.387892 Num handles: 1 Handle: 1025 Count: 1

ACL Data RX: Handle 1025 flags 0x02 dlen 23 #1083 [hci0] 00:12:51.801225 ATT: Handle Value Notification (0x1b) len 18 Handle: 0x0016 Data: 9810272f1bd8ff00204e000000000000

D2PIO_SDK: GMBLNGIBlobSource.cpp(1745) : GetNextResponse(GDX-FOR 07100117) returns 1bh cmd blob after 3139=(261263-258124) milliseconds.

The elapsed time reported by GetNextResponse() for most cmds should be < 30 milliseconds. Response times were short when we opened and sent a bunch of cmds to device A. The response times remained short when we opened and sent a bunch of cmds to device B. But on the first subsequent cmd sent to device A, the response time is more than 3 seconds!

1

1 Answers

0
votes

Note that a Bluetooth radio can only do one thing at a time. Receive or transmit. On one single frequency. If you have two connections and two connection events happen at the same time, the firmware must decide which one to prioritize, and which one to skip. Maybe the firmware isn't smart enough to handle your specific case. Try with other connection parameters to see if something gets better. You can also try another Bluetooth dongle from a different manufacturer.