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
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Thanks for the response Doug.

0 Likes
Anonymous
Not applicable

I can't tell by the wording of the post. What was the answer to this issue? To manually stop scanning and re-start it after a period of time?

Mike

0 Likes

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.

0 Likes
Anonymous
Not applicable

Hi arvinds,

  Can you elaborate bit more about this statement 'use directed adv instead and the probability increases dramatically'?

  How does direct advertising increase the probability comparing to undirect type without changing the scan interval and window?

0 Likes

Because with directed adv, the advertiser advertises at near 100% bandwidth. So when the central scans for the 18 slots (11.25mS) every 2048 slots (1.28s) it is guaranteed to get the central's attention. With undirected adv, the adv packet and the scan have to line up just right or you lose another 1.28s.

Anonymous
Not applicable

Thanks, arvinds. Also checked on specification, it defines more intensive broadcasting in direct advertising mode.

0 Likes