BLE Scanning Stops Unexpectedly


#1

Having issues with the Duo’s BLE functionality. The Duo is setup to scan for BLE advertisements and collect them. The scan reports are placed in a queue in the callback and this queue is subsequently flushed in the main loop().

After random periods of time (a few minutes up to weeks) the scanning will just stop and ONLY a hard reset will restore scanning capability. The following will NOT restore scanning:

  1. Stopping and Starting scanning: ble.stopScanning() / ble.startScanning()
  2. Reinitialize BLE: ble.deInit() / ble.init()
  3. Re-establishing the callback: ble.onScanReportCallback(scanCallback)

When the scanning stops of coarse the callback is not fired. However, with logging enabled:

	ble.enablePacketLogger();
	ble.debugLogger(true);
	ble.debugError(true);

There is no activity or errors logged whatsoever. In fact, calling ble.stopScanning() / ble.startScanning() do not elicit any activity either. It’s as if the BLE radio just shuts down.

I separately questioned if the callback is executed on another thread. The related post is here: