Hello,
this question has been probably asked many times, but I could not find any good matches using the search.
My setup: I am using nRF52832, latest SDK 16.0.0 and a test application based on the FreeRTOS HRS example from the SDK.
I want to test sending lots of data from the peripheral to the central using notifications. To do this, I have tweaked the HRS example a little. Normally the example updates the HRS data once per second. I have basically just increased the rate of the updates to get more data sent over the air.
I have tried two approaches:
1) configure the timer to use 10ms (100Hz) interval, i.e. make it run 100x faster than in the original example
2) send one notification once the central has subscribed to notifications, then trigger each subsequent notification to the BLE_GATTS_EVT_HVN_TX_COMPLETE event received from stack
With both solutions, I have the same problem: initially, the data transfer seems quite fast, but after running a few seconds (maybe 5 sec?) the data transfer always slows down considerably, to a rate that is something like one notification per second.
I have checked that the ble_hrs_heart_rate_measurement_send() function does not return any error code when the slowdown happens.
Any ideas where to start looking for reason for the slowdown? If the stack buffers are becoming full, then I would expect to get some error code when trying to send a new notification.
I first tried with 75ms connection interval and then changed the value to 7.5 ms. Using smaller interval results in fast data rate, but only during the first ~5 seconds after which it slows down a lot.
Is there perhaps some issues in the FreeRTOS based example that makes it not suitable for throughput testing? I am not looking to reach very high data rates right now, I would be happy to get the notifications running stable at roughly 100 Hz, 8 bytes per packet which corresponds to 6400 bps.
EDIT: more info about the problem. The slow down always happens at the same time, about 4 seconds after starting sending data. It is not random but very deterministic. And the distance between the two devices is very short, about 30 cm. Because of this, I would assume that after pushing lots of data for a few seconds there is some internal buffer that becomes full and that is causing the slowdown...
EDIT2: slowing down the transmit interval from 100Hz to 10Hz did not really help. First 4-5 seconds the data is transmitted at steady pace, then something causes a major slowdown. And eventually after 10-20 secs there is a supervision timeout and connection drops.