-
Notifications
You must be signed in to change notification settings - Fork 41
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
low baudrate output #89
Comments
Try to set your custom 247 byte MTU with the argument:
In my testing it did about 21 kbit/s (2000 B/s) with a adapter that did not support higher MTUs, so about 100 packets/s. Similar performance for sending and receiving, probably the BLE device was bottlenecking. I don't think buffering is the issue, it will write constantly if there is data. Noticed you have the latest
|
with using the PC is a ryzen 3600 so i doubt is a issue of cpu bottleneck either I am very surprised about this asynchronous data rate |
In case you haven't already seen: the latest version (3.0.0) does not require a bleak downgrade anymore and there is a parameter for writing with response. Also I analyzed the performance further. Looking directly at the interface from BlueZ:
Found out that ble-serial + bleak actually finishes fast. 1 MB is transferred in less than 4 secs and the heavy dbus traffic stops, means 250 000 bytes/s = 2M baud!
Minus overhead also around 4000 bytes/s payload.
This is interesting too, because I technically set 64 byte MTU. Receiving as client is faster:
The other side is here ble-serial server (peripheral role). Closing this as not planned, since the bottleneck is definitely not this library. |
Describe the bug
When writing to the BLE serial i can only read ~200 byes/s, while when reading i can easily get over 50.000B/s (and my BT firmware seems to be the bottleneck
Log messages
I use a python script with pyserial, ser1.write(data) where data is 512 bytes (MTU exchanges is 247 and from my smartphone i can exceed 110.000 B/s).
I can see a virtual output speed of 72MB/s for write, but seems like this data is parked in a buffer that then get flushed WAY slower:
Noticing the potential huge amount of data getting buffred may be the issue, i put delay between write, to force the bitrate to remain around 921600 (my target), and it did not work
I find interesting the library is sending way less data than it should per packet that it should (~20 instead of 247, that sound like the standard MTU)
and way less packet/s than it should (10Hz instead of 500Hz)
Setup (please complete the following information):
Additional Context
full test code:
edit:
on reception, the library seems to work ok. I can generate 120.000/150.000 bytes/s (confirmed on android smartphone with blueftuit) and i can receive 80.000 on PC with this library (antenna on the pc is not optimal placed) both using TCP and SERIAL mode.
Also tested the TCP mode foroutput, and i got the 200bytes/s max too.
The text was updated successfully, but these errors were encountered: