How to increase characteristic data length?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have created a custom service with a notify characteristic that sends an uint8 array with a size of 20.

   

How do I increase the size to 60? When I increase to anything over 20 it stops working.

   

I tied increasing the MTU without success.

   

Regards, Paul.

0 Likes
4 Replies
Anonymous
Not applicable

Just to clarify, I can increase the length for characteristic to 60 without any issues.

   

However, when I change the notification len in my code to a higher value it stops working.

   

            NotificationHandle.attrHandle = REALTIME_CHAR_HANDLE;                
            NotificationHandle.value.val = BLETemp; //is unsigned char BLETemp[60];
            NotificationHandle.value.len = 56;
            
            /* Send notifications. */
            CyBle_GattsNotification(cyBle_connHandle, &NotificationHandle);

0 Likes
Anonymous
Not applicable

Can you confirm if you have given the length as 60 in the characteristic of the service in the BLE component?  Also, please set the MTU size as 63.

0 Likes
Anonymous
Not applicable

Yes, I set the length of the characteristic to 60 and the MTU to 63 or higher.

   

It turns out that is not sufficient.

   

You must also add this to the BLE event handler

   

        case CYBLE_EVT_GAP_DEVICE_CONNECTED:

   

            /* Initiate an MTU exchange request */
            CyBle_GattcExchangeMtuReq(cyBle_connHandle, CYBLE_GATT_MTU);
            break;

   

This will actually increase the MTU to the configured amount.

   

I hope this will help somebody.

   

Paul.

0 Likes
Anonymous
Not applicable

Thanks Paul - this was the port I was looking for to solve my problem. !

0 Likes