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

Central device (Raspberry Pi/nRF dongle) missing many BLE notifications from nRF52840 DK/Feather. Can this be improved?

Hi! I'm having some trouble with missed BLE notifications. We are using a custom BLE service and characteristic on the nRF52840 Development Kits and Feathers with notifications to send sensor data. For a central device we're using a Raspberry Pi 3B+ as well as a Nordic nRF52840 Dongle programmed with the Zephyr RTOS hci_usb example. Using either of these, we are unable to receive all the notifications we're sending. Currently, we are attempting to send averaged sensor data every 10 ms from each peripheral, which should produce 100 log entries per second on our central device. What we're actually seeing is more like 50-65 entries per second using only one device. The sensors are an accelerometer and gyroscope being polled at 1 kHz, and we've confirmed on the peripheral side that we're getting the expected number of measurements. Is there some way to avoid this data loss, or is there a theoretical limit to how fast notifications are sent that we're missing? Thanks in advance for any help you can offer.

Parents Reply Children
  • For the notifications that are received, all the data (12 bytes) is received. We had previously been using a window of 100 to 200 ms, which was set in the Nordic example project that I based this on, and the results were the same.

    I tried using nRF Sniffer to analyze the connection, as you suggested, and I'm a little puzzled by the results, or maybe I'm not understanding them correctly. I tried running the code with only one peripheral, with the time between notifications set to 10 ms, 100 ms, and then 5 s, and what it seemed to show was that the notifications were sent about every 15-18 ms with the first two and more like 150 ms with the 5 s setting. I don't know if I'm missing something in the readings, but these are listed as "Handle Value Notification[s]" for the correct handle, with the correct length.

    Separately, I wrote a couple of scripts to calculate the average number of values we logged per second and the average interval between receiving them on the central side, and this is what I found:

    | Timer setting | Devices       | Avg. notifications/s | Avg. interval between notifications |
    |---------------|---------------|----------------------|-------------------------------------|
    | 10 ms         | 1 peripheral  | 64                   | 15.38 ms                            |
    | 10 ms         | 2 peripherals | 96                   | 10.38 ms                            |
    | 10 ms         | 3 peripherals | 96                   | 10.29 ms                            |
    | 20 ms         | 1 peripheral  | 50                   | 19.99 ms                            |
    | 20 ms         | 2 peripherals | 93                   | 10.73 ms                            |
    | 20 ms         | 3 peripherals | 95                   | 10.47 ms                            |
    | 40 ms         | 1 peripheral  | 24                   | 40.01 ms                            |
    | 40 ms         | 2 peripherals | 49                   | 20.01 ms                            |
    | 40 ms         | 3 peripherals | 49                   | 20.02 ms                            |
    | 100 ms        | 1 peripheral  | 9                    | 100.01 ms                           |
    | 100 ms        | 2 peripherals | 19                   | 50.01 ms                            |
    | 100 ms        | 3 peripherals | 29                   | 33.36 ms                            |

    These results seem to indicate that the lowest timer setting where we don't lose any notifications is about 20 ms when using only one peripheral, and the interval needs to increase more or less in proportion to the number of peripheral devices.

    If you have any ideas about what these results indicate or advice on how to use the Sniffer to better effect, we would appreciate it. Thanks!

  • Hi,

    Thank you for a great explanation, however i'm still not fully convinced that the problem is at the receiver side of the connection. How did you confirm that the notifications are actually sent? Could you upload the sniffer logs for the different timer settings?

    best regards

    Jared 

Related