one Thread use sd_ble_gatts_hvx() send many package

how to save a problem,if one Thread use sd_ble_gatts_hvx() send many package ,but i use vTaskDelay(50)( the freertos delay api ) when one package send ,then send another package . but
some packgae lost data .At the same time other Thread use sd_ble_gatts_hvx() send package ,if someone package lost data ,how i seek the problem and save the problem...

  • Each bluetooth connection will have dedicated buffers. So even when you use sd_ble_gatts_hvx to send packets from different treads, the packets will be placed in the same buffer. The packets in the buffer will be (re)transmitted until it is acknoledged on the Link Layer (NESN, SN is updated) or until the connection is disconnected. Note that you have to check the error code returned by sd_ble_gatts_hvx to make sure the packet was successfully placed in the tx buffer. If it is not, you might end up losing data.