Closed marcelrv closed 3 months ago
Normally it's expected that the client requests the MTU exchange. There is no server method for this implemented at this time but it should be possible to use the lower level calls to do this.
Thanks.. will see if I can get it to work. thx
Hello Did you find a way to increase it ? Thanks in advance
For anyone else that finds this, the BLE specification states the MTU exchange is to be performed by the client:
The default MTU for all BLE devices is 23, 20 usable bytes. The client and server both need to have their own MTU size set higher in order to increase this. After the MTU exchange the MTU will be the smaller of the 2 values that the client and server possess.
The MTU is the max attribute (think characteristic value) size and is used for things like notifications. The data length sets how much of that data can be sent in a single transmission during a connection interval, setting this to a higher value than the MTU will result in greater throughput, if it's smaller, then the data will be chunked and sent slower.
I'm trying to send a larger characteristic than the default 20 bytes. I'm trying to understand how I can request a MTU change from the server side.
See below NimBLE_Server example modified to (how I understood) request the larger MTU
added near the NimBLEDevice::init
NimBLEDevice::setMTU(48);
added in the onConnectpServer->setDataLen(desc->conn_handle, 48);
and changed the payload to be longerNeither seemed to work. If I change the MTU from the client side it works very well.
note: I saw in the
NimBLEServer::setDataLen(uint16_t conn_handle, uint16_t tx_octets)
that I needed at least ESP_IDF_VERSION 432. I indeed updated it and now I have ESP_IDF_VERSION 441server: ESP32 client: Android (nRF Connect App)
Any suggestion?
modfied example: