Skip to content

fix(cam_hal): throttle WARN spam so cam_task reduces it's stack footprint #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RubenKelevra
Copy link

@RubenKelevra RubenKelevra commented Jul 1, 2025

Description

Precondition: Merge of #758


Background

• Every bad frame produced an ESP_LOGW():

  • “Unexpected NULL frame …” (non-S3)
  • “NO-EOI – JPEG end marker missing”

• Each ESP_LOGW() invokes vsnprintf() once ⇒ ~300 B of stack for that call.

What’s changed

  • First occurrence of each warning:
    ESP_DRAM_LOGW_ONCE() → zero stack after the first print.
  • Subsequent occurrences:
    count with a uint16_t and emit a literal ESP_LOGW() only
    every 100th event (~ 60 B stack usage).
  • Counters auto-reset at 10 000 to avoid wraparound.
  • On ESP32-S3 the “Giving up GDMA reset…” message is also moved to
    ESP_DRAM_LOGW_ONCE() to avoid stack usage.

Effects

  • Occasional diagnostics are still available: first warning and then a
    summary every 100 events.

Related

Thanks to @turenkomv who reported this issue here.

Testing

@turenkomv would you be so kind and would test this on your hardware? Tag is fixes_for_m5_0.4, which is the currently used version in ESPHome with all four patches on top.

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass. (?)
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

               – prevents stack-overflow in cam_task

The old cam_take() used recursion to retry if
* no JPEG EOI was found or
* a NULL frame pointer was returned (GDMA glitch on ESP32-S3).

Under heavy loss conditions this could overflow the cam_task stack
and reboot the whole system.

* Re-wrote cam_take() as a single while-loop – stack depth is now
  constant and independent of retry count.
* Added strict timeout tracking (`remaining = timeout - elapsed`);
  function can never block longer than the caller’s timeout.
* ESP32-S3 only
  * capped GDMA reset storms to 3 attempts (`MAX_GDMA_RESETS`)
  * logs one “giving up” warning, then yields (`vTaskDelay(1)`)
    to avoid busy-spin after hardware is wedged.
* Non-S3 targets
  * emit early `ESP_LOGW` when a NULL frame ever appears,
    then yield one tick per loop to prevent CPU thrash.
* Maintained existing JPEG-EOI trimming and YUV→GRAY memcpy paths;
  behaviour unchanged on successful frames.
* Inline comment links to esp32-camera commit 984999f / issue espressif#620
  for future context.
@turenkomv
Copy link

I can't build now — getting this error: undefined reference to `ESP_DRAM_LOGW_ONCE'

C:/Users/turen/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: .pioenvs/m5stack-camera-1/esp-idf/espressif__esp32-camera/libespressif__esp32-camera.a(cam_hal.c.o):(.literal.cam_take+0x1c): undefined reference to `ESP_DRAM_LOGW_ONCE'
C:/Users/turen/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: .pioenvs/m5stack-camera-1/esp-idf/espressif__esp32-camera/libespressif__esp32-camera.a(cam_hal.c.o): in function `cam_take':
C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:526:(.text.cam_take+0x74): undefined reference to `ESP_DRAM_LOGW_ONCE'
C:/Users/turen/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:555:(.text.cam_take+0xb3): undefined reference to `ESP_DRAM_LOGW_ONCE'

I'm using ESPHome 2025.7.0-dev

PLATFORM: Espressif 32 (53.3.13) > Espressif ESP32-S3-DevKitM-1
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf @ 3.50302.0 (5.3.2)
 - tool-cmake @ 3.30.2
 - tool-esptoolpy @ 4.8.6
 - tool-mklittlefs @ 3.2.0
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 14.2.0+20240403
 - tool-xtensa-esp-elf-gdb @ 14.2.0+20240403
 - toolchain-esp32ulp @ 2.35.0-20220830
 - toolchain-riscv32-esp @ 13.2.0+20240530
 - toolchain-xtensa-esp-elf @ 13.2.0+20240530

@RubenKelevra
Copy link
Author

Woops :D

@RubenKelevra RubenKelevra force-pushed the reduce-camera-log-stack-usage branch 2 times, most recently from 74e41d5 to 4092742 Compare July 1, 2025 20:19
Background
----------
• Every bad frame produced an ESP_LOGW():
      - “Unexpected NULL frame …”   (non-S3)
      - “NO-EOI – JPEG end marker missing”
• Each ESP_LOGW() invokes vsnprintf() once ⇒ ~300 B of stack for that call.

What’s changed
--------------
* First occurrence of each warning:
      ESP_DRAM_LOGW_ONCE()  → zero stack after the first print.
* Subsequent occurrences:
      count with a uint16_t and emit a **literal** ESP_LOGW() only
      every 100th event (~ 60 B stack usage).
* Counters auto-reset at 10 000 to avoid wraparound.
* On ESP32-S3 the “Giving up GDMA reset…” message is also moved to
  ESP_DRAM_LOGW_ONCE() to avoid stack usage.

