How to increase MTU size on GATT - Server

Shariq Hussain
Posts: 4
Joined: Thu Nov 11, 2021 5:15 am

Re: How to increase MTU size on GATT - Server

Postby Shariq Hussain » Tue Jan 04, 2022 7:35 am

Hi Chegewara & WiFive,
Now what we implement in server’s firmware, you can see that in the attached “main.c” line 28-29 & line 351-356. Actually this main.c is of basic example “onoff_server”.
 Are we correct?
 As GATT_MAX_MTU_SIZE is 517 bytes. In server’s main.c we included header file of “esp_gattc_api”, “esp_gatt_common_api” & implement function esp_ble_gatt_set_local_mtu(500) in app_main(). So, by doing this MTU size set to 500. Why App response shows it 69?

Best Regards,
Shariq Hussain

aircable
Posts: 4
Joined: Wed Dec 28, 2016 12:34 am

Re: How to increase MTU size on GATT - Server

Postby aircable » Wed Jul 06, 2022 10:33 pm

I'm running into a weird problem where in the GATT server, after a connection is established the MTU request has been somehow canceled.

I get this:

Code: Select all

I (12243) GATTS: ESP_GATTS_CONNECT_EVT, conn_id 0, remote 63:61:78:a6:49:b4
Then:

Code: Select all

I (12481) GATTS: ESP_GATTS_MTU_EVT, MTU 80 for conn_id 1
So far so good.
The MTU event shows that the client requests 80 bytes.
But then after several shorter reads this happens:

Code: Select all

I (15937) GATTS: ESP_GATTS_READ_EVT, handle 66, len 24
I (15938) GATTS: 01 01 01 01 01 01 01 76 36 2e 31 36 30 2e 32 2e 
I (15940) GATTS: 31 00 00 00 00 00 00 02 
I (15944) GATTS: sending response to server, len 24
I (15950) BT_GATT: GATTS_SendRsp: conn_id: 4  trans_id: 10  Status: 0x0000
W (15958) BT_GATT: attribute value too long, to be truncated to 22
This is weird, since the MTU has successfully configured.
Anyone has an idea how to debug this? I looked through the bluedroid stack and put some debug in there and the variable "payload" used inside the stack is indeed only 23 bytes long.
Before when configured, it is set to 80 bytes long.
It's like it somehow got reset again to default. But where and how? No callback received after the first MTU_EVT.

Is there something else that would limit the transmit to the server to the default MTU?
Something in the database maybe? Even though MAX is set to 517.

Thanks for any ideas.

Who is online

Users browsing this forum: Bing [Bot] and 199 guests