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

Parents
  • 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

  • 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

  • Hi,

    my central is a PC with a CSR8510 A10 USB BLE dongle. I have written a test program using node.js and the noble BLE library.

    I set the desired MTU in the SDK config file ( NRF_SDH_BLE_GATT_MAX_MTU_SIZE).

    What is not clear for me: From which side the server_rx_mtu value comes from? Is it the peripherial device or the central device?

  • So did you try the unmodified ble_app_uart example? The reason that I keep asking for this is that if you test this, then you can figure out whether it is your nRF application or PC application that hasn't set the correct MTU.

    If your nRF is the peripheral, then the m_rx_mtu is the PC. 

    How does your project use NRF_SDH_BLE_GATT_MAX_MTU_SIZE? It is a define, but it doesn't matter if your application doesn't use this define anywhere in the application.

    What does your gatt_init() look like? Do you use the NRF_SDH_BLE_GATT_MAX_MTU_SIZE there?

    BR,

    Edvin

  • You are right. I tried to connect using the nRF connect app on an Android phone and now the MTU is extended. So it seems to be a problem with my test environment. Thank you for the support.

    I will close the ticket.

Reply Children
No Data
Related