s60sc / ESP32-CAM_MJPEG2SD

ESP32 Camera motion capture application to record JPEGs to SD card as AVI files and stream to browser as MJPEG. If a microphone is installed then a WAV file is also created. Files can be uploaded via FTP or downloaded to browser.
GNU Affero General Public License v3.0
939 stars 216 forks source link

Enabling "Use Pir for Detection"(under peripherals) triggers "StartUp Failure: Crash Loop Detected" #494

Closed ChandrachurMaitra closed 1 month ago

ChandrachurMaitra commented 1 month ago

Greetins to all, Im new here and need some help, as per README file, I have selected AI thinker model (ESP32-S) and commented other boards, and flashed my ai thinker by selecting partition scheme as "Minimal SPIFFS with OTA" (this does not fix this problem) and also tried Huge App partition scheme, that even does not solve this error.

Error details:
FIRST OF ALL ENABLING the "USE PIR for DETECTION" triggering the StartUp Failure: crash loop detected" problem, here is a short story with the LOG error DATA.
pir cam error when enabling the pir detection option.txt

when after Flashing the esp32, connecting it with my router and streaming over chrome, till this point it's working so good. But I want to use the PIR motion sensor, so as per your guidance I done "#define INCLUDE PERIPH true" (needless to say to use this feature I EVEN HAD TO WRITE TRUE FOR THE #DEFINE INCLUDE_MCPWM, OTHERWISE COMPILATION GETTING ERROR!!)

@HERE IS MY LIST-->

define INCLUDE_FTP_HFS true // ftp.cpp (file upload)

define INCLUDE_TGRAM false // telegram.cpp (Telegram app interface)

define INCLUDE_AUDIO false // audio.cpp (microphones & speakers)

define INCLUDE_PERIPH true // peripherals.cpp (servos, PIR, led etc)

define INCLUDE_SMTP false // smtp.cpp (email)

define INCLUDE_MQTT false // mqtt.cpp (MQTT)

define INCLUDE_CERTS false // certificates.cpp (https and server certificate checking)

define INCLUDE_UART false // uart.cpp (use another esp32 as Auxiliary connected via UART)

define INCLUDE_TELEM false // telemetry.cpp (real time data collection)

define INCLUDE_WEBDAV true // webDav.cpp (WebDAV protocol)

define INCLUDE_EXTHB false // externalHeartbeat.cpp (heartbeat to remote server)

define INCLUDE_PGRAM true // photogram.cpp (photogrammetry feature). Needs INCLUDE_PERIPH true

define INCLUDE_MCPWM true // mcpwm.cpp (BDC motor control). Needs INCLUDE_PERIPH true

define INCLUDE_DS18B20 false

AFTER that I went to chrome and assign the "pin for pir 13 (even I tried with 14 and 3 but still crash loop detected error)" and rebooted it but it's working without any problem BUT AS SOON AS I ENABLE THE USE PIR FOR DETECTION OPTION THEN AFTER REBOOTING THE AI THINKER, AND REFRESHIN THE WEB PAGE IT'S SHOWING "STARTUP FAILURE: CRASH LOOP DETECTED", please help me to solve it.

N:B--> The only way to avoid/fix the crash loop detected error after this is to follow the URL http://192.168.4.1/control?deldata=1 and this deleted the config and all then download fresh files then the problem solved but if again I eneble that Pir option it will trigger the problem please solve it.

*****HERE IS THE LOG (SERIAL MONITOR DATA)**

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:4832 load:0x40078000,len:16460 load:0x40080400,len:4 load:0x40080404,len:3504 entry 0x400805cc

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

Core 0 register dump: PC : 0x4008de78 PS : 0x00060f30 A0 : 0x801c993e A1 : 0x3ffb9220
A2 : 0x00000001 A3 : 0xfffffffd A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x801d4568 A9 : 0x3ffb91e0
A10 : 0x3ffc9f39 A11 : 0x3ffcb220 A12 : 0x0000000c A13 : 0x3ffbcda0
A14 : 0x0000000c A15 : 0x00060023 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000001 LBEG : 0x4008de99 LEND : 0x4008dea9 LCOUNT : 0xfffffffc

Backtrace: 0x4008de75:0x3ffb9220 0x401c993b:0x3ffb9230 0x401d0abe:0x3ffb9550 0x401d0afa:0x3ffb95e0 0x400dcb83:0x3ffb9620 0x40094166:0x3ffb9640

ELF file SHA256: 7f4bbccd0abae06e

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0030,len:4832 load:0x40078000,len:16460 load:0x40080400,len:4 load:0x40080404,len:3504 entry 0x400805cc [00:00:01.714 logSetup] Setup RAM based log, size 7168, starting from 0 [00:00:01.715 logSetup] =============== ESP-CAM_MJPEG 10.2.1 =============== [00:00:01.725 logSetup] Compiled with arduino-esp32 v3.0.5 [00:00:01.725 printResetReason] Software reset due to exception/panic [00:00:01.735 printWakeupReason] Wakeup by reset [00:00:01.786 infoSD] SD card type SDHC, Size: 3.8GB [00:00:01.786 listFolder] Sketch size 1.6MB [00:00:02.126 listFolder] File: /data/configs.txt, size: 7283 bytes [00:00:02.132 listFolder] File: /data/common.js, size: 46093 bytes [00:00:02.139 listFolder] File: /data/MJPEG2SD.htm, size: 97KB [00:00:02.139 listFolder] SD_MMC: 317.2MB used of 3.7GB [00:00:02.139 loadConfig] Load config [00:00:02.455 updateAppStatus] Enabling motion detection [00:00:02.457 setupLamp] Setup PWM Lamp Led on pin 4 [00:00:02.463 setup] PSRAM size: 4.0MB [00:00:02.656 prepCam] Camera init OK for model OV2640 on board CAMERA_MODEL_AI_THINKER [00:00:02.912 setWifiSTA] Wifi Station IP from DHCP ..[00:00:03.932 onWiFiEvent] WiFi Station disconnected [00:00:03.989 onWiFiEvent] WiFi Station connection to Chand, using hostname: ESP-CAM_MJPEG_143AF1BD9E7C [00:00:04.023 onWiFiEvent] Wifi Station IP, use 'http://192.168.233.22' to connect [00:00:04.443 onWiFiEvent] Wifi AP SSID: ESP-CAM_MJPEG_143AF1BD9E7C started, use 'http://192.168.4.1' to connect [00:00:07.466 startWifi] Wifi stats for Chand - signal strength: -47 dBm; Encryption: WPA2_PSK; channel: 6 [00:00:07.467 startPing] Started ping monitoring - On [00:00:07.475 resetWatchDog] WatchDog started using task: ping [00:00:07.478 getLocalNTP] Using NTP server: pool.ntp.org [00:00:07.481 startWebServer] Starting web server on port: 80 [00:00:07.489 WARN getLocalNTP] Not yet synced with NTP [00:00:07.489 startWebServer] Remote server certificates not checked [00:00:07.500 WARN setup] Startup Failure: Crash loop detected, check log [00:00:07.510 loop] =============== Total tasks: 13 ===============

[08:00:28.304 getLocalNTP] Using NTP server: pool.ntp.org [08:00:28.305 showLocalTime] Got current time from NTP: 30/09/2024 08:00:28 with tz: GMT0 [08:00:58.333 setAlarm] Alarm scheduled at 01/10/2024 01:00:00 [08:01:00.576 getExtIP] External IP: 47.11.84.123 [08:01:00.579 doAppPing] Daily rollover [08:04:58.335 isNight] Night time

s60sc commented 1 month ago

Thanks for detailed report. Crash and compilation error should be fixed in latest 10.2.2 download

ChandrachurMaitra commented 1 month ago

Thanks for detailed report. Crash and compilation error should be fixed in latest 10.2.2 download

But sir, mine is not compilation error it's crashing (crash loop detected) as soon as I turn on the "Use Pir Detection" option from web page under "Peripherals"

s60sc commented 1 month ago

download latest version

ChandrachurMaitra commented 1 month ago

Thank u so much Sir for your time, effort and love for followers 😊.

Im now trying to flash the new v10.2.2 on my Ai thinker and will update you if I found any issues

rjsachse commented 1 month ago

The issue with the ESP32-CAM is that many of the pins are already pulled high. The best option would be to use RX2 (GPIO 16) since pins 12, 13, 14, 15, 2, 4, 1, and 3 are not suitable. On the ESP32-CAM, only pin 16 will work with a PIR sensor that pulls high. However, you need to change the code and make a hardware modification to pull the signal low, potentially using pins 12, 14, or 4. Note that pin 16 is not an interrupt pin, so you would need to check if the code is polling the pin or using interrupts.

For a hardware modification, you would need to use a transistor to invert the signal and adjust the code accordingly. The ESP32-CAM has very limited pins available for use.