lemariva / uPyCam

Take a photo with an ESP32-CAM running MicroPython
https://lemariva.com/blog/2019/09/micropython-how-about-taking-photo-esp32
Apache License 2.0
140 stars 42 forks source link

camera.init causes reboot #15

Closed retsyo closed 2 years ago

retsyo commented 3 years ago

I have installed the firmware. Then in the REPL in Thonny Editor, the following code make esp32cam reboot. How can we fix it? Thanks

>>> import camera
>>> camera.init(0, format=camera.JPEG)  
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: Camera Init Failed
>>> camera.init(0, format=camera.JPEG)  
ESP_ERROR_CHECK failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x4009a48c
file: "/home/lemariva/esp/esp-idf/components/esp32-camera/driver/camera.c" line 452
func: i2s_init
expression: esp_intr_alloc(ETS_I2S0_INTR_SOURCE, ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM, &i2s_isr, NULL, &s_state->i2s_intr_handle)

ELF file SHA256: 0000000000000000

Backtrace: 0x40099dc4:0x3ffd7290 0x4009a48f:0x3ffd72b0 0x4017315e:0x3ffd72d0 0x4017382d:0x3ffd7380 0x400f9d81:0x3ffd73b0 0x400e43fa:0x3ffd7420 0x400e0135:0x3ffd7450 0x400e0276:0x3ffd7470 0x400ee713:0x3ffd7490 0x400e44c8:0x3ffd7530 0x400e0135:0x3ffd7590 0x400e015e:0x3ffd75b0 0x40104e84:0x3ffd75d0 0x40104f79:0x3ffd7660 0x400f7fe1:0x3ffd7690 0x40091699:0x3ffd76c0

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5180
load:0x40078000,len:14032
load:0x40080400,len:3800
entry 0x4008063c
ronsims2 commented 3 years ago

I am having the same issue but only when trying to call camera.init while I also have a web server running. This doesn't work: https://github.com/ronsims2/esp32cam/blob/main/main.py

But this does work: https://github.com/ronsims2/esp32cam/blob/main/test.py

ronsims2 commented 3 years ago

I am wondering if the garbage collector I invoked in my boot.py is disposing of things I don't want it too...

lemariva commented 2 years ago

Error 0x105 means the camera was not found. Check the PIN description of the camera and if it still doesn't work, consider changing the module. The camera module breaks amazingly fast. :(