scan sometimes stops working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Sometimes, central scan stops working, and there are no more callbacks for peripheral advertisements (blecm_RegleAdvReportCb), and I have to reset central board to get it going again, and I again get a callback for ad of each peripheral.

 

TO START SCAN, I DO THIS:

blecm_setScanEnable(HCIULP_SCAN_MODE_OFF, blecen_cen_cfg.filter_duplicates);

  blecm_startScan(blecen_cen_cfg.scan_type,

  blecen_cen_cfg.high_scan_interval, blecen_cen_cfg.high_scan_window,

  blecen_cen_cfg.scan_adr_type, blecen_cen_cfg.scan_filter_policy,

  blecen_cen_cfg.filter_duplicates);

 

TO STOP SCAN, I DO THIS:

blecm_setScanEnable(HCIULP_SCAN_MODE_OFF, blecen_cen_cfg.filter_duplicates);

0 Likes
1 Solution

What are your high and low scan parameters? Take the default parameters for instance:

blecen_cen_cfg.high_scan_interval   = 96;   // slots
blecen_cen_cfg.high_scan_window     = 48;   // slots
blecen_cen_cfg.high_scan_duration   = 30;   // seconds

blecen_cen_cfg.low_scan_interval    = 2048; // slots
blecen_cen_cfg.low_scan_window      = 18;   // slots
blecen_cen_cfg.low_scan_duration    = 300;  // seconds

For the first 30s, the device is scanning at 50% duty cycle and for the next 5 minutes, it is scanning at under 1% duty cycle. So the probability of finding a device that uses undirected advertisement (even at 20mS interval) is quite low (use directed adv instead and the probability increases dramatically). Try changing these parameters (say increase the high scan duration or reduce the low scan interval or increase low scan window) and you will see that you will continue to get adv reports more often.

View solution in original post

0 Likes
6 Replies