DUO - BLE Scanning Failure

Been using the duo for some time as a BLE device gateway. There is a persistent issue however that I can not solve:

After scanning for more than an hour (up to 12 hours) with these params:

ble.setScanParams(0x01, 0x0010, 0x0010);

The scanCallback stops firing. This is not a case where there is no BLE traffic. I verified that with external sniffers.

I programmed a button to call ble.startScanning on demand when it stops working and this will work once. Subsequently when it again stops it will require a reset to start working again.

  1. Is there a known cause why a callback stops firing and/or the BLE components stops scanning?
  2. How can I debug what is causing this? Resetting the module every hour is not a great workaround.

Really hoping for a reply here from those familiar with the Duo hardware and BLE implementation. Here is more information.

Having issues with the Duo’s BLE radio. The Duo is setup to scan for BLE advertisements and collect them. 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 reliably 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:


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.

There is no processing in the callback. Only the advertisement is added to a buffer. The buffer is processed in the main loop.

std::queue<advertisementReport_t> advBuffer;
void scanCallback(advertisementReport_t *report) {

Memory is stable during operation so I’m not running out of memory as far as I can tell.

Any thoughts appreciated. This is impossible to reproduce on demand, but I am suspecting that the radio fails on certain BLE traffic. My reasoning for this is that I have 3 units setup in my office next to each other. When they stop scanning they almost always ALL stop scanning at about the same time (within seconds of eachother). Very curious no?

Otherwise the app executes normally and cloud connectivity is no issue. Just the BLE seems to die.

Is the scan callback executed on a separate thread form the main loop? I have threading enabled.