How to increase MTU size b/w qn9080 and Android

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to increase MTU size b/w qn9080 and Android

Jump to solution
5,815 Views
mohamedaslam_m
Contributor II

Hello,

   I am connecting qn9080 with Android using Web Bluetooth, and I am not able to send more than 20 Byte at a single packet. while if I connect using a Desktop browser I can send more than 20 Bytes.

I searched regarding this MTU exchange and I found "GattClient_ExchangeMtu()" API is there which will initiate MTU exchange. I called this GattClient_ExchangeMtu() from BleApp_ConnectionCallback() , But the  GattClient_ExchangeMtu() is returning an error.

Can anybody help me on this to change the MTU size?

Labels (1)
Tags (2)
1 Solution
4,890 Views
xing_chang
NXP Employee
NXP Employee

Hi @Aslan,

ExchangeMtu is best initiated by the Master (mobile phone or PC). If it must be initiated by the slave(QN9080), you can use the GattClient_ExchangeMtu() function, but the library needs to be modified.

lib_ble_5-0_host_peripheral_cm4.a -> lib_ble_5-0_host_cm4.a

pastedImage_1.png

View solution in original post

8 Replies
4,888 Views
mohamedaslam_m
Contributor II

Hi Xing,

     Thanks for your replay, it works. Now I am able to send packet more than 20 bytes.

Thankyou  Estephania for your quick support.

Regards

Aslam

0 Kudos
4,888 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

If you are able to send and receive more than 20 bytes form the computer , it is most likely that the limitation it's in the android device, you will need to extend the MTU in the mobile phone code in case you are doing your own application

Regards,

Estephania

0 Kudos
4,888 Views
mohamedaslam_m
Contributor II

Hello,

     We are not sending data through an android mobile application, we are relying on web Bluetooth using a browser.

our observations are :

1) qn9080 to the mobile browser using web Bluetooth we could send and receive only 20 bytes.

2) Android Mobile application to the mobile browser using web Bluetooth we could send and receive more than 20 bytes. That means the mobile browser is able to receive more than 20 bytes when we requested MTU change (Gatt.requestMtu(512)) from the mobile application.

From the above observation, I think from qn9080 we can initiate to increase the MTU size to receive more than 20 Bytes.

How to initiate the MTU size is more than 20 bytes in qn9080?

0 Kudos
4,888 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Please check the file ble_constants.h

/*! Default value of the ATT_MTU */
#define gAttDefaultMtu_c                (23) 

/*! Maximum possible value of the ATT_MTU for this device. This is used during the MTU Exchange. */
#define gAttMaxMtu_c                    (247)

Regards,

Estephania

0 Kudos
4,888 Views
mohamedaslam_m
Contributor II

Hello,

     The gAttDefaultMtu_c  and  gAttMaxMtu_c values are same as you mentioned on the previous post.

 

I used GattClient_ExchangeMtu() to initiate the mtu request but it's returning an error number 4 which states's The requested feature is not supported by this stack version.

Do I in the right direction ?

Regards

Aslam

0 Kudos
4,888 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Just to confirm, are you sure that you have your characteristic with the maximum size available?

Regards,

Estephania

0 Kudos
4,888 Views
mohamedaslam_m
Contributor II

Hello,

   The characteristic size is set as 256.

CHARACTERISTIC(char_url_get, gBleSig_CustomeUrl_d, (gGattCharPropRead_c | gGattCharPropNotify_c | gGattCharPropIndicate_c))
VALUE_VARLEN(value_url_get, gBleSig_CustomeUrl_d, (gPermissionFlagReadable_c), 256, 2, 0x00, 0xB4)

Regards

Aslam

0 Kudos
4,891 Views
xing_chang
NXP Employee
NXP Employee

Hi @Aslan,

ExchangeMtu is best initiated by the Master (mobile phone or PC). If it must be initiated by the slave(QN9080), you can use the GattClient_ExchangeMtu() function, but the library needs to be modified.

lib_ble_5-0_host_peripheral_cm4.a -> lib_ble_5-0_host_cm4.a

pastedImage_1.png