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

ble_app_hrs_c --scan stopped

I programmed nRF51822 with S120 softdevice and ble_app_hrs_c application to scan beacons. It works fine but have one problem.

  • It scans beacons for about 10 seconds then stop scanning for about 10 seconds and repeat scanning.

What makes this kind of symptoms scanning-stop-scanning-stop every 10 seconds period.

Parents
  • Hi Mike

    From the discussion between you and Roger I suspect this pause for a few seconds is because of the periodic nature of both advertising and scanning. The scanning interval is set to 100ms with value 0x00A0 and the scan window is set to 50ms with value 0x0050. This means the scanner will scan 50ms, then pause 50ms, then scan 50ms, then pause 50ms, etc. The advertiser advertises however every 1000 ms. Since advertising period is a multiple of the scan interval, the advertiser could advertise many times in a row when the scanning is not scanning, i.e. in the scanning pause period. As Roger mentioned, if you blink a led when advertising packet is received, you will see this periodic behavior. You can fix this by scanning all the time, i.e. by setting scan window and scan interval to the same 0x00A0 value. You can also set the scan interval to e.g. 0x0090 to avoid the advertising interval to be a multiple of the scanning interval.

    Even though the advertising interval is a multiple of the scanning interval, the scanner is unlikely to miss the advertising packets forever, as there is added random delay of 10ms for every advertising event. If you for example set advertising interval to 100 ms, the time between two advertising events is actually between 100ms and 110 ms.

  • I think 160*0.625=100ms. Beacons are advertising packets, which do not have acknowledgement. You might be occasionally missing packets, because of other BLE devices in the area, WIFI, or other devices transmitting in the 2.4GHz band. So losing every 60th packet might be normal when advertising.

Reply Children
No Data
Related