How to increase MTU size on GATT - Server

rwel59
Posts: 97
Joined: Thu Oct 12, 2017 3:32 pm

Re: How to increase MTU size on GATT - Server

Postby rwel59 » Thu Dec 21, 2017 9:18 pm

Has anyone had success using android client to get requestMTU to work? Works fine in nRF but I am getting a status of false on my android callback to the command.

The process seems pretty straightforward gatt.requestMTU(100). Tried issuing the requestMTU at various points in the connection process but getting the same response (always false) from the esp no matter where I make the request. Also, once I issue the request, the esp no longer triggers onWrite events no matter what the length of the value.

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to increase MTU size on GATT - Server

Postby chegewara » Thu Dec 28, 2017 12:52 am

I would like to join this discussion with enhancement request. It would be nice to have option to setup max allowed MTU in GATTS or at least to response on mtu request with own mtu value by exposing mtu response callback. According to bluetooth specs Vol 3 Part F 3.4.2.2
Exchange MTU Response
The Exchange MTU Response is sent in reply to a received Exchange MTU Request.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: How to increase MTU size on GATT - Server

Postby WiFive » Thu Dec 28, 2017 5:11 am

chegewara wrote:I would like to join this discussion with enhancement request. It would be nice to have option to setup max allowed MTU in GATTS or at least to response on mtu request with own mtu value by exposing mtu response callback. According to bluetooth specs Vol 3 Part F 3.4.2.2
Exchange MTU Response
The Exchange MTU Response is sent in reply to a received Exchange MTU Request.
Did you try esp_ble_gatt_set_local_mtu

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to increase MTU size on GATT - Server

Postby chegewara » Thu Dec 28, 2017 5:25 am

As for now only on client side, but thanks for tip. Will check it but im pretty sure you are right and it the solution.

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to increase MTU size on GATT - Server

Postby chegewara » Thu Dec 28, 2017 8:36 am

WiFive wrote: Did you try esp_ble_gatt_set_local_mtu
Sadly its not documented function yet, but it works like expected. Big thanks.

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: How to increase MTU size on GATT - Server

Postby mr1000 » Mon Aug 13, 2018 10:37 am

Hi, I'm using the esp_ble_gatt_set_local_mtu() function, but doesn't seem to work.
I've noticed with nRf Connect app that if I use the Request MTU utility, next writings work.
Is this normal or should GATTS use the value set with esp_ble_gatt_set_local_mtu ?
My ble initalistation code is the same as the GATTS example. I've modified the events handler, but that's it, nothing else...

Thanks in advance.

EDIT: just saw this post
viewtopic.php?t=6040

so the mtu server should be modified by the client at the beginning of the connection (eg. if we want more than 23 mtu bytes)?

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to increase MTU size on GATT - Server

Postby chegewara » Mon Aug 13, 2018 5:39 pm

mr1000 wrote: so the mtu server should be modified by the client at the beginning of the connection (eg. if we want more than 23 mtu bytes)?
Yes, you are right.

Angel111
Posts: 1
Joined: Wed Dec 19, 2018 1:32 pm

Re: How to increase MTU size on GATT - Server

Postby Angel111 » Wed Dec 19, 2018 1:46 pm

hey there
I'm working on the same Thing with androind app to send data > 20 byte .
could you help me please?
I didn't know where should I put gatt.requestMtu(500); and what should I do in the server side ESP32 do I need to add a response or a callback function ...?
thank you

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to increase MTU size on GATT - Server

Postby chegewara » Wed Dec 19, 2018 7:38 pm

Hi,
bt stack will take care of response for you.

What you need to do is to eventually store mtu value and reuse it in read/write requests
https://github.com/espressif/esp-idf/bl ... emo.c#L403

Of course you can try to send notify/indicate response with any length data, but it will be truncated by bt stack to mtu - 3 length.

HOUSSEM
Posts: 1
Joined: Mon Apr 01, 2019 10:58 am

Re: How to increase MTU size on GATT - Server

Postby HOUSSEM » Mon Apr 01, 2019 11:04 am

Hi

i am having the same problem but the gatt.requestMtu(500) on android but it works for me for the first time then i doesn't receive any data when i reboot the android application.
Is there any solution?

Thank you.

Who is online

Users browsing this forum: No registered users and 82 guests