-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: BLE 5 data throughput to Linux host #31742
Comments
So one dongle runs a standalone Zephyr application and the other runs |
Yes, exactly. |
Could you please try setting: |
Also, in |
@carlescufi I applied your suggestions but unfortunately it didn't help. The test got stuck after 71 notifications:
Here's the peripheral console log:
I also pushed the changes to https://github.com/Oxymoron79/zephyr-ble-peripheral |
@joerchan the number of contexts are not configurable, so I think this is either a problem in the way the application uses the APIs or an actual bug. |
@Oxymoron79 a few fixes have been merged to master since you last reported here. Could you please try to reproduce the issue again and let us know? |
@carlescufi I tested it with the commit b6a4db3 on the master branch. Unfortunately I could reproduce the same issues. BUT: I started to measure the time delta between the notifications received and noticed that it sometimes easily exceeds 100 milliseconds. I wondered whether submitting the So I refactored the peripheral to enqueue a notification request into a FIFO in the timer and feed the With this implementation I couldn't reproduce the issues and was able to get the throughput up to about 640 kbit/second:
Also the error So I think that the issues I encountered were caused by my usage of the API - but the latest commits to master certainly also helped. I think this issue can be closed. Thank you for your support with this issue. |
@Oxymoron79 Thank you for the update. I'm gonna re-open this issue just so that we can agree on the facts and close it once we all agree that there is nothing that should be fixed here. The reason for the
@jhedberg @carlescufi Do we agree that this is the behavior, or is the number of TX contexts incorrect? @Oxymoron79 Can you elaborate on what you meant by "stuck", I think there is some confusion about whether you managed to get the Stack stuck, or if your application just didn't handle the returned error code from bt_gatt_notify? |
@Oxymoron79 Can you retest with the changes in #32009, see also bug report #31922, please? |
@carlescufi With "stuck" I meant that the receiver of the notifications (the application accessing the BlueZ API) no longer receives notifications. Here's how I will refer to the involved components:
The Peripheral App sets up a timer whose expiry function adds a work item to the system workqueue.
On the PC side, the Receiver application is receiving the notifications from the BlueZ userspace daemon. To check whether When the notification transfer is "stuck", this is what I observed:
What is interessting is that when the system is stuck and I send a read request to another characteristic of the
After the peripeheral has been disconnected
The system can only be recovered by restarting the Peripheral. I can't deduce with certainty which component gets "stuck" in this setup:
Sorry for this long post, but I wanted to explain my findings in detail. I hope it helps. |
@jfischer-no I built the Peripheral and the Dongle using your pr-fix-hci_usb branch. Unfortunately this issue still occurs. Here are the logs: Peripheral:
Receiver application:
|
@Oxymoron79 could you please move the call to |
@carlescufi You mean to use a separate workqueue to call I put that version in the notification_workqueue branch of my repository. |
Right, so this probably requires a fix in the documentation. @joerchan will send a PR.
Can we close this GitHub issue now? |
Assuming that the "stuck" was because the error code returned ( |
Describe the bug
I'm trying to maximize the data throughput of a Bluetooth LE 5 Peripheral to a Bluetooth Dongle connected to a
Linux host running BlueZ using two Nordic nRF52840 Dongles.
The firmware of the Bluetooth LE 5 Peripheral and the Dongle are built with zephyr.
The data is transferred using GATT notifications using the Bluetooth LE 5 Data Length Extension and the 2MBit PHY.
I found 2 issues when I increase the GATT notifications rate to about 250 notifications per second (or higher):
Bluetooth: Deadlock with TX of ACL data and HCI commands (command blocked by data) #25917
has to be restarted and the device has to be removed from the bluez cache.
I am new to using the Zephyr RTOS, so these issues may be caused by some wrong kernel configuration parameters. I tried
different settings but was not successful to resolve the issues.
To Reproduce
To reproduce the behavior I have uploaded the zephyr projects for the peripheral and the central devices to my
GitHub repository with a python script to test the data throughput.
The README describes the build steps and the usage of the test script.
Run the
throughput_test.py
with these parameters for a notification rate of about 250 notifications per second anda notification payload size of 240 bytes:
./throughput_test.py -i 4 -l 240 -n 1000
Expected behavior
The test script should finish without exceptions.
Logs and console output
Peripheral console logs some occurrences of
bt_gatt_notify
returning a errorand the kernel logs a
Unable to allocate TX context
error when the issue occurs:I also captured the HCI traffic with
btmon
for the 2 issues and attached the files:throughput_stuck_i4_l240_n250.log
when the notification transmission was stuck.throughput_disconnect_i4_l240_n200.log
when the disconnect failed.Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: