How to change the MTU of a nRF52 Bluefruit LE in Arduino


To change the Maximum Transmission Unit (MTU), use the Bluefruit's library configPrphBandwidth or configCentralBandwidth function along with a Bandwidth Enum.
A nRF52 Bluefruit LE's MTU is set to 20 bytes by default, but can be expanded to a maximum of 247 bytes by calling the configPrphBandwidth and configCentralBandwidth function with a Bandwidth enum before calling the Bluefruit.begin() function.
The available bandwidth enums are:
- BANDWIDTH_AUTO
- BANDWIDTH_LOW
- BANDWIDTH_NORMAL
- BANDWIDTH_HIGH
- BANDWIDTH_MAX
Consult the link below to see the these enums affect the Bluefruit's MTU.
Examples
To configure the nRF52 Bluefruit LE to act as a peripheral with a maximum of 247 bytes, call the function below before Bluefruit.begin().
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
To configure the nRF52 Bluefruit LE to act as a central manager with a maximum of 128 bytes, call the function below before Bluefruit.begin().
Bluefruit.configCentralBandwidth(BANDWIDTH_HIGH);