Effects
-------
* Occasional diagnostics are still available: first warning and then a
  summary every 100 events.
@RubenKelevra RubenKelevra force-pushed the reduce-camera-log-stack-usage branch from 4092742 to c439f08 Compare July 1, 2025 20:24
@RubenKelevra
Copy link
Author

Sorry, my brain mixed up the name with the behavior, that it will only fire "once" ;)

It should be fixed now under the tag fixes_for_m5_0.4.2.

I think I need a break :)

//currently this is used only for YUV to GRAYSCALE

if (warn_eoi_miss_cnt == 0) {
ESP_DRAM_LOGW(TAG, "NO-EOI – JPEG end marker missing");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this use might give issues on older cores ESP_DRAM_LOGW. You have correctly used ESP_LOGW in the other cases

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which compatibility does this project need maintain?

@turenkomv
Copy link

turenkomv commented Jul 1, 2025

Looks like it got worse — now I’m getting the old error too:

[23:34:48]cam_hal: EV-EOF-OVF
[23:34:48]Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception). 
[23:34:48]Debug exception reason: Stack canary watchpoint triggered (cam_task) 
[23:34:48]Core  0 register dump:
[23:34:48]PC      : 0x4037f220  PS      : 0x00060e36  A0      : 0x4037a74d  A1      : 0x3fcb26d0  
[23:34:48]A2      : 0x3fcb298c  A3      : 0x00000010  A4      : 0x00000000  A5      : 0xffffffff  
[23:34:48]A6      : 0x00000000  A7      : 0x00000001  A8      : 0x00000000  A9      : 0x00000004  
[23:34:48]A10     : 0x3fcb27a0  A11     : 0x00000000  A12     : 0x00000000  A13     : 0x00000000  
[23:34:48]A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x00000004  EXCCAUSE: 0x00000001  
[23:34:48]EXCVADDR: 0x00000000  LBEG    : 0x40056fc5  LEND    : 0x40056fe7  LCOUNT  : 0xffffffff  
[23:34:48]
[23:34:48]
[23:34:48]Backtrace: 0x4037f21d:0x3fcb26d0 0x4037a74a:0x3fcb2ab0 0x4208b176:0x3fcb2b40 0x4200fd19:0x3fcb2b80 0x4200f97d:0x3fcb2bc0 0x42016a4a:0x3fcb2ca0 0x420a4ac1:0x3fcb2ce0 0x403845b2:0x3fcb2d10 0x4201a52e:0x3fcb2d60
C:\Projects\xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32\xtensa-esp32s3-elf\bin>xtensa-esp32s3-elf-addr2line -pfiaC -e C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1\.pioenvs\m5stack-camera-1\firmware.elf 0x4037f21d 0x4037a74a 0x4208b176 0x4200fd19 0x4200f97d 0x42016a4a 0x420a4ac1 0x403845b2 0x4201a52e
0x4037f21d: _frxt_setup_switch at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/portasm.S:105
0x4037a74a: _xt_lowint1 at C:\Users\turen\.platformio\packages\framework-espidf\components\xtensa/xtensa_vectors.S:1225
0x4208b176: vsnprintf at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp-elf/src/newlib/newlib/libc/stdio/vsnprintf.c:40 (discriminator 1)
0x4200fd19: esphome::logger::TaskLogBuffer::send_message_thread_safe(unsigned char, char const*, unsigned short, tskTaskControlBlock*, char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/task_log_buffer.cpp:67
0x4200f97d: esphome::logger::Logger::log_vprintf_(unsigned char, char const*, int, char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.cpp:50 (discriminator 1)
0x42016a4a: esphome::esp_idf_log_vprintf_(char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/core/log.cpp:56
0x420a4ac1: esp_log_writev at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:210
0x403845b2: esp_log_write at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:220
0x4201a52e: cam_verify_jpeg_soi at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:54 (discriminator 1)
 (inlined by) cam_task at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:171 (discriminator 1)

And something new as well:

[23:40:20]cam_hal: EV-EOF-OVF
[23:40:20]cam_hal: EV-EOF-OVF
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception). 
[23:40:20]Debug exception reason: Stack canary watchpoint triggered (cam_task) 
[23:40:20]Guru Meditation Error: Core  0 panic'ed (InstrFetchProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040a36  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403fd976  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x8237377a  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x1f2084a4  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040536  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x413fce84  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x3077bd2d  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x420335ad  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x420335ad  PS      : 0x00060234  A0      : 0x820332e0  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x420335ad  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x6fc63130  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x2d2cb778  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040536  A0      : 0x81b62c2e  A1      : 0x3fcb0590  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (LoadStoreError). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0xba2c2fbb  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x71cf6f3a  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x4038a682  PS      : 0x00040836  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040e36  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040336  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040836  A0      : 0xc47f3735  A1      : 0x3fcaf7a0  
[23:40:20]A2      : 0x3d3dd87a  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x420335ad  
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0xca343636  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x420335ad  PS      : 0x00060f34  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040d36  A0      : 0x8530302f  A1      : 0x3fcae8c0  
[23:40:20]A2      : 0x42403f84  A3      : 0x41438ace  A4      : 0x4280d386  A5      : 0x40d87c42  
[23:40:20]A6      : 0xd96dd840  A7      : 0x68d93e3d  A8      : 0x2a28b572  A9      : 0x272882b4  
[23:40:20]A10     : 0x277bb428  A11     : 0x2ebe722a  A12     : 0xb76c292b  A13     : 0x81b02627  
[23:40:20]�޲��;N�"���.2��������﹌+�(n�蓯 t��^����+0�
[23:40:20]�������2���ښ������������ʲ�箦հ��j���|�����*��Ϫ��������宭�҂�b���X����&-r,���΢	^�j����.�����z����`[�����"����������>þ?�����r������O��j�������h��돈�~���J����������:*�ᨪ�9�{舮�N�z��B���n��b��+���ﯨ��P���7�B��z*Z���2��2�I�������z/^����^��:��R�������N
[23:40:20]����⨸���*�J���ު�������ډ�7� ��������������������껆�������;����������6�����3�`���7��������x���F��
[23:40:20]�޳��;N�"���.2��������﹈+�(n���� ���^����0�
[23:40:20]������2����ک����������ڲ�禦մ��j���|�����*��Ϫ������������҂�b���Z����&-r,���΢	^�j���Z.�����z����`[�����"��~�������=þ?�����r������+O��j�������h��니�~���J�������������ᨪ���{h���N�z��B�����b��+��ﯨ��P��3�B��z�Z���2��2�I�������z/^����^�ˏ:���R�������N
[23:40:20]+n�����
[23:40:20]�*���:���.�ٺ��*�������گB��M������i����Ϫ����"�������2��m�趪�"��쀪�����j�:��������oW������
[23:40:20]�޲��;N�����>2���خ���﹌+�(.���� ���^���� �
[23:40:20]�����������޺����: 0x426eda69  Guru Meditation Error: Core  0 panic'ed (Double exception). 
[23:40:20]
[23:40:20]Core  0 register dump:
[23:40:20]PC      : 0x403743c0  PS      : 0x00040236  A0      : 0xd978d843  A1      : 0x3fcae6a0  
[23:40:20]A2      : 0x00040236  A3      : 0x00040026  A4      : 0x3fcae940  A5      : 0x3c0b14cb  
[23:40:20]A6      : 0x3fc9aa80  A7      : 0x3fcae790  A8      : 0x3fcae760  A9      : 0x3c0ca460  
[23:40:20]A10     : 0x3fcae800  A11     : 0x02100000  A12     : 0x3fcae680  A13     : 0xb12927b6  
[23:40:20]A14     : 0x3fca155c  A15     : 0x00000000  SAR     : 0x0000000c  EXCCAUSE: 0x00000002  
[23:40:20]EXCVADDR: 0x3c0ca460  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0x00000000  
[23:40:20]
[23:40:20]
[23:40:20]Backtrace: 0x403743bd:0x3fcae6a0 0x5978d840:0x3fcae720 |<-CORRUPTED
[23:40:20]
[23:40:20]
[23:40:20]Core  1 register dump:
[23:40:20]PC      : 0x4037af1e  PS      : 0x00060e34  A0      : 0x820323e8  A1      : 0x3fca9510  
[23:40:20]A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00060320  A5      : 0x00000000  
[23:40:20]A6      : 0x00000001  A7      : 0x00000020  A8      : 0x00000001  A9      : 0x3fca16b4  
[23:40:20]A10     : 0x00000001  A11     : 0x3fca96c0  A12     : 0x8037f0e2  A13     : 0x3fca9410  
[23:40:20]A14     : 0x00060023  A15     : 0x00000003  SAR     : 0x0000001e  EXCCAUSE: 0x00000007  
[23:40:20]EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
[23:40:20]
[23:40:20]
[23:40:20]Backtrace: 0x4037af1b:0x3fca9510 0x420323e5:0x3fca9530 0x4037fc2b:0x3fca9550
[23:40:20]
[23:40:20]
[23:40:20]
[23:40:20]
[23:40:20]ELF file SHA256: 09e632e1a
[23:40:20]
[23:40:20]Rebooting...
C:\Projects\xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32\xtensa-esp32s3-elf\bin>xtensa-esp32s3-elf-addr2line -pfiaC -e C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1\.pioenvs\m5stack-camera-1\firmware.elf 0x403743bd 0x5978d840
0x403743bd: _UserExceptionVector at ??:?
0x5978d840: ?? ??:0

C:\Projects\xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32\xtensa-esp32s3-elf\bin>xtensa-esp32s3-elf-addr2line -pfiaC -e C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1\.pioenvs\m5stack-camera-1\firmware.elf 0x4037af1b 0x420323e5 0x4037fc2b
0x4037af1b: xt_utils_wait_for_intr at C:\Users\turen\.platformio\packages\framework-espidf\components\xtensa\include/xt_utils.h:82
 (inlined by) esp_cpu_wait_for_intr at C:\Users\turen\.platformio\packages\framework-espidf\components\esp_hw_support/cpu.c:55
0x420323e5: esp_vApplicationIdleHook at C:\Users\turen\.platformio\packages\framework-espidf\components\esp_system/freertos_hooks.c:58
0x4037fc2b: prvIdleTask at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel/tasks.c:4353 (discriminator 1)

@RubenKelevra
Copy link
Author

RubenKelevra commented Jul 1, 2025

Well, looks switching to literal messages wasn't really successful, it seems to still use 300 B of stack space, due to running through ESPHome’s logger helper.

However, it now really catches on a different location, because I did not expect a logging flood from cam_verify_jpeg_soi(), which is now using up the stack.

But in the end, it may just be a good decision to increase the stack space, what do you think @me-no-dev?

@RubenKelevra
Copy link
Author

@turenkomv I've reduced the log spam of cam_verify_jpeg_soi() in PR #760 and create a tag to include the additional changes: fixes_for_m5_0.5

But I think we fixed probably most if not all "real" issues with the stack now. And just having the issue that all that log messages don't really fit in such a busy operation in the stack.

Please try it anyway, I want to see what's crashing now, so we may be able to reduce the stack usage further.

In the end, I think we need to configure just a larger stack usage.

Overall, I think I have identified what the fundamental issue is, why your device isn't "working" right now. But I like to take the opportunity to make sure error handling is working better, instead of fixing the root cause why it's not fetching the images properly.

Hope you understand. :)

@turenkomv
Copy link

[09:16:42]cam_hal: EV-EOF-OVF
[09:16:42]W cam_hal: NO-SOI - JPEG start marker missing
[09:16:42]cam_hal: EV-EOF-OVF
[09:16:42]cam_hal: EV-EOF-OVF
[09:16:42]cam_hal: EV-EOF-OVF
[09:16:43]cam_hal: EV-EOF-OVF
[09:16:43]cam_hal: EV-EOF-OVF
[09:16:43]cam_hal: EV-EOF-OVF
[09:16:43]cam_hal: EV-EOF-OVF
[09:16:43]cam_hal: EV-EOF-OVF
[09:16:44]cam_hal: EV-EOF-OVF
[09:16:44]cam_hal: EV-EOF-OVF
[09:16:44]cam_hal: EV-EOF-OVF
[09:16:44]cam_hal: EV-EOF-OVF
[09:16:44]cam_hal: EV-EOF-OVF
[09:16:45]cam_hal: EV-EOF-OVF
[09:16:45]cam_hal: EV-EOF-OVF
[09:16:45]cam_hal: EV-EOF-OVF
[09:16:45]cam_hal: EV-EOF-OVF
[09:16:45]cam_hal: EV-EOF-OVF
[09:16:46]cam_hal: EV-EOF-OVF
[09:16:46]cam_hal: EV-EOF-OVF
[09:16:46]cam_hal: EV-EOF-OVF
[09:16:46]Guru Meditation Error: Core  1 panic'ed (Unhandled debug exception). 
[09:16:46]Debug exception reason: Stack canary watchpoint triggered (framebuffer_tas) 
[09:16:46]Core  1 register dump:
[09:16:46]PC      : 0x4037ef4a  PS      : 0x00060036  A0      : 0x820485be  A1      : 0x3fcb2f70  
[09:16:46]A2      : 0x3fc9ad6c  A3      : 0xffffffff  A4      : 0x00000007  A5      : 0x3fcb2fae  
[09:16:46]A6      : 0x00000066  A7      : 0x00000064  A8      : 0x00060020  A9      : 0x3fcb2f70  
[09:16:46]A10     : 0x00060023  A11     : 0x00000000  A12     : 0x00060020  A13     : 0x00060a23  
[09:16:46]A14     : 0x00000000  A15     : 0x0000abab  SAR     : 0x00000018  EXCCAUSE: 0x00000001  
[09:16:46]EXCVADDR: 0x00000000  LBEG    : 0x40056fc5  LEND    : 0x40056fe7  LCOUNT  : 0xffffffff  
[09:16:46]
[09:16:46]
[09:16:46]Backtrace: 0x4037ef47:0x3fcb2f70 0x420485bb:0x3fcb2fa0 0x420486e1:0x3fcb2fc0 0x4200f969:0x3fcb2fe0 0x42016a56:0x3fcb30c0 0x420a4b55:0x3fcb3100 0x403845b2:0x3fcb3130 0x4201a7ca:0x3fcb3180 0x42019ce2:0x3fcb31c0 0x4200bc12:0x3fcb31e0
C:\Projects\xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32\xtensa-esp32s3-elf\bin>xtensa-esp32s3-elf-addr2line -pfiaC -e C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1\.pioenvs\m5stack-camera-1\firmware.elf 0x4037ef47 0x420485bb 0x420486e1 0x4200f969 0x42016a56 0x420a4b55 0x403845b2 0x4201a7ca 0x42019ce2 0x4200bc12
0x4037ef47: xPortSetInterruptMaskFromISR at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:552
 (inlined by) xPortEnterCriticalTimeout at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:478
0x420485bb: vPortEnterCritical at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:567
 (inlined by) find_key at C:\Users\turen\.platformio\packages\framework-espidf\components\pthread/pthread_local_storage.c:77
0x420486e1: pthread_setspecific at C:\Users\turen\.platformio\packages\framework-espidf\components\pthread/pthread_local_storage.c:199
0x4200f969: esphome::logger::Logger::check_and_set_task_log_recursion_(bool) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.h:298
 (inlined by) esphome::logger::Logger::check_and_set_task_log_recursion_(bool) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.h:287
 (inlined by) esphome::logger::Logger::log_vprintf_(unsigned char, char const*, int, char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.cpp:35
0x42016a56: esphome::esp_idf_log_vprintf_(char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/core/log.cpp:56
0x420a4b55: esp_log_writev at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:210
0x403845b2: esp_log_write at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:220
0x4201a7ca: cam_take at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:524 (discriminator 1)
0x42019ce2: esp_camera_fb_get at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/esp_camera.c:372
0x4200bc12: esphome::esp32_camera::ESP32Camera::framebuffer_task(void*) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/esp32_camera/esp32_camera.cpp:412

@turenkomv
Copy link

I increased the stack size using this config: CONFIG_CAMERA_TASK_STACK_SIZE: "65536"
And now I’m getting this: (trimmed out parts related to the Wi-Fi network)

[09:39:11]Rebooting...
[09:39:11]ESP-ROM:esp32s3-20210327
[09:39:11]Build:Mar 27 2021
[09:39:11]rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
[09:39:11]Saved PC:0x40383372
WARNING Decoded 0x40383372: systimer_ll_get_counter_value_low at C:\Users\turen\.platformio\packages\framework-espidf\components\hal\esp32s3\include/hal/systimer_ll.h:106
 (inlined by) systimer_hal_get_counter_value at C:\Users\turen\.platformio\packages\framework-espidf\components\hal/systimer_hal.c:61
[09:39:11]SPIWP:0xee
[09:39:11]mode:DIO, clock div:1
[09:39:11]load:0x3fce2810,len:0x1870
[09:39:11]load:0x403c8700,len:0x4
[09:39:11]load:0x403c8704,len:0xc40
[09:39:11]load:0x403cb700,len:0x2ee8
[09:39:11]entry 0x403c8900
[09:39:11]I (26) boot: ESP-IDF 5.3.2 2nd stage bootloader
[09:39:11]I (26) boot: compile time Jul  2 2025 09:37:53
[09:39:11]I (26) boot: Multicore bootloader
[09:39:11]I (27) boot: chip revision: v0.2
[09:39:11]I (27) boot: efuse block revision: v1.3
[09:39:11]I (27) boot.esp32s3: Boot SPI Speed : 80MHz
[09:39:11]I (27) boot.esp32s3: SPI Mode       : DIO
[09:39:11]I (27) boot.esp32s3: SPI Flash Size : 16MB
[09:39:11]I (28) boot: Enabling RNG early entropy source...
[09:39:11]I (28) boot: Partition Table:
[09:39:11]I (28) boot: ## Label            Usage          Type ST Offset   Length
[09:39:11]I (28) boot:  0 otadata          OTA data         01 00 00009000 00002000
[09:39:11]I (29) boot:  1 phy_init         RF data          01 01 0000b000 00001000
[09:39:11]I (29) boot:  2 app0             OTA app          00 10 00010000 007c0000
[09:39:11]I (30) boot:  3 app1             OTA app          00 11 007d0000 007c0000
[09:39:11]I (30) boot:  4 nvs              WiFi data        01 02 00f90000 0006d000
[09:39:11]I (31) boot: End of partition table
[09:39:11]I (31) esp_image: segment 0: paddr=00010020 vaddr=3c0b0020 size=2b32ch (176940) map
[09:39:11]I (63) esp_image: segment 1: paddr=0003b354 vaddr=3fc9a800 size=04cc4h ( 19652) load
[09:39:11]I (67) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=a4bach (674732) map
[09:39:11]I (187) esp_image: segment 3: paddr=000e4bd4 vaddr=3fc9f4c4 size=01418h (  5144) load
[09:39:11]I (189) esp_image: segment 4: paddr=000e5ff4 vaddr=40374000 size=167c8h ( 92104) load
[09:39:11]I (218) boot: Loaded app from partition at offset 0x10000
[09:39:11]I (219) boot: Disabling RNG early entropy source...
[09:39:11]I (220) octal_psram: vendor id    : 0x0d (AP)
[09:39:11]I (220) octal_psram: dev id       : 0x02 (generation 3)
[09:39:11]I (220) octal_psram: density      : 0x03 (64 Mbit)
[09:39:11]I (220) octal_psram: good-die     : 0x01 (Pass)
[09:39:11]I (221) octal_psram: Latency      : 0x01 (Fixed)
[09:39:11]I (221) octal_psram: VCC          : 0x01 (3V)
[09:39:11]I (221) octal_psram: SRF          : 0x01 (Fast Refresh)
[09:39:11]I (221) octal_psram: BurstType    : 0x01 (Hybrid Wrap)
[09:39:11]I (222) octal_psram: BurstLen     : 0x01 (32 Byte)
[09:39:11]I (222) octal_psram: Readlatency  : 0x02 (10 cycles@Fixed)
[09:39:11]I (222) octal_psram: DriveStrength: 0x00 (1/1)
[09:39:11]I (223) MSPI Timing: PSRAM timing tuning index: 5
[09:39:11]I (223) esp_psram: Found 8MB PSRAM device
[09:39:11]I (224) esp_psram: Speed: 80MHz
[09:39:11]I (224) cpu_start: Multicore app
[09:39:11]I (647) esp_psram: SPI SRAM memory test OK
[09:39:11]I (656) cpu_start: Pro cpu start user code
[09:39:11]I (656) cpu_start: cpu freq: 240000000 Hz
[09:39:11]I (656) app_init: Application information:
[09:39:11]I (657) app_init: Project name:     m5stack-camera-1
[09:39:11]I (657) app_init: App version:      2025.7.0-dev
[09:39:11]I (657) app_init: Compile time:     Jul  2 2025 09:37:26
[09:39:11]I (657) app_init: ELF file SHA256:  59a98c939...
[09:39:11]I (657) app_init: ESP-IDF:          5.3.2
[09:39:11]I (657) efuse_init: Min chip rev:     v0.0
[09:39:11]I (658) efuse_init: Max chip rev:     v0.99
[09:39:11]I (658) efuse_init: Chip rev:         v0.2
[09:39:12]I (658) heap_init: Initializing. RAM available for dynamic allocation:
[09:39:12]I (658) heap_init: At 3FCA4A70 len 00044CA0 (275 KiB): RAM
[09:39:12]I (658) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
[09:39:12]I (659) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
[09:39:12]I (659) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM
[09:39:12]I (659) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator
[09:39:12]I (660) spi_flash: detected chip: gd
[09:39:12]I (660) spi_flash: flash io: dio
[09:39:12]W (661) i2c: This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h`
[09:39:12]I (661) sleep: Configure to isolate all GPIO pins in sleep state
[09:39:12]I (662) sleep: Enable automatic switching of GPIO sleep configuration
[09:39:12]I (662) main_task: Started on CPU0
[09:39:12]I (663) main_task: Calling app_main()
[09:39:12][I][logger:171]: Log initialized
[09:39:12][C][safe_mode:082]: There have been 9 suspected unsuccessful boot attempts
[09:39:12][D][esp32.preferences:142]: Writing 1 items: 0 cached, 1 written, 0 failed
[09:39:12][I][app:049]: Running through setup()
[09:39:12][C][status_led:056]: Running setup
[09:39:12][D][esp-idf:000]: I (732) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
[09:39:12][D][esp32:117]: rtc: 1
[09:39:12][C][light:021]: Running setup for 'Status LED'
[09:39:12][D][status_led:039]: 'Status LED': Setting initial state
[09:39:12][D][status_led:050]: 'Status LED': Setting state OFF
[09:39:12][D][light:036]: 'Status LED' Setting:
[09:39:12][D][light:041]:   Color mode:
[09:39:12][D][esp-idf:000]: I (734) s3 ll_cam: DMA Channel=0
[09:39:12][D][esp-idf:000]: I (735) cam_hal: cam init ok
[09:39:12][D][esp-idf:000]: I (735) sccb: pin_sda 17 pin_scl 41
[09:39:12][D][esp-idf:000]: I (735) sccb: sccb_i2c_port=1
[09:39:12][D][esp-idf:000]: I (736) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
[09:39:12][D][esp-idf:000]: I (768) camera: Detected camera at address=0x1f
[09:39:12][D][esp-idf:000]: I (770) camera: Detected MEGA_CCM camera
[09:39:12][D][esp-idf:000]: I (770) camera: Camera PID=0x39e VER=0x00 MIDL=0x00 MIDH=0x00
[09:39:12][D][esp-idf:000]: I (1781) cam_hal: buffer_size: 16384, half_buffer_size: 1024, node_buffer_size: 1024, node_cnt: 16, total_cnt: 405
[09:39:12][D][esp-idf:000]: I (1781) cam_hal: Allocating 414720 Byte frame buffer in PSRAM
[09:39:12][D][esp-idf:000]: I (1782) cam_hal: cam config ok
[09:39:12][D][esp-idf:000]: I (1782) mega_ccm: set_framesize
[09:39:12][D][esp-idf:000]: W (1788) mega_ccm: Unsupported
[09:39:12][D][esp-idf:000]: W (1788) mega_ccm: Unsupported
[09:39:12][D][esp-idf:000]: W (1790) mega_ccm: Unsupported
[09:39:12][D][esp-idf:000]: W (1790) mega_ccm: Unsupported
[09:39:12][D][esp-idf:000]: W (1791) mega_ccm: Unsupported
[09:39:12][C][wifi:048]: Running setup
[09:39:12][D][esp-idf:000]: I (1793) pp: pp rom version: e7ae62f
[09:39:12][D][esp-idf:000]: I (1794) net80211: net80211 rom version: e7ae62f
[09:39:12][D][esp-idf:000]: I (1796) wifi:
[09:39:12][D][esp-idf:000]: wifi driver task: 3fcc7c34, prio:23, stack:6656, core=0
[09:39:12][D][esp-idf:000]:
[09:39:12][D][esp-idf:000][wifi]: I (1807) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init data frame dynamic rx buffer num: 32
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1808) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init static rx mgmt buffer num: 5
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1809) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init management short buffer num: 32
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1810) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init dynamic tx buffer num: 32
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1811) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init tx cache buffer num: 32
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1812) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init static tx FG buffer num: 2
[09:39:12][D][esp-idf:000][wifi]: 
[09:39:12][D][esp-idf:000][wifi]: I (1812) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init static rx buffer size: 1600
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1813) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init static rx buffer num: 10
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1814) wifi:
[09:39:12][D][esp-idf:000][wifi]: Init dynamic rx buffer num: 32
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000]: I (1815) wifi_init: rx ba win: 6
[09:39:12][D][esp-idf:000]: I (1816) wifi_init: accept mbox: 6
[09:39:12][D][esp-idf:000]: I (1816) wifi_init: tcpip mbox: 32
[09:39:12][D][esp-idf:000]: I (1816) wifi_init: udp mbox: 6
[09:39:12][D][esp-idf:000]: I (1816) wifi_init: tcp mbox: 6
[09:39:12][D][esp-idf:000]: I (1817) wifi_init: tcp tx win: 5760
[09:39:12][D][esp-idf:000]: I (1817) wifi_init: tcp rx win: 5760
[09:39:12][D][esp-idf:000]: I (1817) wifi_init: tcp mss: 1440
[09:39:12][D][esp-idf:000]: I (1817) wifi_init: WiFi IRAM OP enabled
[09:39:12][D][esp-idf:000]: I (1818) wifi_init: WiFi RX IRAM OP enabled
[09:39:12][C][wifi:061]: Starting
[09:39:12][C][wifi:061]:   Local MAC: 
[09:39:12][D][esp-idf:000][wifi]: I (1819) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
[09:39:12][D][esp-idf:000][wifi]: I (1856) wifi:
[09:39:12][D][esp-idf:000][wifi]: mode : sta ()
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1858) wifi:
[09:39:12][D][esp-idf:000][wifi]: enable tsf
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][esp-idf:000][wifi]: I (1860) wifi:
[09:39:12][D][esp-idf:000][wifi]: Set ps type: 1, coexist: 0
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][D][wifi:495]: Starting scan
[09:39:12][D][status_led:030]: Restoring light state OFF
[09:39:12][D][esp-idf:000][wifi]: I (1864) wifi:
[09:39:12][D][esp-idf:000][wifi]: Set ps type: 1, coexist: 0
[09:39:12][D][esp-idf:000][wifi]:
[09:39:12][W][component:240]: Component wifi set Warning flag: scanning for networks
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]W cam_hal: NO-SOI - JPEG start marker missing
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:12]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:13]cam_hal: EV-EOF-OVF
[09:39:14]cam_hal: EV-EOF-OVF
[09:39:14]cam_hal: EV-EOF-OVF
[09:39:14]cam_hal: EV-EOF-OVF
[09:39:14]cam_hal: EV-EOF-OVF
[09:39:15][D][wifi:516]: Found networks:
[09:39:15][I][wifi:553]: -  ▂▄▆█
[09:39:15][D][wifi:555]:     Channel: 11
[09:39:15][D][wifi:556]:     RSSI: -30 dB
[09:39:15][I][wifi:319]: Connecting to
[09:39:15][D][esp-idf:000][wifi]: W (4857) wifi:
[09:39:15][D][esp-idf:000][wifi]: Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15][D][esp-idf:000][wifi]: I (5205) wifi:
[09:39:15][D][esp-idf:000][wifi]: new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5207) wifi:
[09:39:15][D][esp-idf:000][wifi]: state: init -> auth (0xb0)
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5209) wifi:
[09:39:15][D][esp-idf:000][wifi]: state: auth -> assoc (0x0)
[09:39:15][D][esp-idf:000][wifi]: 
[09:39:15][D][esp-idf:000][wifi]: I (5216) wifi:
[09:39:15][D][esp-idf:000][wifi]: state: assoc -> run (0x10)
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15][D][esp-idf:000][wifi]: I (5231) wifi:
[09:39:15][D][esp-idf:000][wifi]: connected wit
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5232) wifi:
[09:39:15][D][esp-idf:000][wifi]: security: WPA2-PSK, phy: bgn, rssi: -30
[09:39:15][D][esp-idf:000][wifi]: 
[09:39:15][D][esp-idf:000][wifi]: I (5233) wifi:
[09:39:15][D][esp-idf:000][wifi]: pm start, type: 1
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5234) wifi:
[09:39:15][D][esp-idf:000][wifi]: dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5235) wifi:
[09:39:15][D][esp-idf:000][wifi]: set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15][D][esp-idf:000][wifi]: I (5245) wifi:
[09:39:15][D][esp-idf:000][wifi]: <ba-add>
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15][D][esp-idf:000][wifi]: I (5332) wifi:
[09:39:15][D][esp-idf:000][wifi]: AP's beacon interval = 102400 us, DTIM period = 1
[09:39:15][D][esp-idf:000][wifi]:
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:15]cam_hal: EV-EOF-OVF
[09:39:16]cam_hal: EV-EOF-OVF
[09:39:16]Guru Meditation Error: Core  1 panic'ed (Unhandled debug exception). 
[09:39:16]Debug exception reason: Stack canary watchpoint triggered (framebuffer_tas)
[09:39:16]Core  1 register dump:
[09:39:16]PC      : 0x4037ef4a  PS      : 0x00060436  A0      : 0x820485be  A1      : 0x3fca82e0  
WARNING Decoded 0x4037ef4a: xPortSetInterruptMaskFromISR at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:552
 (inlined by) xPortEnterCriticalTimeout at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:478
