ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned unexpected value 0x13.

I am trying to understand why my program is returning this error (NRF_ERROR_RESOURCES). I read through a lot of other posts in the devzone and tried replicating them, but they don't seem to be doing the right thing


00> <info> ble_gatt: Requesting to update data length to 201 on connection 0x0.
00> <error> ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned unexpected value 0x13.

I printed out the limitations struct for debugging:
00> <error> ble_gatt: limitation tx_payload_limited_octets: 174
00> <error> ble_gatt: limitation rx_payload_limited_octets: 174
00> <error> ble_gatt: limitation tx_rx_time_limited_us: 0

The update data length is 201 - why is it so high? What can I do to decrease this value?

I read on the forums that NRF_SDH_BLE_GAP_EVENT_LENGTH governs the tx/rx payload size. I increased it from 3 to 6:

// <o> NRF_SDH_BLE_GAP_EVENT_LENGTH - The time set aside for this connection on every connection interval in 1.25 ms units.
...but the error persists and the tx/rx lpayload_limited_octets remained the same. I tried values 5, 200, 201, 250, 260... no change at all.
I wondered if I was including the wrong sdk_config.h file, but I confirmed I was using the correct one by putting an #error statement in the sdk_config.h file.
I'm using SDK 4.2.0, and softdevice 5.0.0
How can I increase the limit and/or decrease the data length?
No Data
  • As an update, I increased the MTU size, and it stopped crashing.

    // <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size.
    But, I'm not sure this is what I want. I don't think I'm sending much data, yet I doubled my time set aside for this connection, and I increased the MTU by a lot, requiring a lot more space to be used. Why is my data length so long?