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

LMP Responese Timeout - nRF52840 S140v6.1.0 SDK 15.2.0

Hello everybody,

I'm using nRF5280 (Laird BL654) with SoftDeveice S140v6.1.0 and SDK 15.2.0 with a modified version of the blinky peripheral example.

I've changed NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 138 and NRF_SDH_BLE_GAP_DATA_LENGTH to 142

After connecting to this chip with a Samsung Galaxy S7 with Android 8.0.0 the chip disconnects with reason 0x22 (LMP Response Timeout).

I've attached the debug log from SES.


Galaxy S7 Android 8.0.0  MTU 138 Bytes

<debug> nrf_sdh_ble: RAM starts at 0x20002768
<info> app: Blinky example started.
<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> nrf_ble_gatt: Requesting to update ATT MTU to 138 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 142 on connection 0x0.
<info> app: Connected
<debug> nrf_sdh_ble: BLE event: 0x3A.
<debug> nrf_ble_gatt: ATT MTU updated to 138 bytes on connection 0x0 (response).
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x11.
<info> app: Disconnected reason: 0x22

This problem occures only with this specific phone and if the MTU is larger than 23.

For example this is the debug log of a connection with a Galaxy S9 with Android 9.0.0 and an MTU of 138.

alaxy S9 Android 9.0.0 MTU 138 Bytes

<debug> nrf_sdh_ble: RAM starts at 0x20002768
<info> app: Blinky example started.
<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> nrf_ble_gatt: Requesting to update ATT MTU to 138 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 142 on connection 0x0.
<info> app: Connected
<debug> nrf_sdh_ble: BLE event: 0x3A.
<debug> nrf_ble_gatt: ATT MTU updated to 138 bytes on connection 0x0 (response).
<debug> nrf_sdh_ble: BLE event: 0x24.
<debug> nrf_ble_gatt: Data length updated to 142 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 142
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 2120
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x23.
<debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 27 bytes.
<debug> nrf_ble_gatt: Updating data length to 27 on connection 0x0.
<debug> nrf_sdh_ble: BLE event: 0x24.
<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: 328
<debug> nrf_ble_gatt: max_tx_time: 2120
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x12.

Parents
  • Hi,

    I have talked to one of our Android developers and it seems like that there shouldn't be different MTU size for different phones. Android supports MTU from 23 up to 517. What other changes have you done to the example? What is your connection interval?

  • Hi,

    In nrf_ble_gatt.c, inside data_length_update(..), could you add these two lines:

    err_code = sd_ble_gap_data_length_update(conn_handle, &dll, &dll);
    return err_code;

    Like this:

    static ret_code_t data_length_update(uint16_t conn_handle, uint16_t data_length)
    {
        NRF_LOG_DEBUG("Updating data length to %u on connection 0x%x.",
                      data_length, conn_handle);
    
        ble_gap_data_length_params_t const dlp =
        {
            .max_rx_octets  = data_length,
            .max_tx_octets  = data_length,
            .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);
        if (err_code != NRF_SUCCESS)
        {
            NRF_LOG_ERROR("sd_ble_gap_data_length_update() (request) on connection 0x%x returned %s.",
                          conn_handle, nrf_strerror_get(err_code));
    
            if (   (dll.tx_payload_limited_octets != 0)
                || (dll.rx_payload_limited_octets != 0))
            {
                NRF_LOG_ERROR("The requested TX/RX packet length is too long by %u/%u octets.",
                              dll.tx_payload_limited_octets, dll.rx_payload_limited_octets);
    +                         err_code = sd_ble_gap_data_length_update(conn_handle, &dll, &dll);
    +                         return err_code;
            }
    
            if (dll.tx_rx_time_limited_us != 0)
            {
                NRF_LOG_ERROR("The requested combination of TX and RX packet lengths "
                              "is too long by %u microseconds.",
                              dll.tx_rx_time_limited_us);
            }
        }
    
        return err_code;
    }

    See if this helps you solve the problem?

  • Hi,

    I have added these two lines but it didn't help me.

    The Problem is still the same.

    The error code after  sd_ble_gap_data_length_update(conn_handle, &dlp, &dll)  is NRF_SUCCESS so the added lines of code won't get executed

    However I have found out that there are no problems with SD132v6.1.0.

    I have tried the app_blinky example for pca10040 on the pca10056 with the same modifications i have mentioned above. (changed NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 138 and NRF_SDH_BLE_GAP_DATA_LENGTH to 142)

    With this example the S7 didn't disconnect with LMP Response Timeout.

    P.S.

    I think there is a typo in the two lines I should add.

    I think they schould be like this:

    err_code = sd_ble_gap_data_length_update(conn_handle, &dlp, &dll);
    return err_code;

Reply
  • Hi,

    I have added these two lines but it didn't help me.

    The Problem is still the same.

    The error code after  sd_ble_gap_data_length_update(conn_handle, &dlp, &dll)  is NRF_SUCCESS so the added lines of code won't get executed

    However I have found out that there are no problems with SD132v6.1.0.

    I have tried the app_blinky example for pca10040 on the pca10056 with the same modifications i have mentioned above. (changed NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 138 and NRF_SDH_BLE_GAP_DATA_LENGTH to 142)

    With this example the S7 didn't disconnect with LMP Response Timeout.

    P.S.

    I think there is a typo in the two lines I should add.

    I think they schould be like this:

    err_code = sd_ble_gap_data_length_update(conn_handle, &dlp, &dll);
    return err_code;

Children
No Data
Related