Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Frequency of Notifications with Android BLE Library

I am working on a derivative of the Glucose sensor code from nRF Toolbox. The sensor peripheral accumulates a number of readings. The central  sends a command to the Record Access Control Point characteristic asking for the readings. The peripheral sends the requested data as a sequence of Notifications from the Glucose Measurement Characteristic, then sends a status message as an Indication from the Record Access Control Point characteristic.

For a small number of readings this works as expected: I see the Notifications arriving at the central (in the Notification callback code onDataReceived() ).

However, I find that when the number of characteristics exceed about 6, the central stops receiving the Notifications. The peripheral hangs up as it sends the Notification AFTER the last one received by the central.

If I insert a delay of about 8ms on my device, to throttle the Notification stream, then it starts working again. I am doing some work on the incoming Notification data (checking validity) then add it to an Array List for later processing, so probably not spending a huge amount of time.

The question is whether there are limitations at the central on the rate at which it can receive Notifications. Are Notifications queued by the OS? Do I need to do somewthing with threads? etc.

I get the same result with two tablets running Android 7.

  • Please report it on GitHub. I'll take it from there. Provide some logs or way to reproduce. I'll try to arrange Samsung a5, but can't guarantee.

  • Is there an update to this?

    I have a similar problem: I want to receive 4 items at about .001 sec intervals. I've used the relevant UART and profile files from GitHub Toolbox app source, but both my custom app and what I think is the latest nordic toolbox UART activity (with log) only show the first, and 3 copies of the last received packet.

    However, the current version of NRF Connect does catch all packets with the right data.

    I've tried debugging both my app and the toolbox with and without nrf connect attached, and the apps show repeated catches, where NRF connect catches correctly (when connected and running).

    I can not get to all devices right now to set a higher delay in broadcasting packets.

    Any suggestions on what is different between NRF Connect and NRF Toolbox?

  • nRF Connect isn't using BLE Library, it has its own implementation. Did you try BLE Library 2.0.4? The latest nRF Toolbox may not be using the latest version. I'll update nrf Toolbox soon.

  • David this sounds like it could be the same bug as I found. However for me the bug only occurs in certain conditions. It would be interesting to know what setup you have. Could you provide extra information:

    (1)   What devices have you tried, and do they all show the same results? (I only see the problem on a Samsung Galaxy A5 phone - no problem seen with 3 other tablets).

    (2)   Can you compare the results of nRF Toolbox downloaded from Play Store with nRF Toolbox re-built from GitHub source code? (I only see problems with the re-built nRF Toolbox; the version downloaded from Play Store works OK. Unfortunately they both report the same version number (2.6.0)).

    If you wanted to replicate my experiments then you could program a PCA10040 development board with the Glucose app here:
    infocenter.nordicsemi.com/index.jsp
    then create some simulated readings and read these using the BGM app within nRF Toolbox. This uses notifications to read the glucose data.

    LATER:

    Aleksander suggests trying BLE Library 2.0.4. This is not straight-forward, as nRF Toolbox uses nRF Common 2.0.0, which uses BLE Library 2.0.0 - however after downloading nRF Common 2.0.0 and BLE Library 2.0.4 and making approprate edits in build.gradle files, nRF Toolbox builds and the bug is fixed!

    IMHO it would be useful if David provides the information (1) and (2) above, then reports on results of using BLE Library 2.0.4. Then it would be good if Aleksander could report that he understands the bug and the fix.

  • Hi! First of all, sorry for the delay. Secondly, sorry for a) not releasing ble-common 2.0.4 (I forgot! will do this asap) and b) not updating nRF Toolbox to ble-common 2.0.4. @Acutetech, thanks for the efforts and testing the code with those mixed up libraries.

Related