micropython-camera-driver
micropython-camera-driver copied to clipboard
crash when trying to init the camera (AIThinker esp32-cam)
Got the crash below using:
- micropython-camera-driver f56e12a587456d4371ecbd6601b3889e636896f8
- micropython tag: v1.18
- esp-idf-v4.3.1 tag: v4.3.1
- esp32-camera tag: v2.0.0
The crash was in cam_hal.c
251: cam_obj->dma_buffer = NULL; 252: cam_obj->dma = NULL; 253: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 254: cam_obj->frames = (cam_frame_t *)heap_caps_calloc(1, cam_obj->frame_cnt * sizeof(cam_frame_t), MALLOC_CAP_DEFAULT); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 255: CAM_CHECK(cam_obj->frames != NULL, "frames malloc failed", ESP_FAIL); 256: 257: uint8_t dma_align = 0;
here is the stack trace:
0x40093a6a: compare_and_set_native at /home/raul/github/esp-idf-v4.3.1/components/esp_hw_support/include/soc/compare_set.h:33 (inlined by) spinlock_acquire at /home/raul/github/esp-idf-v4.3.1/components/esp_hw_support/include/soc/spinlock.h:103 (inlined by) vPortCPUAcquireMutex at /home/raul/github/esp-idf-v4.3.1/components/freertos/port/xtensa/include/freertos/portmacro.h:158 (inlined by) vPortEnterCritical at /home/raul/github/esp-idf-v4.3.1/components/freertos/port/xtensa/port.c:448 0x40095f40: multi_heap_internal_lock at /home/raul/github/esp-idf-v4.3.1/components/heap/multi_heap.c:152 (inlined by) multi_heap_malloc_impl at /home/raul/github/esp-idf-v4.3.1/components/heap/multi_heap.c:196 0x40081af4: heap_caps_malloc at /home/raul/github/esp-idf-v4.3.1/components/heap/heap_caps.c:145 0x40081d32: heap_caps_calloc at /home/raul/github/esp-idf-v4.3.1/components/heap/heap_caps.c:395 0x400dabb6: cam_dma_config at /home/raul/github/esp-idf-v4.3.1/components/esp32-camera/driver/cam_hal.c:254 (inlined by) cam_config at /home/raul/github/esp-idf-v4.3.1/components/esp32-camera/driver/cam_hal.c:363 0x400da379: esp_camera_init at /home/raul/github/esp-idf-v4.3.1/components/esp32-camera/driver/esp_camera.c:251 0x400d253c: camera_init_helper at modcamera.c:? 0x400d259a: camera_init at modcamera.c:? 0x400e461d: fun_builtin_var_call at /home/raul/github/micropython/py/objfun.c:126 (inlined by) fun_builtin_var_call at /home/raul/github/micropython/py/objfun.c:112 0x400eab6d: mp_call_function_n_kw at /home/raul/github/micropython/py/runtime.c:664 0x400eaca5: mp_call_method_n_kw at /home/raul/github/micropython/py/runtime.c:680 0x40085999: mp_execute_bytecode at /home/raul/github/micropython/py/vm.c:1008 0x400e45ba: fun_bc_call at /home/raul/github/micropython/py/objfun.c:289 0x400eab6d: mp_call_function_n_kw at /home/raul/github/micropython/py/runtime.c:664 0x400eac1d: mp_call_function_0 at /home/raul/github/micropython/py/runtime.c:638 (inlined by) mp_parse_compile_execute at /home/raul/github/micropython/py/runtime.c:1519 0x40104a25: do_load_from_lexer at /home/raul/github/micropython/py/builtinimport.c:157 (inlined by) do_load at /home/raul/github/micropython/py/builtinimport.c:247 0x40104cb0: process_import_at_level at /home/raul/github/micropython/py/builtinimport.c:446 (inlined by) mp_builtin___import__ at /home/raul/github/micropython/py/builtinimport.c:540 0x400ead24: mp_import_name at /home/raul/github/micropython/py/runtime.c:1427 0x40085c35: mp_execute_bytecode at /home/raul/github/micropython/py/vm.c:1199 0x400e45ba: fun_bc_call at /home/raul/github/micropython/py/objfun.c:289 0x400eab6d: mp_call_function_n_kw at /home/raul/github/micropython/py/runtime.c:664 0x400eab96: mp_call_function_0 at /home/raul/github/micropython/py/runtime.c:638 0x4011a635: parse_compile_execute at /home/raul/github/micropython/shared/runtime/pyexec.c:116 0x4011a99c: pyexec_friendly_repl at /home/raul/github/micropython/shared/runtime/pyexec.c:662 0x400fac24: mp_task at /home/raul/github/micropython/ports/esp32/build-ESP32_CAM/../main.c:170
Any idea what could be wrong?
I got similar results with 4.2.2
/home/raul/github/esp-idf/components/soc/include/soc/compare_set.h:28 /home/raul/github/esp-idf/components/heap/multi_heap.c:382 /home/raul/github/esp-idf/components/heap/heap_caps.c:145 /home/raul/github/esp-idf/components/heap/heap_caps.c:395 /home/raul/github/esp-idf/components/esp32-camera/driver/cam_hal.c:254 /home/raul/github/esp-idf/components/esp32-camera/driver/esp_camera.c:251 modcamera.c:? modcamera.c:? /home/raul/github/micropython/py/objfun.c:126 /home/raul/github/micropython/py/runtime.c:664 /home/raul/github/micropython/py/runtime.c:680 /home/raul/github/micropython/py/vm.c:1008 /home/raul/github/micropython/py/objfun.c:289 /home/raul/github/micropython/py/runtime.c:664 /home/raul/github/micropython/py/runtime.c:638 /home/raul/github/micropython/shared/runtime/pyexec.c:116 /home/raul/github/micropython/shared/runtime/pyexec.c:662 /home/raul/github/micropython/ports/esp32/build-ESP32_CAM/../main.c:170
i have the problem too. sdkconfig: CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y CONFIG_ESP32_REV_MIN_0=y
CONFIG_ESP32_REV_MIN_1 is not set
CONFIG_ESP32_REV_MIN_2 is not set
CONFIG_ESP32_REV_MIN_3 is not set
CONFIG_ESP32_REV_MIN=0 CONFIG_ESP32_DPORT_WORKAROUND=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 CONFIG_ESP32_SPIRAM_SUPPORT=y
SPI RAM config
CONFIG_SPIRAM_TYPE_AUTO=y
CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
CONFIG_SPIRAM_SIZE=-1
CONFIG_SPIRAM_SPEED_40M is not set
CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
CONFIG_SPIRAM_USE_MEMMAP is not set
CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
CONFIG_SPIRAM_USE_MALLOC=y CONFIG_SPIRAM_MEMTEST=y CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set
CONFIG_SPIRAM_CACHE_WORKAROUND=y