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

How to increase notification throughput on nRF52840?

Hello there,

I'm developing a C++ application on the BLE654 development bord which shall be able to generate and send 100+ BLE notifications per second on a single BLE connection.

On my first try it managed 5.

After some digging, I found that the soft device (s140, Ver 6.1.0) got a BLE_GAP_EVT_CONN_PARAM_UPDATE event, which set the minimum and maximum connection interval to 200 ms, wich was the defined MAX_CONN_INTERVAL (the code burrowed from the blinky example). After setting this to 20 ms I could get (close to) 50 notifications per second, but further decreasing the value again reduced the throughput (maybe the Android on the 'other side' of the BLE connection prohibited a further decrease).

I read somewere that soft devices from s120 up were able to process up to 6 notifications in a 7.5 ms connectipon interval, but here it looks as is the sd only does one notification per interval. What can/must be done to further increase the througput to reach at least 100 notifications per second?

Notes:

-in our application, we send the notifications with sd_ble_gatts_hvx(). I don't have exact numbers, but the internal queue of the soft device seemd rather small and we got a NRF_ERROR_RESOURCES error quickly, after wich we wait for a BLE_GATTS_EVT_HVN_TX_COMPLETE until we call sd_ble_gatts_hvx() again. I am certain the soft device at all time had notifications in its queue.

-as recipient of the notifications we used two tablets with Android 6.0.1 and 7.0, respectively. Both showed similar throughputs, and the final application shall also run on an Android device.

Regards,

     Lasse

  • Try to program the attached app on your device, and check the RTT log. What does it say?

    test_app.hex

    NB:

    The app is an application AND the softdevice, so no need to program the softdevice first.

    Just use:

    "nrfjprog -e && nrfjprog --program test_app.hex && nrfjprog --reset"

    Then connect to it with your android devices, and check the log. The app should advertise as Nordic_UART.

    BR,

    Edvin

  • Hello Edvin,

    the app doesn't say anything. It seems that it isn't running at all (or at least, it isn't running very long).

    I think the problem may be the soft device clock configuration. We are using a DVK-BL654 development kit which doesn't feed the XTAL clock. Since most examples do use the XTAL clock source I think your code does too, in wich case it will stall as soon as the soft device is initialized.

    Here are our soft device clock settings:

    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 1

    Best regards,

         Lasse

  • I'm sorry. I forgot. Try this one, then:

    test_app_2.hex

    (this .hex file also includes the softdevice)

  • Hi Edvin,

    I wasn't able to use the your application with our first tablet (it always lost connection during service discovery), but it worked with the 2nd one.

    this is what I got:

    The line beginning with "Es ist der Vater" was send from the dev kit to the tablet; more than 20 Bytes received, all fine.

    However, when I compile and run the example code, i get the following:

    The red error message occured wehin I tried to send data to the device (not good, but not my main concern). The "Er erreicht" line was send from the device to the tablet. it is longer than 20 Bytes, but only the first 20 Byte are shown in the application.

    What have you done that I am missing?

    Note: In these screenshots I used two different DVK-BL654 boards, but I also tried it on the same board. The results were the same (your App worked, mine not).

  • Oh. sorry again. I forgot to mention that the log backend is RTT. Can you check it with the RTT viewer? The same as I used in an earlier reply.

    Can you enable RTT logging on your project as well, and then check the RTT output on both applications?

    You can find RTT viewer here, if you don't have it already. 

    BR,

    Edvin

Related