I am creating an app to connect my bangle.js 2 to an energy measuring device.
The connection is done via BLE.
The problem I am facing comes with reading 'large' data.
The maximum size I get from readValue() is 130 Bytes.
Reading the same with e.g. the NRF Connect app I get all 438 Bytes.
Data <130 Bytes works fine.
Thus I am asking myself if there is any limitation on the bangle.js side.
In general I am aware of the BLE protocol but I am missing something here.
Normally the preferred MTU size of the energy measuring device is set to 517.
When I change it to 23 Bytes, the bangle.js 2 only reads 22 bytes.
If any additional information is needed, I'll provide it ASAP.
Thanks for helping.
This is a limit to to save memory, it can be tuned here
and beware that it also needs tuning next line with matching LD_APP_RAM_BASE otherwise it won't start and just reboot in a loop.
Note that it may also break other stuff inside Espruino and may need further tuning, even with 130 there were some overflow issues as it was 'too fast'.
OTOH even 130 is pretty high and you will have this limit anyway so maybe better solution is to handle lower MTU too.
Also you may do a search for this topic, it is not so simple as higher MTU == better/faster, it also has some shortcomings. Larger packets may be more susceptible to noise => more errors/retries when 2.4GHz radio band is crowded. Also larger packets may not fit well into connection interval (typically there can be more smaller packets sent in same connection interval) so larger MTU may not increase speed and can even make things slower.
EDIT: good article is https://interrupt.memfault.com/blog/ble-throughput-primer it gets more interesting near the end
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem