Re: Choosing Tx Buffers in BLE stack
toggle quoted messageShow quoted text
Thanks for the reply. Sorry if there is some confusion regarding the crash on windows.
I will explain more elaborately below what i am trying to achieve & what i debugged till now.
I am working on BLE based barcode scanner which will send the data via HID over GATT profile. I am using nRF52840
device and Zephyr 1.13 with default connection interval parameters. With the default Tx buffer numbers provided in zephyr
the characters are sent to peer devices very slowly. We can literally see that characters are printed one by one. When i checked
the HCI timestamps using btmon i see that 1 character is sent every connection interval time(around 45 ms ).
To remove the bottleneck on Tx buffers i increased Maximum number of pending TX buffers (3) , Number of Tx buffers(3).
I see that characters are sent instantly now (within one connection interval or even less than 10ms). The improvement in speed
is seen only when i change both of these parameters from the default values.
Now with this new config changes related to Tx buffers my application works fast as expected in Android, iOS, Linux systems.
But on windows 10 system after two or three scans 'Windows' HID driver crashes probably due to buffer overflow from sending the
data so fast. I checked the windows log and i see that "A command sent to the adapter has timed out. The adapter did not respond".
The behavior seen is that characters are not accepted anymore and the last character that is sent to windows is printed continuously
until the connection is closed. On the zephyr side, the bt_gatt_notify API is blocked until this time and then returns with error.
I also checked the connection interval used with Windows 10 system as 40 ms.
I also changed different buffer numbers to know the behavior but this just changes the time when this crash in windows occurs again.
I also checked with some commercial devices that have similar application of using HID profile to send data and it also uses buffering
to speed up. One thing i noticed in commercial device is for every 10 characters sent there is some delay equal to max connection
interval time. But in case of my application using zephyr there is just 1 delay with connection interval for even up to 40 characters that are
In order to control the speed of buffering i tried changing different buffer numbers but with no luck or information on how to proceed
further. If i know how to calculate or more information on these i can try to control the speed of my application by using buffer numbers or
delays like i saw in other commercial devices. It would be helpful even if i had to look for something else in BLE specification or Zephyr.
Thanks very much for the help.
Dhananjay G J
On Fri, Sep 21, 2018 at 1:20 PM Von Dentz, Luiz <luiz.von.dentz@...> wrote: