Hello, everyone!
My goal is to achieve throughput of 65 kBytes per second with nRF52832. I chose nrf52-ble-image-transfer-demo as a starting point.
My tools are:
- nRF52-DK board with nRF52832
- nRF5 SDK v16.0.0
- S132 v7 Softdevice
- nRF Connect and nRF Logger apps for Android
- Xiaomi Redmi Note 4X smartphone
I've commented out everything in main infinite loop except for idle_state_handle(). Once a second app calls ble_its_send_file(...). It takes pointer to a data buffer, buffer length (about 4k elements) and maximum packet length (252 byte) as an arguments. ble_its_send_file(...) calls push_data_packets() which in a loop calls ble_its_string_send(...) while it returns NRF_SUCCESS. ble_its_string_send(...) calls sd_ble_gatts_hvx(...) once, and sd_ble_gatts_hvx return code becomes ble_its_string_send return code. When BLE_GATTS_EVT_HVN_TX_COMPLETE event appears push_data_packets() function is called again if there is still some data to transmit.
With this approach I can transmit 4032 bytes (16 packets of 252 bytes) in about half a second. I'm using nRF Logger to determine when my phone recieved first and last of 16 packets. So, for now it seems that the throughput is about 8 kBytes/s. Which is not enough...
My questions are:
1. Am I using functions from ble_image_transfer_service module in a correct way?
2. Do I understand and calculate throughput correctly?
3. I saw that to increase throughput it is recommended to increase ATT MTU and payload PDU. How it supposed to be done?
(In gatt_init() I found nrf_ble_gatt_att_mtu_periph_set(...) and nrf_ble_gatt_data_length_set(...) which sets ATT MTU to 255 and data length to 251. So it looks like this point is complete(?))
4. What else could be done to increase throughput?
Thank you!