According to the official BLE core specification, in the scanning state:
"If the scanWindow and the scanInterval parameters are set to the same value by the Host, the Link Layer should scan continuously."
But the scanning in this case is not really "continuous". The link layer is not listening for packets for a small duration in which it switches the channel at the end of each scan window. Hence, any packets arriving in this switching duration should be lost.
The s140 softdevice specification specifies a parameter named tScanReserved which has been defined as:
"Reserved time needed by the SoftDevice for each ScanWindow"
and its value is 760 μs for S140 softdevice. I came across this devzone discussion which concluded that tScanReserved is the worst case time that the stack needs in addition to the actual scan window.
From this discussion, is it correct to conclude then, that this 760 μs is the duration in which channel switching also takes place, and the link layer is not listening for packets in the tScanReserved duration? Also, is 760 μs fixed for S140? Or is it the maximum/ worst case duration and can actually be smaller than 760 μs?
Another relevant Devzone discussion is this one, which again clarifies that the scanning device scans on a channel for the entire scan window, and it uses some time to change the radio configuration in between scan intervals. The radio is offline during this time. Thus when we set scan window equal to the scan interval, the radio is not ON all the time. This must reflect in the power profile of the scanner as well, as in this discussion. The screenshot attached in the discussion very clearly shows a dip of around 1 ms after each scan window. But, in this discussion, the 1 ms long dip in the current consumption (which is supposedly due to the channel switching activity) has been justified by stating that the SoftDevice reserves "at least" 760 μs after each Scan Window.
So now my question is that, since I encountered two contradictory statements, which one should I trust? Is 760 μs the minimum value or the worst case value?
I grew curious and checked the power profile of nRF52840 by flashing the ble_app_blinky_c example. We set the scan interval and scan window to the same value, 50 ms. The screenshots of the power profiler app have been attached here. We did observe a dip at the each of each scan window, but as is evident from the screenshots, the dip is actually very sharp. Also, the 50 ms scan interval/ window is the difference between two consecutive dips. The current consumption begins to fall before the 50 ms duration set by us actually ends. But the discussions I came across state that switching takes place only after the scanning window ends. Then why is there a fall in the current before the window ends?
Where exactly is the switching happening here? Which point to which point in this dip can we say that the 760 μs is reflecting? Or is the switching duration smaller or larger than this specified value?
I want to add that the application we are working on uses multiple end nodes, advertising sensor data with undirected non-scannable, non-connectable advertising PDUs. The aim is to minimize packet loss in case of multiple end nodes. It is being observed that even for a single node, with small scan window and interval values of around 2.5-10 ms, packet loss is high, which has made us believe that it is the radio off time during channel switching at the scanner, which leads to packet loss. This would affect packet reception in multiple nodes as well, and hence we are trying to figure out the exact time for which the link layer does not listen to the incoming packets.
Please let me know if any further information is required.
Regards,
Sukriti
