Peripheral -> Central Streaming Packet Loss

I am using NUS to stream sensor data from a nRF5340 peripheral to a nRF5340 central device. I have an index that I'm able to use to track if any packets are missed, and at higher sensor bandwidths I'm intermittently missing a packet. This is generally to be expected (reaching a throughput limit), but I'm trying to determine where the packet is getting lost/dropped. In sniffing the traffic, I can clearly see an Empty PDU packet where the missing index packet should be.

Within the peripheral device, I am able to confirm that the packet of the (eventually) missing index is present and correct at the time bt_nus_send() is called. I am checking for returned errors, and none come back.

What could account for these missing packets if the data makes it into bt_nus_send() with no errors returned?

Thanks in advance

  • Hi,

    I will bring your questions up with the BLE team, but in the meanwhile could you state which version of the SDK you're working with? Are you using the Softdevice controller or the Zephyr BLE controller? 

    I assume you've based your application on the central-/peripheral_uart samples and added your sensor, but in case you have not done this already, could you verify if you see the same thing with the pristine samples+sensor functionality?

    Kind regards,
    Andreas

  • Hi Andreas,

    We are using SDK version 2.0.0, and we are using the SoftDevice controller. That's correct that the code is based on those samples.

    Sorry, can you elaborate on what functionality I should verify with regards to the "pristine samples+sensor"? If relevant, I have verified that the samples that eventually "go missing" do make it to the point of the bt_nus_send() call.

    Thanks for your help

  • Hi,

    brushlow said:
    Sorry, can you elaborate on what functionality I should verify with regards to the "pristine samples+sensor"? If relevant, I have verified that the samples that eventually "go missing" do make it to the point of the bt_nus_send() call.

    Yeah, no worries, I see that the question could be a bit ambiguous. To be clear, what I meant was in the case you were running this on a 100% custom application that you've created yourself was if you were able to recreate the error on a sample that we provide in the SDK. And if it was already the case that the latter of these two were what you were doing, then you don't have to run that test.

    But disregard that for now. Based on what you describe it seems like it is nothing wrong with the BLE part of your application, but rather the UART part of it. Could you explain what you mean by "higher sensor bandwidths"? Could you check which baud rates the sensor supports? My guess is that the higher baud rates you refer to might not be compatible with what the sensor supports

    Kind regards,
    Andreas

  • We manipulate the sample rate of the sensor itself, and at higher sample rates (in this case 1kHz) I see more dropped samples; around 3-5 per minute. At 500Hz, I see significantly less (but still some) dropped samples, around 1 per minute.

    Just to be clear, we're able to get good data out of the sensor at 1kHz (and 2kHz, for that matter). I have code checking for gaps in sample indexes instrumented throughout my Peripheral and Central, and these gaps are only detected on the Central side. On the Peripheral side, there are no missing samples up to the point of the bt_nus_send() call, so I'm quite sure it's not an issue with the sensor producing data.

    As for the data itself, we are sending 6 bytes per sample with some added messaging overhead. I would estimate the throughput need at around 55kbps.

    Thanks

  • Noted! 

    Thanks for the follow up. I'm just about to head out the door for the weekend so this is just a heads up that I will most likely not be able to give a comment to your reply before early next week. I will get back to you by then

    Kind regards,
    Andreas

Related