yoursunny / esp32cam

OV2640 camera on ESP32-CAM, Arduino library
https://esp32cam.yoursunny.dev
ISC License
499 stars 174 forks source link

IntegerDivideByZero #54

Open bsdshneg opened 6 months ago

bsdshneg commented 6 months ago

After a random time of viewing the stream, the controller reboots with an error.

..Copy link to the browser open
http://192.168.10.77/
loading finished
Guru Meditation Error: Core  0 panic'ed (IntegerDivideByZero). Exception was unhandled.

Core  0 register dump:
PC      : 0x40160637  PS      : 0x00060b30  A0      : 0x801601f8  A1      : 0x3ffd3560
A2      : 0x3ffbbf34  A3      : 0x00000003  A4      : 0x00000000  A5      : 0x00000000  
A6      : 0x00000000  A7      : 0x00000022  A8      : 0x80160637  A9      : 0x3ffd3540
A10     : 0x00000073  A11     : 0x80000001  A12     : 0x80090db8  A13     : 0x3ffbc640  
A14     : 0x00000003  A15     : 0x00060623  SAR     : 0x00000020  EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000  LBEG    : 0x4008b45c  LEND    : 0x4008b472  LCOUNT  : 0x00000000  

Backtrace: 0x40160634:0x3ffd3560 0x401601f5:0x3ffd3590 0x4015f199:0x3ffd3650 0x4013d09d:0x3ffd3690 0x4013d8bb:0x3ffd36c0 0x4016041b:0x3ffd3700

  #0  0x40160634:0x3ffd3560 in rcUpdateTxDoneAmpdu2 at ??:?
  #1  0x401601f5:0x3ffd3590 in ppResortTxAMPDU at ??:?
  #2  0x4015f199:0x3ffd3650 in lmacEndFrameExchangeSequence at ??:?
  #3  0x4013d09d:0x3ffd3690 in lmacProcessTxSuccess at ??:?
  #4  0x4013d8bb:0x3ffd36c0 in lmacProcessTxComplete at ??:?
  #5  0x4016041b:0x3ffd3700 in ppTask at ??:?

ELF file SHA256: 37fb5fdfea2ced21

Rebooting...

[main.cpp]

#include <WebServer.h>
#include <WiFi.h>
#include <esp32cam.h>

const char* WIFI_SSID = "*********";       // Wi-Fi name
const char* WIFI_PASS = "*********";   // Wi-Fi password

WebServer server(80);      // Create a WebServer object with 80 ports
static auto hiRes = esp32cam::Resolution::find(800, 600); // Set the resolution of 800*600

void handleMjpeg(){        // Process MJPEG request
  esp32cam::Camera.changeResolution(hiRes);
  WiFiClient client = server.client();
  int res = esp32cam::Camera.streamMjpeg(client);
}

void setup(){ //initialization
  Serial.begin(115200);
  Serial.println();
  pinMode(4, OUTPUT);
  digitalWrite(4,HIGH); // LED lights light up
  {
    using namespace esp32cam;
    Config cfg;
    cfg.setPins(pins::AiThinker);
    cfg.setResolution(hiRes);
    cfg.setBufferCount(2);
    cfg.setJpeg(80);
    bool ok = Camera.begin(cfg);
  }
  WiFi.persistent(false);
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS); // Connect wi-fi
  while(WiFi.status() != WL_CONNECTED) { // Waiting for the connection successfully
    delay(500);
    Serial.print(".");
  }
  Serial.println("Copy link to the browser open");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println("/");
  server.on("/", handleMjpeg); // Set the MJPEG request interface
  server.begin();
  Serial.println("loading finished");
  digitalWrite(4,LOW);// Initialize the LED light goes off
}
void loop() {
  server.handleClient();
}

[platformio.ini]

[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
lib_deps =  yoursunny/esp32cam

upload_speed = 921600
upload_protocol = esptool
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
monitor_filters = esp32_exception_decoder