[09:39:16]A2      : 0x3fc9ad6c  A3      : 0xffffffff  A4      : 0x00000007  A5      : 0x3fca831e  
[09:39:16]A6      : 0x00000066  A7      : 0x00000064  A8      : 0x00060420  A9      : 0x3fca82e0
[09:39:16]A10     : 0x00060423  A11     : 0x00000000  A12     : 0x00060420  A13     : 0x00060e23
[09:39:16]A14     : 0x00000000  A15     : 0x0000abab  SAR     : 0x00000018  EXCCAUSE: 0x00000001
[09:39:16]EXCVADDR: 0x00000000  LBEG    : 0x40056fc5  LEND    : 0x40056fe7  LCOUNT  : 0xffffffff


[09:39:16]Backtrace: 0x4037ef47:0x3fca82e0 0x420485bb:0x3fca8310 0x420486e1:0x3fca8330 0x4200f969:0x3fca8350 0x42016a56:0x3fca8430 0x420a4b55:0x3fca8470 0x403845b2:0x3fca84a0 0x4201a7ca:0x3fca84f0 0x42019ce2:0x3fca8530 0x4200bc12:0x3fca8550
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x4037ef47: xPortSetInterruptMaskFromISR at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:552
 (inlined by) xPortEnterCriticalTimeout at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:478
