How to Set Up Symmetric Data Length in NRF5 SDK

How to Set Up Symmetric Data Length in NRF5 SDK

I’ve been working on setting up symmetric RX/TX data length in the NRF5 SDK and wanted to share my experience and findings. During my development, I noticed that the SDK only supports symmetric RX/TX data length settings. This is clearly indicated in the nrf_ble_gatt.c file where it states that the SoftDevice only supports symmetric settings.

I came across the on_data_length_update_request_evt function, which takes the minimum value of the requested and desired data length. This means that if one device requests an asymmetric data length, the NRF5 SDK will only respond with a symmetric value. I tested this using Wireshark and confirmed that the SDK indeed only replies with symmetric values.

However, I also discovered that it’s possible to manually set unsymmetric parameters using sd_ble_gap_data_length_update. I tested this by setting max_rx_octets and max_tx_octets to different values and it worked as expected. I even verified the results in Wireshark to ensure everything was functioning correctly.

But now I’m wondering—does manually setting unsymmetric parameters have any unintended consequences? Does the Bluetooth stack handle these settings properly, or could there be compatibility issues with other devices? I’d appreciate any insights or best practices for handling data length settings in the NRF5 SDK.

If anyone has experience with asymmetric data length settings or knows of any potential pitfalls, I’d love to hear your thoughts!