BLE - variable length of String

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

cross mob
Anonymous
Not applicable

'String' (ASCII code in array) which i 'reading' have variable length but in custom profile i have to declare constant length of utf8s.

1. For example When i reading value ('0x44, 0x45, 0x46')  BLE sending '0x44, 0x45, 0x46, 0x00, 0x00, 0x00...' because in custom profile i declared length =50 I don't need this 0x00 there is any solution to send it without zeros?

2. When i start notify everything is ok... but when there is more than 20 bytes to send via notification it doesn't send anything.
How can i solve this problem?

3. Maybe there is any other possibility to send more than 20 bytes than notifications without reading? 

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

1) Please create a Tech Support case with Cypress

   

2 and 3) The default MTU Size is 23 Bytes (This includes the size of data to be sent). So when you send more amount of data, the size exceeds MTU Size. 
 

   

So (i) Please make sure that in your PSoC Creator-> BLE Component -> GAP Settings -> MTU Size is kept to a high value. (Say 40, 60 or 100). Max value is 256

   

(ii) Both Central and peripheral should support a higher MTU for transferring more amount of data.

   

(iii) In addition to setting the MTU Size in PSoC Component, when MTU Size is more than 23 bytes, the server and client should exchange their MTUs after connection is established. Please refer to  CyBle_GattcExchangeMtuReq and CyBle_GattsExchangeMtuRsp APIs in the BLE Component Datasheet.

   

Please refer the attached package which is a BLE_I2C Bridge implementation. It has both server and peripheral projects. In both these projects go to app_ble.c file and serach for the text "mtu" to see the code related to MTU exchange.

   

Regards,

   

-Madhu Sudhan

0 Likes