WARNING Decoded 0x420485bb: vPortEnterCritical at C:\Users\turen\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa\include\freertos/portmacro.h:567
 (inlined by) find_key at C:\Users\turen\.platformio\packages\framework-espidf\components\pthread/pthread_local_storage.c:77
WARNING Decoded 0x420486e1: pthread_setspecific at C:\Users\turen\.platformio\packages\framework-espidf\components\pthread/pthread_local_storage.c:199
WARNING Decoded 0x4200f969: esphome::logger::Logger::check_and_set_task_log_recursion_(bool) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.h:298
 (inlined by) esphome::logger::Logger::check_and_set_task_log_recursion_(bool) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.h:287    
 (inlined by) esphome::logger::Logger::log_vprintf_(unsigned char, char const*, int, char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/logger/logger.cpp:35
WARNING Decoded 0x42016a56: esphome::esp_idf_log_vprintf_(char const*, __va_list_tag) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/core/log.cpp:56
WARNING Decoded 0x420a4b55: esp_log_writev at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:210
WARNING Decoded 0x403845b2: esp_log_write at C:\Users\turen\.platformio\packages\framework-espidf\components\log/log.c:220
WARNING Decoded 0x4201a7ca: cam_take at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/cam_hal.c:524 (discriminator 1)
WARNING Decoded 0x42019ce2: esp_camera_fb_get at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/managed_components/espressif__esp32-camera/driver/esp_camera.c:372
WARNING Decoded 0x4200bc12: esphome::esp32_camera::ESP32Camera::framebuffer_task(void*) at C:\Projects\m5stack-camera-1\.esphome\build\m5stack-camera-1/src/esphome/components/esp32_camera/esp32_camera.cpp:412




[09:39:17]ELF file SHA256: 59a98c939

@RubenKelevra
Copy link
Author

@turenkomv thanks! It's too warm to work right now, will look on these later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants