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

Check if a certain packet has been transmitted

Hello Nordic! In my FW, I need to know when a specific packet has been actually sent (because of SD packet buffering). I am able to receive the BLE_EVT_TX_COMPLETE event, but that provides no information regarding the contents of the packet that was sent. The packet are being sent using notifications.

To achieve this, I was I'm using an thinking about checking the SD buffer status just before requesting the transmission of the packet of interest (say there were x packet on the buffer). Then, I would count down how many TX_COMPLETE were received since the transmission was requested (x--), and when x==0 the packet had been sent. My question is how do I access the status of the SD TX buffer.

Is there a better method to know when a packet has been sent? Indications could be a possibility, but I would like to avoid them if possible.

I'm using a nRF51822 along with SDK6.1 and s110 v7.3.0.

  • I really doubt that your approach is feasible since SD's management of the buffers is completely transparent to the application. And even if it provides you some API through which you can check the SD's internal buffer count status, how would you guarantee that your application request is serviced with hard real time constraints.

  • All you need to do is keep track of the TX_COMPLETE messages coming in, each one of those represents the completion of the send, in order, of the packets you sent out. So if you have 4 packets in-flight, the first TX_COMPLETE represents the first of those having been sent. So just keep whatever information you want about your packets in an array or ring buffer or something, as you send a new one add it to the list, as a TX_COMPLETE comes in, remove the first one and process it.

    Or if the use case is as simple as you state above, and you just want to know for a certain packet occasionally when it's been transmitted, just keep a tally of packets in-flight incrementing each time you send one and decrementing each time you get TX_COMPLETE, that number is the current status of packets in-flight, no need to query the softdevice (and you can't anyway).

Related