MTU exchange issue – ble_app_uart_c / ble_app_uart with MTU 247

I am using the nRF5 SDK, nRF52833, and nRF52832.

I flashed the following two demos:

  • nRF5_SDK_17.1.0_ddde560\examples\ble_central\ble_app_uart_c\pca10100\s122 (nRF52833)

  • nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart\pca10040\s132 (nRF52832)

I changed BLE_GATT_ATT_MTU_DEFAULT to 247 in both projects.

However, the MTU exchange does not happen. In the following function:

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)
    {
        NRF_LOG_INFO("ATT MTU exchange completed.");
        m_ble_nus_max_data_len = p_evt->params.att_mtu_effective - OPCODE_LENGTH - HANDLE_LENGTH;
        NRF_LOG_INFO("Ble NUS max data length set to 0x%X(%d)", m_ble_nus_max_data_len, m_ble_nus_max_data_len);
    }
}

These two log messages do not appear.

In actual data transmission, I can only send 20 bytes. Sending 23 bytes causes an error.

Could you please help me understand why the MTU exchange is not taking place?

Thank you.

Related