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

Extend the MTU with SDK 15.2

Hi!

Is there an example to extend the Bluetooth MTU size to more than 20 bytes together with SDK 15.2?

I found only examples with older versions.

Thank you in advance.

Best regards

Oliver

  • Hello Oliver,

    There are examples in SDK15.2.0 that uses MTU larger than 20 Bytes, such as the ble_app_uart or ble_app_uart_c examples. Check out these examples to see how it is done.

    Best regards,

    Edvin

  • Hi!

    When the MTU GAT request/response is sent, the MTU is set to 23 because the server rx mtu is 23. Where can I change this?

    Here is the log:

     0> <debug> nrf_ble_gatt: Peer on connection 0x0 requested an ATT MTU of 256 bytes.
     0> <debug> nrf_ble_gatt: Updating ATT MTU to 43 bytes (desired: 43) on connection 0x0.
     0> <debug> nrf_ble_gatt: server rx mtu 23, desired 43
     0> <debug> nrf_ble_gatt: ATT MTU updated to 23 bytes on connection 0x0 (response).
     0> BLE data len is set to 0x14 (20)
     0> ATT MTU exchange completed. central 43 peripheral 43

  • Hello,

    Is this the log from the peripheral or the central? And either way, what is the other device (central/peripheral)? Is it the other example, ble_app_uart or ble_app_uart_c, or is it a phone? If it is a phone, and the phone is old, or another device that doesn't support MTU larger than 23, you can't increase the MTU further.

    Best regards,

    Edvin

  • My application is a peripherial. The log comes from the module mrf_ble_gatt.c.

    I have extended the logging in the function on_exchange_mtu_rsp_evt() with one line of code:

    NRF_LOG_DEBUG("server rx mtu %i, desired %i", server_rx_mtu, p_link->att_mtu_desired);

    in line 211.

    The peer seems to send a request of MTU=256. My test setting is 43 but the result is 23 because of server rx mtu in nrf_ble_gatt.c, function on_exchange_mtu_rsp_evt()

    p_link->att_mtu_effective = MIN(server_rx_mtu, p_link->att_mtu_desired);

  • Hello,

    oalt said:
    The peer seems to send a request of MTU=256.

    By "peer" you mean central, right?

    And still, what is your central device? A mobile phone or another nRF? Or something else?

    What example do you test with? Did you test the ble_app_uart example? Did you get a higher MTU than 23 there? 

    Can you describe where you set the setting to 43?

    In the ble_app_uart example it is set in main.c -> gatt_init() -> nrf_ble_gatt_att_mtu_periph_set(&m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE); where NRF_SDH_BLE_GATT_MAX_MTU_SIZE = 247

    When I do the same logging as you, I get:

    So the p_link->att_mtu_desired is the peripherals desired MTU, and the server_rx_mtu is the central (iPhone in my case).

    Also know that data_len, which is the payload length = MTU - OPCODE_LENGTH - HANDLE_LENGTH, OPCODE_LENGTH = 1 and HANDLE_LENGTH = 2.

    So it looks like it is your central that doesn't accept MTU over 23.

    BR,

    Edvin

Related