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

BLE service configuration help requiered. Update speed over 100hz

Hello, sorry to bother once more.

I am new to the nRF world and bluetooth in general, I am trying to build a device /app that gets data from 3 sensors. 2 of which operate at 100hz+ and the third one at around 1-2hz

Each device collects data on 3 axis.

So I have 3 custom BLE services with 3 custom characteristics that I created. Those char receive floats as byte arrays of 4 bytes.

Currently I have the timers of service A & B at 10ms to match the 100hz rate. When the timer expire, I read the value from the sensors through i2c and send the results through ble sd_ble_gatts_hvx().

So I have 3 updates every 10ms of 32bits floats for both A and B.

My other service C does the same thing but with 1000ms timer.

Independently those services work fine, when ever I turn on notifications I get my data on the nRF connect app on my phone. Though I don´t see the numbers update every 10ms, but Im guessing this is due to my phone or the app rendering capabilities.

My problem is that whenever I turn all 3 services on at the same time, A and B get their updates. But C never does.

I am guessing there is a bottleneck, and I am sending too much data, too fast, and the packets get filled before C ever has a chance to post up its values.

I have tried to alter the conn intervals and dropped it to the minimum, 7.5ms and 20ms for the max, the connection works, but the problem remains the same.

I tried to send smaller data instead of floats, send int16_t but still experience the same issue, even with both solution combined, C still does not update when A and B are on.

Could anyone point me in the right direction, what article or post could I read, what config should I tweak, or how to organize my data to fix this issue?

I tried to alter the MTU to make the packets bigger, but that seems to crash my app, it does not advertise if I mess with that.

Thanks in advance.

  • Some advice on building that app and some pointers would be welcomed.

    But I fixed my issues. Apparently calling the sd_ble_gatts_hvx(). creates a package and sends it... so I was sending 4bytes of data per package and sending many many packages per conn interval, from what I understood from deeper reading is that phones usually only accept 6-7 package per conn interval. So those packages would be taken almost instantly by the fastest services.

    So I am now consolidating data before sending it. I do three readings at 10ms intervals and send them on the third, I put conn interval to be 30ms so that I can send my data without having to wait, or skipping conn intervals, this time as 18bytes almost filling the 20bytes default package limit. (changed from floats to int16).

    Seems to resolve my main issue. All services update fine, when all are active.

  • Sorry for the late reply, I'm glad you've fixed your issue. If you need a higher throughput you can increase the packet size by increasing the MTU size and enabling Data Length Extensions.

    The Nordic Uart Service example shows how you can achieve good throughout when you've got a fair bit of data to send. 

Related