Page 1 of 1

Dual core affecting AsyncWebserver and BluetoothSerial.

Posted: Wed Jun 01, 2022 7:18 am
by RiffuDev
I am getting some readings from accelerometer in my core0, also i am trying to download a txt log file from LIttleFS using AsyncWebserver/Bluetooth when needed. I can do all these without any problem when im doing everything in the same core. But when i try using core0 for my sensor data purpose and device gets stuck and resets with core panic.

I can see that other wifi and bluetooth tasks are also using core0 and my code is affecting them. Unfortunately arduino framework does support vTaskDelay() Api to list the task's details. Is there anyway i can sortout this problem?
Code for downloading the log file which sizes upto 2mb.
  1.  
  2.   server.on("/data", HTTP_GET, [](AsyncWebServerRequest *request){
  3.     request->send(LittleFS, "/readings.txt","text/plain");
  4.   });
  5.  
  6.   server.on("/download", HTTP_GET, [](AsyncWebServerRequest *request){
  7.   request->send(LittleFS, "/readings.txt", String(), true);
  8. });

  1.  
  2. core0 code
  3. void getSensor(void *pvParameter){  // thhis func runs in core 0
  4.  
  5.  initMPU();  // initializing mpu
  6.  
  7.   while(1){
  8.       mpuLoop();
  9.       vTaskDelay(1);
  10.   }
  11. }