cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth SDK

anhnhancao
New Contributor

Dear all,

I have a CYW920721B2 Evaluation Board and want to run the Audio_Headset_and_Speaker Example on ModusToolbox IDE,

The point is that i want to extend the MTU size of BLE connection to 247 (Default is 23 byte). I've read some answers on Cypress forum and they recommend to edit "gatt_cfg.max_mtu_size" and also call wiced_bt_gatt_configure_mtu() API when the BLE connection is established to reconfig the MTU size.

I changed gatt_cfg.max_mtu_size to 247 and call wiced_bt_gatt_configure_mtu(p_status->conn_id, 247) inside hci_control_le_connection_up() but it always return 0x80 (WICED_BT_GATT_NO_RESOURCES).

I really appreciate if any one could help me to config the MTU size correctly.

 
0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator

Hello @anhnhancao ,

Sorry I am late. Not sure if you already fixed this. Let me explain the usage 

- On your Peripheral , you can set the MTU size by modifying config file as you already know. For example, 

.gatt_cfg = /* GATT configuration */
{
.appearance = APPEARANCE_GENERIC_TAG, /**< GATT appearance (see gatt_appearance_e) */
.client_max_links = 2, /**< Client config: maximum number of servers that local client can connect to */
.server_max_links = 1, /**< Server config: maximum number of remote clients connections allowed by the local */
.max_attr_len = 244, 
.max_mtu_size = 247 
},

 

- By default a BLE connection will use MTU size of 23. If you have to use a higher value their either of the two devices should send MTU exchange request. Then the negotiated MTU value (smallest among both) will be used for further communication. 

- In your application if Central device is capable of sending a mtu exchange request, then that is good enough.  You need not have to call  wiced_bt_gatt_configure_mtu API again in Cypress Peripheral BT device. 

In the other case , if you want to initiate this from cypress BT side, then use the API wiced_bt_gatt_configure_mtu. Inorder to use this API , in config file you should have entered a non zero value for .client_max_links under .gatt_cfg 

Please try this method and let us know if you face any issues.

Regards,

Anjana

View solution in original post

0 Likes
3 Replies
AnjanaM_61
Moderator
Moderator

Hi @anhnhancao 

Can you please clarify your application? 

Are you using BLE also in your project or only BT Classic (Audio) profiles ? 

Where exactly you are calling wiced_bt_gatt_configure_mtu in your application code ? 

wiced_bt_gatt_configure_mtu API can be used if the device is in Client role. For example, refer our LE_Throughput_Measurement.GATT_client example available in Modus Tool Box IDE. 

 

Regards,

Anjana

0 Likes
anhnhancao
New Contributor

Hi Anjana,

1. Can you please clarify your application? 

Our application is a wearable device, it's combination between:

- An audio headset based on bluetooth classic (A2DP and HFP).

- A BLE device for sensors data streaming purpose.

Then i want to run this application with PERIPHERAL role as a dual mode bluetooth device and connect to a phone. For now, it seems to run well in dual mode.

2. Are you using BLE also in your project or only BT Classic (Audio) profiles ? 

My application code is based on the Audio_Headset_and_Speaker project. Then yes, i use both BLE and BT classic, just modified a little bit with BLE services and characteristics related to Upgrade FW thru OTA, i changed it to some customize services and characteristics corresponding to our application.

3. Where exactly you are calling wiced_bt_gatt_configure_mtu in your application code ? 

I call it in the hci_control_le_connection_up() function when the connection is established.

4. Can i ask a question, you said wiced_bt_gatt_configure_mtu API can be used if the device is in Client role?

How can i config this as a peripheral.

0 Likes
AnjanaM_61
Moderator
Moderator

Hello @anhnhancao ,

Sorry I am late. Not sure if you already fixed this. Let me explain the usage 

- On your Peripheral , you can set the MTU size by modifying config file as you already know. For example, 

.gatt_cfg = /* GATT configuration */
{
.appearance = APPEARANCE_GENERIC_TAG, /**< GATT appearance (see gatt_appearance_e) */
.client_max_links = 2, /**< Client config: maximum number of servers that local client can connect to */
.server_max_links = 1, /**< Server config: maximum number of remote clients connections allowed by the local */
.max_attr_len = 244, 
.max_mtu_size = 247 
},

 

- By default a BLE connection will use MTU size of 23. If you have to use a higher value their either of the two devices should send MTU exchange request. Then the negotiated MTU value (smallest among both) will be used for further communication. 

- In your application if Central device is capable of sending a mtu exchange request, then that is good enough.  You need not have to call  wiced_bt_gatt_configure_mtu API again in Cypress Peripheral BT device. 

In the other case , if you want to initiate this from cypress BT side, then use the API wiced_bt_gatt_configure_mtu. Inorder to use this API , in config file you should have entered a non zero value for .client_max_links under .gatt_cfg 

Please try this method and let us know if you face any issues.

Regards,

Anjana

View solution in original post

0 Likes