Esp32S3 : Interrupt throws an "Interrupt wdt timeout on CPU0"

ThomasESP32
Posts: 282
Joined: Thu Jul 14, 2022 5:15 am

Esp32S3 : Interrupt throws an "Interrupt wdt timeout on CPU0"

Postby ThomasESP32 » Wed Sep 17, 2025 9:33 am

Good morning,

I am working on a firmware running on an Esp32S3.
This firmware has many tasks running on two cores CPU0 and CPU1 + one program (In C) running on the ULP RISC-V.

Every 2ms, the ULP program is triggering on interrution on CPU0, which uses the SPI link to get a value from one register
of a chip. The following functions are used to get the value from the chip register :

spi_device_acquire_bus(DeviceHandle, portMAX_DELAY);
spi_device_polling_transmit(DeviceHandle, &Transaction);
spi_device_release_bus(DeviceHandle);

The instruction executed by the ULP program to trigger the interrupt is :
SET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_SW_CPU_INT);

The problem is the following :
When the interrupt is triggered one time => Everything is OK
But when the interrupt is triggered periodically (Every 2ms), the program running on the CPUs (0 or 1) crashes.

I always get vPortExitCritical + vPortClearInterruptMaskFromISR errors.
Here is the decoded backtrace of the program when it crashes :

Core 0 was running in ISR context:
EPC1 : 0x40041a6b EPC2 : 0x00000000 EPC3 : 0x400559e0 EPC4 : 0x40382fcc
--- 0x40041a6b: hci_le_ltk_req_neg_reply_cmd_handler in ROM
--- 0x400559e0: r_rwip_init in ROM
--- 0x40382fcc: vListInsert at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/list.c:183 (discriminator 3)

Backtrace: 0x40382fc9:0x3fc9d0a0 0x40383aed:0x3fc9d0c0 0x40382414:0x3fc9d0e0 0x4037be9d:0x3fc9d120 0x4037cc3b:0x3fc9d140 0x4200cf0a:0x3fc9d160 0x4200cf82:0x3fc9d1e0 0x4200a722:0x3fc9d210 0x40376454:0x3fc9d230 0x4037a931:0x3fc9d250 0x400559dd:0x3fcb7700 0x4038279e:0x3fcb7710 0x420686fd:0x3fcb7730 0x4200b708:0x3fcb7770 0x4200b791:0x3fcb77b0
--- 0x40382fc9: vListInsert at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/list.c:200
--- 0x40383aed: vTaskPlaceOnEventList at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/tasks.c:3769 (discriminator 1)
--- 0x40382414: xQueueSemaphoreTake at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/queue.c:1829
--- 0x4037be9d: dev_wait at C:/Espressif/frameworks/esp-idf-v5.3.1/components/esp_hw_support/spi_bus_lock.c:575
--- (inlined by) spi_bus_lock_acquire_start at C:/Espressif/frameworks/esp-idf-v5.3.1/components/esp_hw_support/spi_bus_lock.c:733
--- 0x4037cc3b: spi_device_acquire_bus at C:/Espressif/frameworks/esp-idf-v5.3.1/components/esp_driver_spi/src/gpspi/spi_master.c:1276
--- 0x4200cf0a: Sx1232::Sx1232Read(unsigned char, unsigned char*, unsigned char) at C:/Users/ttruilhe/eclipse-workspace/RR23/main/hard/Radio/Sx1232.cpp:622
--- 0x4200cf82: Sx1232::SX1232ReadNegRssi() at C:/Users/ttruilhe/eclipse-workspace/RR23/main/hard/Radio/Sx1232.cpp:476
--- 0x4200a722: ulp_isr(void*) at C:/Users/ttruilhe/eclipse-workspace/RR23/main/Tasks/TaskMaster.cpp:45
--- (inlined by) ulp_isr at C:/Users/ttruilhe/eclipse-workspace/RR23/main/Tasks/TaskMaster.cpp:36
--- 0x40376454: rtc_isr at C:/Espressif/frameworks/esp-idf-v5.3.1/components/esp_hw_support/rtc_module.c:75
--- 0x4037a931: _xt_lowint1 at C:/Espressif/frameworks/esp-idf-v5.3.1/components/xtensa/xtensa_vectors.S:1240
--- 0x400559dd: r_rwip_init in ROM
--- 0x4038279e: vPortClearInterruptMaskFromISR at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
--- (inlined by) vPortExitCritical at C:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:505
--- 0x420686fd: esp_task_wdt_reset at C:/Espressif/frameworks/esp-idf-v5.3.1/components/esp_system/task_wdt/task_wdt.c:713
--- 0x4200b708: TaskPushButton::fcnt_PushButtonMainLoop() at C:/Users/ttruilhe/eclipse-workspace/RR23/main/Tasks/TaskPushButton.cpp:98
--- 0x4200b791: TaskPushButton::fcnt_TaskWrapper(void*) at C:/Users/ttruilhe/eclipse-workspace/RR23/main/Tasks/TaskPushButton.cpp:47

Do you please have any idea ?
Is it the timing of the interrupt which is 2ms only that is creating the problem ?
And why ?

Thank you for your help on this subject,
best regards,

Thomas TRUILHE

User avatar
ok-home
Posts: 157
Joined: Sun May 02, 2021 7:23 pm
Location: Russia Novosibirsk
Contact:

Re: Esp32S3 : Interrupt throws an "Interrupt wdt timeout on CPU0"

Postby ok-home » Wed Sep 17, 2025 11:06 am

If you use this code in interrupt context - it is an expected crash

Code: Select all

spi_device_acquire_bus(DeviceHandle, portMAX_DELAY);
spi_device_polling_transmit(DeviceHandle, &Transaction);
spi_device_release_bus(DeviceHandle);
under the hood these functions do not use isr safe functions
specifically in this backtrace it most likely crashes on xSemaphoreTake()

move the code to a separate task and execute it on a signal from an interrupt, for example xTaskNotifyFromISR()

ThomasESP32
Posts: 282
Joined: Thu Jul 14, 2022 5:15 am

Re: Esp32S3 : Interrupt throws an "Interrupt wdt timeout on CPU0"

Postby ThomasESP32 » Wed Sep 17, 2025 1:51 pm

OK I understand, thank you.
The point is that I wanted to ask the RSSI every 2ms precisely.

Because I have many tasks and each task has the same priority, each task is executed every 1ms.
So, the measure will not be 2ms.

do you have any idea ?

Sprite
Espressif staff
Espressif staff
Posts: 10650
Joined: Thu Nov 26, 2015 4:08 am

Re: Esp32S3 : Interrupt throws an "Interrupt wdt timeout on CPU0"

Postby Sprite » Thu Sep 18, 2025 10:11 am

Canonical FreeRTOS way to solve that would be to create a high-priority task that blocks on e.g. a semaphore. The interrupt simply sets that semaphore, the task wakes up and does the SPI operations.

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests