support icon indicating copy to clipboard operation
support copied to clipboard

[Feature] Improve throughput for sdtout and appdata out

Open laurensvalk opened this issue 1 year ago • 0 comments

This isn't a pressing issue, but I'm collecting some notes that came up in https://github.com/pybricks/pybricks-micropython/pull/246 where this won't be addressed.

Both stdout and outgoing appdata are limited to 20 byte chunks. There is this longstanding note in pbsys/bluetooth:

// REVISIT: this can be the negotiated MTU - 3 to allow for better throughput
#define MAX_CHAR_SIZE 20

Increasing this to the negotiated MTU may improve throughput if we think this is necessary. So far the throughput isn't so bad though.

Assuming that the central has a MTU >= the hub is probably a fairly safe assumption, but it is entirely possible that the central could be something like a Move Hub with max MTU of 23 bytes.

So ideally, the AppData Python object would be aware of the negotiated MTU and use that to calculate the max size rather than using the hub's hard-coded max value.

As for the CC2640 chips, it could very well be that the 20 byte max payload for notifications is hard-coded in the Bluetooth chip firmware. But I do see a GATT_UpdateMTU() function, so maybe we need to call this after the MTU exchange to tell the Bluetooth chip resize it's notification buffer?

Originally posted by @dlech in https://github.com/pybricks/pybricks-micropython/pull/246#issuecomment-2253594424

laurensvalk avatar Jul 27 '24 09:07 laurensvalk