This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sending data bigger than 20 byte with ble

Hi Im working on the project which relates to sending data through ble. I use nrf51822 Evaluation kit and the data is from uart. How do I send data greater than 20 bytes. No matter how i change the parameters from which relate to that 20, it is still limited at 20 bytes. Let say i want to transfer a 2kb file through ble. So how do i fix my code? main.c ble_nus.c app_uart_fifo_mod.c

Thank you very much

  • May I ask you to directly link to the example in the answer, please?

  • My answer was based on the SDK that was available then, and might not be that relevant anymore. The DFU examples still have good examples for recombining data and writing it to flash. To fragment the data, you simply send 20 byte chunks until you are out of buffers, increasing the pointer of the first byte by 20 every time the send is successful. Then you wait for a TX_COMPLETE event and re-do the operation. The packet count in that event is an ACK that the peer has received that many packets. On the peer side you need to either store the data in a temporary buffer, or immediately write it to UART or flash. It will come in the order it is sent, so this is a fairly simple operation.

    Since this question is already answered and accepted, your question might not get the attention it deserves. Feel free to raise a new question if this didn't solve your problem.

Related