[BLE] Scan fails with "Scan Error" and "There is no scan" on Ameba Arduino D

Hello,

I am currently working on a project using the Ameba Arduino D environment, with the AMB21/AMB22 (RTL8721DM) board.

The application uses BLE to scan for nearby advertising devices and transmits the data to an external server.
The following header files are being used:

#include "BLEDevice.h"
#include "BLEWifiConfigService.h"

The scanning logic is set to activate from second 0 to 30 of every minute. While it operates normally for a while, the following issue sometimes occurs:

  1. Scan Start is logged,
  2. Immediately followed by a Scan Error,
  3. Then repeated messages saying "There is no scan" appear.

I would like to better understand the conditions under which this issue occurs, and would appreciate clarification on the following points:

  1. Under what conditions are "Scan Error" and "There is no scan" messages triggered?
  • Could this be due to internal BLE stack conflicts, resource limitations, or incorrect state transitions?
  1. Are there any recommended configurations or initialization steps to ensure stable BLE operation in the Ameba Arduino D environment?
  • For example: BLE stack initialization order, power settings, or scan interval constraints.

Also, once the issue occurs, BLE scanning does not resume until the board is manually reset.
If there is a way to deliberately reproduce the Scan Error, it would greatly help with debugging and testing.

Any relevant documentation or suggestions you could provide would be sincerely appreciated.
Thank you for your support.

Additional Information:

  • When a “Scan Error” occurs, the reported cause value is 2.
    I would appreciate any insight into what this specific cause value represents internally in the BLE stack.
  • We are currently scanning and transmitting data from around 50 to 100 nearby devices over HTTP.
    The issue typically occurs after 2 to 3 hours of continuous operation.
    Any suggestions for long-term BLE stability would be highly appreciated.

Thank you very much for your support.