Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled

Hi, I was using my xiao esp32s3 camera, but this error came
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
my code is this:

#include <WebServer.h>
#include <WiFi.h>
#include <esp32cam.h>
 
const char* WIFI_SSID = "";
const char* WIFI_PASS = "";
 
WebServer server(80);
 
 
static auto loRes = esp32cam::Resolution::find(320, 240);
static auto midRes = esp32cam::Resolution::find(350, 530);
static auto hiRes = esp32cam::Resolution::find(800, 600);
void serveJpg()
{
  auto frame = esp32cam::capture();
  if (frame == nullptr) {
    Serial.println("CAPTURE FAIL");
    server.send(503, "", "");
    return;
  }
  Serial.printf("CAPTURE OK %dx%d %db\n", frame->getWidth(), frame->getHeight(),
                static_cast<int>(frame->size()));
 
  server.setContentLength(frame->size());
  server.send(200, "image/jpeg");
  WiFiClient client = server.client();
  frame->writeTo(client);
}
 
void handleJpgLo()
{
  if (!esp32cam::Camera.changeResolution(loRes)) {
    Serial.println("SET-LO-RES FAIL");
  }
  serveJpg();
}
 
void handleJpgHi()
{
  if (!esp32cam::Camera.changeResolution(hiRes)) {
    Serial.println("SET-HI-RES FAIL");
  }
  serveJpg();
}
 
void handleJpgMid()
{
  if (!esp32cam::Camera.changeResolution(midRes)) {
    Serial.println("SET-MID-RES FAIL");
  }
  serveJpg();
}
 
 
void  setup(){
  Serial.begin(115200);
  Serial.println();
  {
    using namespace esp32cam;
    Config cfg;
    cfg.setPins(pins::XIAO);
    cfg.setResolution(hiRes);
    cfg.setBufferCount(2); 
    cfg.setJpeg(80);
 
    bool ok = Camera.begin(cfg);
    Serial.println(ok ? "CAMERA OK" : "CAMERA FAIL");
  }
  WiFi.persistent(false);
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
  Serial.print("http://");
  Serial.println(WiFi.localIP());
  Serial.println("  /cam-lo.jpg");
  Serial.println("  /cam-hi.jpg");
  Serial.println("  /cam-mid.jpg");
 
  server.on("/cam-lo.jpg", handleJpgLo);
  server.on("/cam-hi.jpg", handleJpgHi);
  server.on("/cam-mid.jpg", handleJpgMid);
 
  server.begin();
}
 
void loop()
{
  server.handleClient();
}

I am using write power supply, write usb cable and write configuration of my camera module. How can I solve this error.
Regards
Darsh

I moved your topic to a more appropriate forum category @robo234.

The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

Hi @robo234

https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/fatal-errors.html#loadprohibited-storeprohibited

These CPU exceptions happen when an application attempts to read from or write to an invalid memory location.

It appears you got the code from this tutorial:

However, it also appears you have made some modifications. I tried to compile the sketch, but it failed on this line:

cfg.setPins(pins::XIAO);

Sure enough, the "esp32cam library doesn't contain a pins::XIAO definition and I don't find any occurrences of this on the Internet, so it seems it is something you created? Don't you think it would have been useful to provide this information???

I have changed the library pins code an added the pins of the xiao esp32s3 to the file. Is there any problem with it?
thankyou for replying @ptillisch.
here is the pin code:

#define ESP32CAM_PINS_HPP

namespace esp32cam {

/** @brief Camera pins definition. */
struct Pins {
  int D0;
  int D1;
  int D2;
  int D3;
  int D4;
  int D5;
  int D6;
  int D7;
  int XCLK;
  int PCLK;
  int VSYNC;
  int HREF;
  int SDA;
  int SCL;
  int RESET;
  int PWDN;
};

namespace pins {

/** @brief Pin definition for AI Thinker ESP32-CAM. */
constexpr Pins AiThinker{
  D0: 5,
  D1: 18,
  D2: 19,
  D3: 21,
  D4: 36,
  D5: 39,
  D6: 34,
  D7: 35,
  XCLK: 0,
  PCLK: 22,
  VSYNC: 25,
  HREF: 23,
  SDA: 26,
  SCL: 27,
  RESET: -1,
  PWDN: 32,
};

/** @brief Pin definition for FREENOVE WROVER ESP32-CAM. */
constexpr Pins FreeNove{
  D0: 4,
  D1: 5,
  D2: 18,
  D3: 19,
  D4: 36,
  D5: 39,
  D6: 34,
  D7: 35,
  XCLK: 21,
  PCLK: 22,
  VSYNC: 25,
  HREF: 23,
  SDA: 26,
  SCL: 27,
  RESET: -1,
  PWDN: -1,
};

/** @brief Pin definition for M5Stack M5Camera. */
constexpr Pins M5Camera{
  D0: 32,
  D1: 35,
  D2: 34,
  D3: 5,
  D4: 39,
  D5: 18,
  D6: 36,
  D7: 19,
  XCLK: 27,
  PCLK: 21,
  VSYNC: 25,
  HREF: 26,
  SDA: 22,
  SCL: 23,
  RESET: 15,
  PWDN: -1,
};

/**
 * @brief Pin definition for M5Stack M5Camera with LED.
 *
 * Red LED on GPIO 14, tally light when tied to PWDN
 */
constexpr Pins M5CameraLED{
  D0: 32,
  D1: 35,
  D2: 34,
  D3: 5,
  D4: 39,
  D5: 18,
  D6: 36,
  D7: 19,
  XCLK: 27,
  PCLK: 21,
  VSYNC: 25,
  HREF: 26,
  SDA: 22,
  SCL: 23,
  RESET: 15,
  PWDN: 14,
};

/** @brief Pin definition for TTGO ESP32-CAM. */
constexpr Pins TTGO{
  D0: 5,
  D1: 14,
  D2: 4,
  D3: 15,
  D4: 37,
  D5: 38,
  D6: 36,
  D7: 39,
  XCLK: 32,
  PCLK: 19,
  VSYNC: 27,
  HREF: 25,
  SDA: 13,
  SCL: 12,
  RESET: -1,
  PWDN: -1,
};
constexpr Pins XIAO{
  D0:  5,
  D1:  18,
  D2: 19,
  D3: 21,
  D4: 36,
  D5: 39,
  D6: 34,
  D7: 35,
  XCLK: 0,
  PCLK: 22,
  VSYNC: 25,
  HREF: 23,
  SDA: 26,
  SCL: 27,
  RESET: -1,
  PWDN: 32,
};

} // namespace pins
} // namespace esp32cam

#endif // ESP32CAM_PINS_HPP

these are the pins which I modified for the xiao esp32 in the esp32cam library, is there any problem in these pins?
Please read about xiao esp32s3 for more information and find out my problem.
best regards
Darsh

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.