while trying to calculate the data rate from bluetooth low energy , i have two questions
Then i changed Min connection interval to ((X/2) * 1.25 ) and max connection interval to (x/2) * 2 here x is macro value
when x=80 ; and writing interval is 10ms(writing interval is time interval where data is written to ble buffers in nordic) data rate is 60 packets , for x=80 and writing interval is 1ms then data rate is 300 packets
for x= 40 and writing interval is 10 data rate is 120 packets, and for writing interval is 1 ms data rate is 250 packets.
There is no consistency when ever we are taking the reading.
From this i want to know how many buffers are present in nordic ble and is there any way to calculate the data rate because in master control pannel the resolution is 100 ms.
The packet rate depends on at least two factors:
The softdevice has buffer for 7 packets per link, so if you fill up the buffers constantly, you should be seeing the maximum packet rate achievable.
It is different from central to central device how many packets they can receive in each interval and what minimum connection interval they support, see this thread.
It also depends on what transfer method you choose, how much packet rate you will get, see this blog.
In various example codes, connection interval is updated some time after a connection is established, or some time after server notifications are enabled ("Enable Services" on Master Control Panel), see this thread. This might be one of the causes that you do not see consistency in the packet rate.
There is a data throughput test firmware here, that could be handy to try out.
Hopefully, this will get you back on track. Otherwise, let me know.
I have tested the throughput with the througput test firmware I pointed to earlier and the Master Control Panel. I get 47,060 bps in my test when the Master Control Panel has the default connection interval of 20ms. That is very close to the theoretical maximum when sending 6 packet per connection interval and each packet containing the maximum of 20 bytes
1/0.02 connInt/second * 6 packets/connInt * 20 bytes/packet * 8 bits/byte = 48,000 bps
If I go to File -> Options in the Master Control Panel and configure the connection interval to the minimum of 7.5ms, then I get 114,633 bps throughput. The theoretical maximum is:
1/0.0075 connInt/second * 6 packets/connInt * 20 bytes/packet * 8 bits/byte = 128,000 bps
I am not sure why the throughput is ~10% less than the theoretical maximum in my case. For now I suspect two of the following:
I have carried out this test with second revision nRF51 harware (see the nRF51 compatibility matrix to identify second revision harware chips), which has limited CPU time when sending 6 packets per connection event and the connection interval is 7.5ms. The CPU is blocked for about 6ms during the radio event when sending 6 packets, so there is only 1.5ms left for the application to process data before each radio event. It might be that the available application CPU time is not sufficient. The latest third revision nRF51 hardware does however not block the radio during the whole radio event, and therefore might have better throughput performance in this case.
I am in an environment with a lot of BLE radio activity. Perhaps packet collision is causing some packets to be lost, which requires occasional re-transmission of packets, therefore it is possibly degrading the throughput.
I test the maximum througput again now with second revision nRF51 and I get the expected 128.000 kbps, so I suspect that the ~10% degraded throughput that I measured in March was because an extensive BLE/2.4GHz radio activity at that time in my office.
Good answer. I just wanted to ask if the MCP had a limit on the number of packets per connection interval which also may impact trk's testing. I seem to recall at one point it was limited to one packet per connection interval, but I could be wrong or it could be fixed by now.
I think the master emulator firmware v0.9 had a limitation of 1 packet per connection interval. The master emulator firmware v0.10 can however handle up to 6 packets per connection interval and 7.5ms connection interval.
Thank you for reply stefan,
I tried calculating the data rate by setting writing interval to nrf51822 as 1ms and connection interval as 7.5 ms.
As per calculation as pre assumed there are 7 buffers in nrf51822., i need to achieve
(1000*7)/7.5 = 933 packets per second.
but when i check with master control pannel i can recieve only 413 packets per second. Am i missing something?
And i read in another forms as CPU will be blocked for 1.6 ms , if we write two buffers with
writing interval of 1ms. and if we write seven buffers with writing interval of 1ms., CPU is blocked for 5.6ms. Is that correct?
CPU blocking time source from s110softdevicespecification document v1.1
If CPU is blocked for 5.6ms writing seven buffers with writing interval of 1ms. I can able to write only two buffers i.e 2 packets per 7.5 ms., i.e 233 packets per second. But i can achieve 411 packets per second? Can i get answer to these questions?
While i was checking my data rate by following devzone.nordicsemi.com/.../ link by removing the old s110 soft .h files and replacing the new s110 v7.0 files. I am achieving the same data rate as 400 packets per second. As per that link the radio shouldnt be blocked., but i was still achieving 400 packets per sec by settting writing interval as 1ms and connection interval as 7.5 ms