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

NRF52832 SCAN Stop and restart

Hello,

Now i use SDK15.0 and NRF52832 to make a BLE scanner.

I want to scan advertisers every 5s , scan window and scan interval are equal(max=0x3FFF). Also,they are all scan at 37 cannnel.

I want to open scan window only 5ms every 5s peroid.

So ,i want to start a app_timer every 5s to start scanning and delay 5ms to stop it. Like this:

static void 5s_every_timeout_handler(void)
{
scan_start();
nrf_delay_ms(5);
sd_ble_gap_scan_stop();
}
But ,i find i cann't get scan data in ble_evt_handler();

Hello,

Now i use SDK15.0 and NRF52832 to make a BLE scanner.

I want to scan advertisers every 5s , scan window and scan interval are equal(max=0x3FFF). Also,they are all scan at 37 cannnel.

I want to open scan window only 5ms every 5s peroid.

So ,i want to start a app_timer every 5s to start scanning and delay 5ms to stop it. Like this:

static void 5s_every_timeout_handler(void)
{
scan_start();
nrf_delay_ms(5);
sd_ble_gap_scan_stop();
}
But ,i find i cann't get scan data in ble_evt_handler();
Otherwise, i place these orders in for(::) of main(),like this:
for(;;)
{
scan_start();
nrf_delay_ms(5);
sd_ble_gap_scan_stop();
nrf_delay_ms(5000);
}
It is ok.
So,i think if app_timer handler and ble_evt_handler() cann't run at same time?
Another question,i want to know what time will spend in stop and start scanning.

I tihink after the chip run scan_start() of software a minutes about N ms or us ,the scanner of hardware can scan really.Is it right?
Thanks.
Liu
China
,

Related