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!

/**@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);
}

Parents Reply Children
No Data
Related