RTL8720DN

I am using Arduino IDE and programming a Seeed WIO Terminal. When I run the Bluetooth scanner it crashes after about 500 records. I added a write to SD Card to record the loops through, I hit about 92 loops and it crashes. I have used a release of memory but it doesn’t seem to release. Can someone help with this issue?
//Bluetooth scan
Serial.println(“BLE scan start”);
myFile.println(“BLE scan start”);
{
Serial.print(“Loop Count: “);
Serial.println(counter);
myFile.print(“Loop Count: “);
myFile.println(counter);
counter++;
}
BLEScanResults foundDevices = pBLEScan->start(scanTime, false); //scan for bluetooth devices and print MAC address
Serial.print(foundDevices.getCount()); //print number of bluetooth devices found
myFile.print(foundDevices.getCount()); //print number of bluetooth devices found
Serial.println(” BLE device(s) found”);
myFile.println(” BLE device(s) found”);

Serial.println(“BLE scan done!”);
myFile.println(“BLE scan done!”);
pBLEScan->clearResults(); //delete results from pBLEScan buffer to release memory
Serial.println(“Networks Found”);
myFile.println(“Networks Found”);
Serial.println(“”);
myFile.println(“”);
myFile.close();

delay(500); //wait before scanning again

Hi @mrpeterc ,

Can I check which board and SDK version are you using? Is it possible that you send me the .ino file that you used to run? Let me try to reproduce and see how I can help you.

Have you checked out the BLE Scan example in our Arduino SDK? ambd_arduino/Arduino_package/hardware/libraries/BLE/examples/BLEScan/BLEScan.ino at dev · ambiot/ambd_arduino · GitHub

Thank you.