BLE arduino libraries crashing on M5 stack



  • Hi,

    I'm writing some code that uses BLE to discover a couple of sensors. I've been able to initialise the BLE library, scan for a device and succesfully match the service UUID with the one I'm interested in. However once I want to do something with services characteristics my M5 crashes with the following error when I call

      std::map<std::string, BLERemoteService*>* servicesMap  = pClient->getServices();         
      for (auto &myServiceEntry : *servicesMap)   
      {
        BLERemoteService* svc = myServiceEntry.second;
        Serial.printf("Service found on Device: %s \n",  svc->getUUID().toString().c_str());
    
        if (svc->getUUID().toString() == myUUID)
        {   
          Serial.println("Searching for characteruistics");        
    
          std::map<std::string, BLERemoteCharacteristic*>* characteristics = svc->getCharacteristics();
          
          Serial.println("Finished search");
              
        }        
      }
    

    results in

    Finished search
    E (9180) FreeRTOS: FreeRTOS Task "loopTask" should not return, Aborting now!

    Backtrace: 0x40091e8c:0x3ffcaac0 0x400920bd:0x3ffcaae0 0x4008ddef:0x3ffcab00

    Rebooting...

    Has anyone used the BLE libraries with the M5? My understanding is the BLE libraries are now part of the ESP32 libraries for arduino and I am currently using ESP21 1.0.2

    Thanks



  • Hmm had something similar some time ago. Check for null values e.g. empty fields on the ble device.



  • I have no control over the ble server device. It appears the ble libraries are just flaky