How to extend customer service length


Based on ble-peripheral_server example, I wish to develop my own application.
The goal is to send 255 bytes long notification.
So I tried below code.

**#define CS_VALUE_MAX_LENGTH          40**

But received ble message from client side is till 20 bytes long.
I don’t have any idea what did I missed.
Could you let me know how to fix it?


We do have community forum thread where Data Length Extension has been discussed.

Not achieving maximmum bitrate (2Mbps)

Sample firmware : peripheral_server_UART.

Using the ‘ peripheral_server_UART ’ sample code as an example of how to configure DLE and 2Mbps is a good place to start, as it performs all of the necessary commands.

  • In this example there is also a note:
  • LE Data Packet Length Extension (Bluetooth 4.2): Use of this feature allows this application to request an increase in the maximum transfer unit (MTU) allowed. This feature supports a maximum increase in the underlying data packet size from 27 bytes to 251 bytes, and this application supports a maximum packet size of 250 bytes per packet.

Thank you for using our community forum!


I am success to set 2M bps by re-defining APP_PHY_UPDATE_REQ, APP_PREFERRED_PHY_RX, APP_PREFERRED_PHY_TX.
But I think that there is no example “peripheral_server_UART” for RSL15.
Also I looks like API maybe different for RSL10 and RSL15.
Could you let me know which API/Function should I use to extend data length?

Thanks for your support:)

The issue may be on the client side with the client remembering the configuration from a prior connection. If you connect to a new client after changing the length from 20 to 40, do you get the full 40 bytes?

I have only two RSL15 EVK. One is used for server. The other one is used for client.
So I changed APP_BLE_PRIVATE_ADDR of server and APP_BD_ADDRESS_PEER1 of client.
Data length is still 20 bytes.

Did you change the definitions for CS_RX_VALUE_MAX_LENGTH and CS_TX_VALUE_MAX_LENGTH on the client to match the CS_VALUE_MAX_LENGTH on the server?

Yes, All parameters are set to 40.


Have you got the full 40 bytes if you connected a new client?

How are you testing? I am able to do the following:

Start with the initial project with CS_VALUE_MAX_LENGTH = 20. Using a smartphone download the “BLE Scanner” app from Bluepixel Technologies (other apps may work as well, this is just what I’ve used)

With the application running on the RSL15, use the BLE Scanner to connect to “ble_periph_server”, choose the one of the two Custom Services that you see. Read the Characteristic User Descriptions until you find “TX_VALUE”, then Read the value of that custom characteristic. You should see 0x0000000000000000000000000000000000000000 (20 bytes). You can write that characteristic with the text 0123456789abcdefghij, then the value will read back as 0x303132333435363738396162636465666768696a in hex.

Now go to the project and change CS_VALUE_MAX_LENGTH to 40 and recompile and relaunch the application on the RSL15.

Use the BLE Scanner to connect to the ble_periph_server again, and again find the TX_VALUE characteristic. Read this characteristic value and you should see 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000 (40 bytes). You can write that characteristic with the text 0123456789abcdefghijklmnopqrstuvwxyzABCD, then the value will read back as 0x303132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a41424344 in hex (40 bytes).

This shows that you can change the length of a custom service value and have a client receive and process it just by changing the #define value.

If that isn’t working for you, please provide more information on how to reproduce the issue you are seeing.

1 Like

Actually we’ve reproduced the issue. The correct value can be read on demand, but it seems if notifications are used the notification is being truncated to 20 bytes. We’re looking into this.

1 Like


May I know if there is any update?

We’re still trying to confirm this will be fixed in the next release.

1 Like

After further investigation we have found that the notifications are going out over the air correctly. The client side application we were using for testing was truncating the received notifications just as the RSL15 client seems to be doing. We’re still looking into that.

The solution is to set the ATT MTU larger than the minimum of 23 bytes. Do this by adding the following lines to the end of APP_SendConCfm)( if you’re using the ble_peripheral_server example:

struct gattc_exc_mtu_cmd *cmd = KE_MSG_ALLOC(GATTC_EXC_MTU_CMD,
                                             conidx), TASK_APP,
cmd->operation = GATTC_MTU_EXCH;
cmd->seq_num = 0;

/* Send the message */
1 Like

Hello, It works. Thanks for your support.

1 Like