Unable to update ATT MTU

Hi everyone,

I'm trying to update the ATT MTU with nRF52833 that connects to an IOS app.

For Hardware/software setup, the following is what I'm using:

  • Our toolchain is ARM GCC
  • Ubuntu 
  • SDK 17.0.2
  • SD 140

I've taken a look at samples BLE_APP_ATT_MTU_THROUGPUT and BLE_APP_UART where the ATT MTU can be updated. The following code is what I implemented to request ATT MTU. However, I wasn't able to update the ATT MTU. I checked the MTU side on IOS app (Xcode software), it showed the MTU is still 23 bytes only when the app connected to nRF52833. Please advise if I need to do anything to change it. Thanks!

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**@brief Function for handling events from the GATT library. */
static void gatt_evt_handler(nrf_ble_gatt_t * p_gatt, nrf_ble_gatt_evt_t const * p_evt)
{
if (p_evt->evt_id == NRF_BLE_GATT_EVT_ATT_MTU_UPDATED)
{
m_ble_nus_max_data_len = p_evt->params.att_mtu_effective - OPCODE_LENGTH - HANDLE_LENGTH;
NRF_LOG_INFO("Data len is set to 0x%X(%d)", m_ble_nus_max_data_len, m_ble_nus_max_data_len);
}
NRF_LOG_DEBUG("ATT MTU exchange completed. central 0x%x peripheral 0x%x",
p_gatt->att_mtu_desired_central,
p_gatt->att_mtu_desired_periph);
}
static void gatt_init(void) {
ret_code_t err_code = nrf_ble_gatt_init(&m_gatt, gatt_evt_handler);
APP_ERROR_CHECK(err_code);
err_code = nrf_ble_gatt_att_mtu_periph_set(&m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE);
APP_ERROR_CHECK(err_code);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi, 

    Hope this post can help. 

    Regards,
    Amanda H.

  • Thanks for the reply, Amanda!

    Yeah, I've read that post and implemented some based on what Jimmy suggested. However, I still received only 23 bytes at MTU read by IOS app. Using nRF Connect, I was able to see DLE updated, so I believe the DLE request happened at IOS app, but somehow I can't know if IOS sent a request to nRF chip for MTU request.

  • You can check by the nRF Sniffer if you have an nRF device. 

    -Amanda H.

  • I used Sniffer to check. The following is what I got:

    • Regarding DLE exchange, I was able to receive the DLE length with a proper request-response from Server & Client.

    • Regarding ATT MTU exchange, as you can see in the first image, Master sent a request to Slave with the MTU length of 527. I don't understand why 527 here. Please advise if you have any clues.
    • Then, Slave sent a request with new MTU length (247 bytes in this case); however, no response from Master. Please advise if you have any suggestions! Thanks!
    • I've attached the sniffer file for the reference.packet sniffer_V3.pcapng

  • Hi, 

    Tai said:
    Regarding ATT MTU exchange, as you can see in the first image, Master sent a request to Slave with the MTU length of 527. I don't understand why 527 here. Please advise if you have any clues.

    Seems iOS 15: MTU was negotiated as 527. See this post. You should check with Apple. 

    Tai said:
    Then, Slave sent a request with new MTU length (247 bytes in this case); however, no response from Master. Please advise if you have any suggestions! Thanks!

    The Slave sends a response to the Master's request instead of sending a request. 

    -Amanda H.

1 2 3