Maximum data length transfer

Learn MoreFAQsTutorials

2 posts / 0 new
Last post
MathieuB
Offline
Last seen:1 month 1 day ago
Joined:2020-03-03 14:11
Maximum data length transfer

Dear all,

For a project, I am using a DA14531 chip to transmit data from a sensor to a smartphone.

The sensor provides 16 bits every 2 ms (500 Hz) via SPI.

To transmit the data via BLE, I am using this piece of code:

char testVal[2]; uint8_t string_len = 2; //testVal updated in another function void user_update() { struct custs1_val_ntf_ind_req* req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, string_len); req->conidx = 0; req->notification = true; req->handle = SVC1_IDX_EEG_VAL_VAL; req->length = string_len; memcpy(req->value, testVal, string_len); ke_msg_send(req); app_easy_timer(PERIOD, user_update); }

My question is:

I have tried to change "string_len" to 50. However, my smartphone apps (nRF connect) only display 20 bytes. Is there a maximum amout of data that can be sent in "one shot"?

Thank you in advance

Device:
PM_Dialog
Offline
Last seen:15 hours 54 min ago
Staff
Joined:2018-02-08 11:03
Hi MathieuB,

Hi MathieuB,

Thanks for your question online and for your interest in our DA14531 BLE solution. Apologies for the delay too.

Let’s take the 6.0.14.1114\projects\target_apps\ble_examples

ble_app_peripheral example of the SDK as reference.

Please check app_adcval1_timer_cb_handler() callback which is the function that is sending BLE notifications to a peer device.

The DEF_SVC1_ADC_VAL_1_CHAR_LEN is the length of the characteristic to be notified – of course the length should be according to your requirements. So please set it accordingly into the database (user_custs1_def.h) and use it in user_update().

The amount of data that a device sends during a connection interval depends on the packets that the central allows the peripheral to send. The payload for each packet with the standard MTU selection is 20 bytes. So each data that you send can carry up to 20 bytes. You can't control the how many packets the BLE will send during a connection interval because is up to the master of the connection. If you would like to send more than 20 bytes of data you will have to increase your MTU size. Specifically, the number of bytes that a device can send over the air is limited by the MTU (Maximum Transfer Unit), the MTU by default is limited in 23 bytes including the ATT layer overhead, so the payload is 20 bytes. By increasing the MTU size that means that you can send more bytes over the air. In your case the maximum transfer unit should be the number of bytes you would like to send + 3 extra bytes. So, you should change the .max_mtu of the user_gapm_conf structure in the user_config.h header file.

There is a similar SW Example on our support portal. This is the download link -DA14585-DA14531 Dynamic DLE and L2CAP Packet size Optimization

- This example examples aims to demonstrate:

- How to do a peer feature request for determining peer DLE capability

- How to request DLE and utilize larger packets to enhance throughput

- Basic principles of L2CAP 100% packet utilization

- Packet optimization for non DLE devices

Refer to the Readme file for getting more information which is under da14585-da14531-dynamic_dle_l2cap_packet_size_optimization\project_environment path.

This example as all our SW examples, does not contain the SDK, so you should link it with SDK6.0.14 before running it. You will find instruction onSoftware Example Setup Using Python Link Scriptdocument.

However, this example includes an old python script for a previous SDK version - I will ask the Team internally to change it. Please follow the steps below to replace it with the updated one:

  1. Download theDA14585/DA14586 - DA14531 Multiperipheral Example
  2. Copy the DA14531- DA14585-586_Multiperipheral_Example\project_environment\dlg_make_keil5_env_v2.000.py and past it into DA14585-DA14531-Dynamic_DLE_L2CAP_Packet_size_Optimization\project_environment
  3. The execute the new python script :

> python dlg_make_keil5_env_v2.000.py -sdkpath “

For instance:

> python dlg_make_keil5_env_v2.000.py -sdkpath “C:\dev\6.0.14”

PS:从DA14580改变设备的选择DA14531 in your initial post.

Thanks, PM_Dialog