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

Nrf52 slow scanning

Hi

I have made ble scanner using nrf52 and I have set uart baud rate 921600 and sending scanned beacon to other micro-controller for processing but It does not scanning all beacons.

I have around 100 beacons now and it takes around 10 seconds to scan all beacons(100) I have set beacon interval to 500ms.

Is nrf capable to scan all beacon that broadcasted?

I need to scan around 5000 beacons. is it possible to scan and send all beacons? if yes, then how much time it will take to scan and send 5000 beacons?

  • nRF5x chips are able to receive up to 2 ADV_xx packets per millisecond so scanning bandwidth is much higher then in your experiment (100 devices sending 2 packets per second make it 200 packets on given channel per 1000 millisecond = 0.2 packets per millisecond in average).

    However you don't really say what scanning parameters you use (you need to set 100% duty cycle aka having the same scanning interval and window). Even with 100% duty cycle Nordic BLE stack (Soft Device) needs very small switching time when it closes one scanning window on one (of 3) advertising channels and moves to another. But that can be neglected if the scanning window is reasonably long.

    Finally you need to understand that this is probabilistic game. First of all scanner (like nRF5x device) can listen only on one channel at the time so make sure that your advertisers advertise one packet on each channel each advertising interval. Secondly there is nothing like "thousands of beacons send packets and someone else will receive them". There indeed will be collisions - because advertisers are asynchronous - and these will be more likely if there will be more devices. Already with several hundreds of devices you will get some collisions and with thousands the probability will start to grow. If there are two packets colliding (even partially) then even if scanner listens the packet will be dropped because integrity checksum will be invalid. So what you should expect it: if you have 100 beacons in the room advertising with ~2Hz frequency on all 3 channels then any nRFx scanner should see all packets from all devices with >99% (or something like that). Once you grow number of advertisers to 500 the probability will lower by few percent and so on. I'm not having this model computed so the numbers are just based on my own experiment. But if you really care about this use case then you should easily make and compute correct statistical model in few hours or days (with proper books and all the knowledge of the mankind on the internet;)

  • How can i set 100% duty cycle? I have tested with same scanning interval and window but no difference.

  • Scanning interval must equal scanning window. I'm afraid you should blame your HCI/serialization set-up, If I collect advertising events on GAP Scanner running directly in nRF51 FW on top of S130 I have basically 100% packet capture if I have dozens of beacons with ~100ms interval. I never tried experimental collision rate for situation with 100/500/1000/5000 beacons advertising at 2Hz but if you have them then you should simply by professional BLE sniffer or radio analyzer and set the benchmark with these. Then you can say what is expected maximum percentage of detected packets and you should try to achieve the same with well written FW on nRF5x chip itself. Only then I would move to some relayed system over (stupid) UART.

  • To transfer data from nrf to other microcontroller I must require to use UART is there any other fast way?

  • Sure, SPI is typically faster (goes beyond 1Mbps).

Related