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

Different behaviour: nRF52832, nRF52810 with MTU size settings

I am working with an nRF52810 and nRF52832 (SDK15.3.0), with an Android app based on Android BLE Library 2.1.1. In both cases sdk_config.h has

#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23

The two boards give diferent results. On the nRF52832 i get this debug output immediately after connecting:

<debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 100 bytes.
<debug> nrf_ble_gatt: Updating data length to 27 on connection 0x0
<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 912
<debug> nrf_ble_gatt: max_tx_time: 1096

I also get BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST and BLE_GAP_EVT_DATA_LENGTH_UPDATE events.

On the nRF52810 none of this happens (BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST and BLE_GAP_EVT_DATA_LENGTH_UPDATE are not supported).

AFAIK, my Android app does not make any explicit request to change the MTU size.

Q1: Why do the 832 and 810 behave differently? Is there documentation on thier different MTU behaviour?

Q1: Why is there a "Peer on connection 0x0 requested a data length of 100 bytes." event reported? I am assuming there is a default  requestMtu(100) call inside the Android BLE library which is handled by the 832 but ignored by the 810 - is that right? Can this be turned off?

Q2:

  • Hi, 

    What is the value of NRF_SDH_BLE_GAP_DATA_LENGTH?

    <debug> nrf_ble_gatt: Updating data length to 27 on connection 0x0
    <debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.

    I also get BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST and BLE_GAP_EVT_DATA_LENGTH_UPDATE events.

    Because the NRF_SDH_BLE_GATT_MAX_MTU_SIZE is 23, you should set NRF_SDH_BLE_GAP_DATA_LENGTH to 27 in the sdk_config.h. (The ATT MTU will typically be 4 bytes less than LL payload.) Otherwise, it will have BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST and BLE_GAP_EVT_DATA_LENGTH_UPDATE events to do that.


    Q1: Why do the 832 and 810 behave differently? Is there documentation on thier different MTU behaviour?

    I think the NRF_SDH_BLE_GAP_DATA_LENGTH and NRF_SDH_BLE_GATT_MAX_MTU_SIZE in sdk_config.h may be different in these two projects. You could check it. 

    -Amanda H.

  • Hi Amanda

    For both the 832 and 810 boards I use the usual values which are in most of your examples:

    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23

    #define NRF_SDH_BLE_GAP_DATA_LENGTH 27

    Only with the 832 do I get the data length exchange - this is to be expected, since the code in nrf_ble_gatt.c that generates the log messages is not compiled for S112 (nrf52810). So if I can rephrase (and renumber) my questions:

    Q1: Why is some functionality relating to data length and MTU size excluded from the 810, and are these differences documented somewhere?

    Q2: What initiates the data length exchange, and why? Can this be suppressed? AFAIK there is no code that explicitly does this either in my devices or in my Android app. (The message "Peer on connection 0x0 requested a data length of 100 bytes" implies the Android BLE library has requested a data length of 100 bytes...)

    Q3: There seems to be many questions on data length/MTU length - is there a definitive tutorial on the topic?

  • Hi, 

    Acutetech said:
    Q1: Why is some functionality relating to data length and MTU size excluded from the 810, and are these differences documented somewhere?

    As you see there is #if !defined (S112) && !defined(S312) in the nrf_ble_gatt.c because S112/S312 does not support DLE. i.e. LE Data Packet Length Extension is not listed for S112 SoftDevice Specification. If you want S112 with DLE, you can use the S113 instead. 

    Acutetech said:
    Q2: What initiates the data length exchange, and why? Can this be suppressed?

     Please see the Data Length Update Procedure

    Acutetech said:
    Q3: There seems to be many questions on data length/MTU length - is there a definitive tutorial on the topic?

     See GATTS ATT_MTU ExchangeGATTC ATT_MTU Exchange, and ATT_MTU Throughput Example

    -Amanda H.

Related