cancel
Showing results for 
Search instead for 
Did you mean: 

ATT_MTU size

LVent
Associate II

HI,

Does someone can explain me how to modify the ATT MTU size please ?

Thanks.

5 REPLIES 5
Vyacheslav
Senior II

Hi, Leo.

Do not wait for a response from the STM employees, they do not answer questions about the WB55.

I have analyzed and found out:

There is only one place where you can set the MTU, it is in a calling function SHCI_C2_BLE_Init(&ble_init_cmd_packet);

where in structure SHCI_C2_Ble_Init_Cmd_Packet_t ble_init_cmd_packet

we set CFG_BLE_MAX_ATT_MTU (#define CFG_BLE_MAX_ATT_MTU (512)).

As it is not surprising, but STM no longer has any opportunity to change the MTU.

There is one function (aci_gatt_exchange_config) but, unfortunately, for some reason it does not allow to set a different value for MTU (this is a question for the STM, but it’s useless to ask questions, you can look in my profile how much I asked about this chip).

On the other hand, it is not recommended to call aci_gatt_exchange_config if we are peripherals, so I addressed this question like this:

I set MTU, for example, = 512.

The apple itself requests the MTU after the connection, so in the EVT_BLUE_ATT_EXCHANGE_MTU_RESP event, we catch the MTU of the apple and get what we are walking.

The Android itself does not send such a request, therefore, if in the android application you need to force the function gatt.requestMtu (***), in this case, receive the event EVT_BLUE_ATT_EXCHANGE_MTU_RESP.

According to my experience:

iPhone6s - MTU=185

Android - defult =23, but if you call gatt.requestMtu on android side, get what you want.

iPhone8 - MTU = 527.

Regards,

Vyacheslav.

Remi QUINTIN
ST Employee

It is possible to modify CFG_BLE_MAX_ATT_MTU in  the app_conf.h file.

This means that it can be done during the init phase using the SHCI_C2_Ble_Init_Cmd_Packet_t ble_init_cmd_packet structure.

it can also be  dynamically done after the connection is established with a GATT message: aci_gatt_exchange_config.

An ACI_ATT_EXCHANGE_MTU_RESP_EVENT event is generated from which the MAX_ATT_MTU value can be extracted.

Then this value can be used to set the new packet size.

Please have a look at the AN5289 application note "Building wireless applications with STM32WB Series microcontrollers" that is now available on the st.com web site.

There are some explanations on this topic: 7.6.5 How to maximize data throughput

Thanks.

It doesn't work when I change the MTU size in app_conf.h in both sides

I suppose that I need to modify CFG_BLE_PREPARE_WRITE_LIST_SIZE  too ?

I tried to modify CFG_BLE_PREPARE_WRITE_LIST_SIZE which is defined by default to 0x3A, why this value ?

When I’m doing my own calculous for the packet size with ATT_MTU =23 bytes I find 0x25.

So please, tell me how to change the MTU size correctly.

Regards,

Léo.

Remi QUINTIN
ST Employee

What is your wished value for ATT_MTU ?  Did you send the aci_gatt_exchange_config command?

LVent
Associate II

Between 23 and 512 bytes.