This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Maximum bytes sent in a characteristic indicate function

Hi, I need to send data larger than 16 bytes on a characteristic.  I see that the maximum number of bytes I can send using the indicate function is limited to 16 bytes.

static uint8_t sm[16];

ind_params.attr = &vnd_svc.attrs[2];
		ind_params.func = indicate_cb;
		ind_params.data = &sm;
		ind_params.len = sizeof(sm);

		if (bt_gatt_indicate(NULL, &ind_params) == 0) {
			indicating = 2U;
		}

Ideally, I need sm[] to be between 32 bytes and 64 bytes.  Is there a way to increase this size or do I have to send multiple 16-byte packets?  I am developing using Zephyr.  Your help is highly appreciated.

Parents
  • Hi,

    As defined in Bluetooth spec, you can't do "long" notification/indication. So indication/notification can only sent as one single BLE packet. The ATT_MTU would decide the max size of a notification/indication you can send. For example if you set CONFIG_BT_L2CAP_TX_MTU = 23 bytes, you can send maximum CONFIG_BT_L2CAP_TX_MTU - 3 = 20 bytes payload (3 bytes overhead including opcode & handle value). 

    What you mentioned about 16 bytes maximum sounds a little bit strange, most likely it should be 20 bytes if the CONFIG_BT_L2CAP_TX_MTU is minimum at 23 bytes. 

    If you want to send larger indication/notification you would need to increase the CONFIG_BT_L2CAP_TX_MTU size. But please note that the actual ATT_MTU used in a connection depends on both sides. So if your peer device doesn't support large ATT_MTU you will receive "No ATT channel for MTU" warning when you send larger than limit indication as you already observed. 

    You can use bt_gatt_get_mtu() to get the actual mtu of a connection. 

  • Hi .  Thank you for your reply.  I will be dealing with large amounts of sample outputs from sensors.  If notifications/indications are not meant for large amounts of data, how would I go about sending large amounts of data?

    I did double-check and the maximum amount of bytes that I can send over a notification is indeed 20 bytes.  I will try and increase the MTU size.  

Reply Children
No Data
Related