This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timeout in changing MTU

Chip: nrf52832

SDK: 15

SD: s132_nrf52_6.0.0_softdevice

After connection, we request a new MTU size. Some values work, other don't.

For example, trying to get 187 bytes we have a timeout issue calling sd_ble_gap_data_length_update()

nrf_ble_gatt:DEBUG:Peer on connection 0x0 requested an ATT MTU of 148 bytes.
00> nrf_ble_gatt:DEBUG:Updating ATT MTU to 148 bytes (desired: 251) on connection 0x0.
00> BGATES:DEBUG:ATT MTU exchange completed. MTU set to 148 bytes.
00> nrf_ble_gatt:DEBUG:Peer on connection 0x0 requested a data length of 152 bytes.
00> nrf_ble_gatt:DEBUG:Updating data length to 152 bytes on connection 0x0.
00> nrf_ble_gatt:ERROR:sd_ble_gap_data_length_update() (reply) returned unexpected value 0x13.
00> nrf_ble_gatt:ERROR:second sd_ble_gap_data_length_update() (reply) returned unexpected value 0x13.

After around 40 seconds, the device disconnets.

Experimentally, we found that 147 is the biggest MTU value that can be used, without the disconnection to appear:

00> nrf_ble_gatt:DEBUG:Peer on connection 0x0 requested an ATT MTU of 147 bytes.
00> nrf_ble_gatt:DEBUG:Updating ATT MTU to 147 bytes (desired: 251) on connection 0x0.
00> BGATES:DEBUG:ATT MTU exchange completed. MTU set to 147 bytes.
00> nrf_ble_gatt:DEBUG:Peer on connection 0x0 requested a data length of 151 bytes.
00> nrf_ble_gatt:DEBUG:Updating data length to 151 bytes on connection 0x0.
00> nrf_ble_gatt:DEBUG:Data length updated to 151 on connection 0x0.

We thought that the issue could be related to GAP timeout parameters setting, but we couldn't find any value make the MTU change working. In any case, these are our settings:

#define MIN_CONNECTION_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS)
#define MAX_CONNECTION_INTERVAL MSEC_TO_UNITS(40, UNIT_1_25_MS)
#define SLAVE_LATENCY 0
#define SUPERVISION_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS)

#define CONNECTABLE_ADV_INTERVAL MSEC_TO_UNITS(20, UNIT_0_625_MS)
#define NON_CONNECTABLE_ADV_INTERVAL MSEC_TO_UNITS(20, UNIT_0_625_MS)

Thanks

Parents
  • Hi Andrea,

    Thanks for the message log, it would be more insightful if you can provide the sniffer trace to be able to see how this transaction timeout

    Also note that the error you get is NRF_ERROR_RESOURCES and the documentation for sd_ble_gap_data_length_update says

     * @retval ::NRF_ERROR_RESOURCES The connection event length configured for this link is not sufficient for the requested parameters.
     *                               Use @ref sd_ble_cfg_set with @ref BLE_CONN_CFG_GAP to increase the connection event length.
     *                               Inspect p_dl_limitation to see where the limitation is.
Reply
  • Hi Andrea,

    Thanks for the message log, it would be more insightful if you can provide the sniffer trace to be able to see how this transaction timeout

    Also note that the error you get is NRF_ERROR_RESOURCES and the documentation for sd_ble_gap_data_length_update says

     * @retval ::NRF_ERROR_RESOURCES The connection event length configured for this link is not sufficient for the requested parameters.
     *                               Use @ref sd_ble_cfg_set with @ref BLE_CONN_CFG_GAP to increase the connection event length.
     *                               Inspect p_dl_limitation to see where the limitation is.
Children
No Data
Related