nRF52833 increasing att mtu data length

hello,

I Have two nRF52833 that I have communicating over BLE. I am using soft device S140. I have my data packets use the default data length maximum of 20 bytes. I am trying to configure it such that data packets have more then 20 bytes. 

I call sd_ble_gap_data_length_update to set data length to 230 bytes. I do the following:

ble_gap_data_length_params_t const dlp =
    {
        .max_rx_octets  = 230,
        .max_tx_octets  = 230,
        .max_rx_time_us = BLE_GAP_DATA_LENGTH_AUTO,
        .max_tx_time_us = BLE_GAP_DATA_LENGTH_AUTO,
    };

    ble_gap_data_length_limitation_t dll = {0};

    ret_code_t err_code = sd_ble_gap_data_length_update(conn_handle, &dlp, &dll);
both peripheral and central print the following, as part of on_data_length_update_evt. I assume this means that the att mtu is now set to 230 bytes on each side.
<debug> nrf_ble_gatt: Data length updated to 230 on connection 0x3.
<debug> nrf_ble_gatt: max_rx_octets: 230
<debug> nrf_ble_gatt: max_tx_octets: 230
<debug> nrf_ble_gatt: max_rx_time: 2120
<debug> nrf_ble_gatt: max_tx_time: 2120 



latter I call sd_ble_gatts_value_set to fill the data packet with my data. 

gattsValue.len = 40;
gattsValue.offset = 0;
gattsValue.p_value ="character array of 40 bytes...";


errCode = sd_ble_gatts_value_set(BLE_CONN_HANDLE_INVALIDntAttHandle, &gattsValue);


when I do this I get the error [NRF_ERROR_DATA_SIZE].



I am doing something wrong and I am not sure what. have I configured something incorrectly? 


thanks


Parents Reply
  • thanks for the response.
    this is my settup:
    NRF_SDH_BLE_GAP_DATA_LENGTH = 244
    NRF_SDH_BLE_GATT_MAX_MTU_SIZE = 244
    NRF_SDH_BLE_GAP_EVENT_LENGTH = 400

    I get the message in the debug terminal:
    <debug> nrf_ble_gatt: ATT MTU updated to 244 bytes on connection 0x3 (response).

    then when I call sd_ble_gatts_value_set passing a .len of 40 I still get the following error:
    <error> app: ERROR 12 [NRF_ERROR_DATA_SIZE] at C:\Users\...

Children
Related