Using ADC1 triggers the watchdog
Posted: Mon Mar 25, 2024 9:42 pm
Hi there - again.
I have worked a lot in the Arduino framework, but have recently switched to ESP-IDF.
And it seems everything that should be simple, is not - at the first glance.
I want to use ADC1. And I must be missing something. Is there any parameters in menuconfig to set, in order to use it?
This is the first in my code, moved it there for testing. But somehow it triggers the wdt. How can it do that?
Any help would be apreciated
I also have the driver is deprecated in the first 2 lines. Is that a problem, I use platform 6.4.0 and:
W (1504) timer_group: legacy driver is deprecated, please migrate to `driver/gptimer.h`
W (1505) ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`
I (1507) sleep: Configure to isolate all GPIO pins in sleep state
I (1507) sleep: Enable automatic switching of GPIO sleep configuration
I (1508) app_start: Starting scheduler on CPU0
I (1508) app_start: Starting scheduler on CPU1
I (1508) main_task: Started on CPU0
I (1518) main_task: Calling app_main()
E (1518) ADC: Boot
E (21518) ADC: before ADC
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
Core 0 register dump:
PC : 0x4201073a PS : 0x00060534 A0 : 0x820107cc A1 : 0x3fca8f60
A2 : 0x800e0000 A3 : 0x00000000 A4 : 0x8007ffff A5 : 0x00060723
A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x820106fc A9 : 0x3fca8f30
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x00000000 A13 : 0x00000007
A14 : 0x00000000 A15 : 0x000000bf SAR : 0x00000020 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffffe
Backtrace: 0x42010737:0x3fca8f60 0x420107c9:0x3fca8f80 0x42010b90:0x3fca8fb0 0x42004337:0x3fca8ff0 0x40381cc0:0x3fca9440 0x403818b9:0x3fca9470
#0 0x42010737:0x3fca8f60 in adc_oneshot_ll_get_event at C:\Users\Frank\.platformio\packages\framework-espidf\components\hal\esp32s3\include/hal/adc_ll.h:927
#1 0x420107c9:0x3fca8f80 in adc_hal_convert at C:\Users\Frank\.platformio\packages\framework-espidf\components\driver\deprecated/adc_legacy.c:904 (discriminator 1)
#2 0x42010b90:0x3fca8fb0 in adc1_get_raw at C:\Users\Frank\.platformio\packages\framework-espidf\components\driver\deprecated/adc_legacy.c:399 (discriminator 2)
#3 0x42004337:0x3fca8ff0 in app_main at src/main.cpp:145
#4 0x40381cc0:0x3fca9440 in main_task at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos/app_startup.c:208 (discriminator 13)
#5 0x403818b9:0x3fca9470 in vPortTaskWrapper at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162
Core 1 register dump:
PC : 0x4037bf0e PS : 0x00060734 A0 : 0x820215c1 A1 : 0x3fcaa2c0
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3fca7140 A5 : 0x3fca7120
A6 : 0x403767fc A7 : 0x00000001 A8 : 0x8202080e A9 : 0x3fcaa280
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3fca7120 A13 : 0x3fca70f0
A14 : 0x00000001 A15 : 0x00000001 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x4037bf0b:0x3fcaa2c0 0x420215be:0x3fcaa2e0 0x4037fdf5:0x3fcaa300 0x403818b9:0x3fcaa320
#0 0x4037bf0b:0x3fcaa2c0 in xt_utils_wait_for_intr at C:/Users/Frank/.platformio/packages/framework-espidf/components/xtensa/include/xt_utils.h:81
(inlined by) esp_cpu_wait_for_intr at C:/Users/Frank/.platformio/packages/framework-espidf/components/esp_hw_support/cpu.c:111
#1 0x420215be:0x3fcaa2e0 in esp_vApplicationIdleHook at C:/Users/Frank/.platformio/packages/framework-espidf/components/esp_system/freertos_hooks.c:59
#2 0x4037fdf5:0x3fcaa300 in prvIdleTask at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel/tasks.c:4327 (discriminator 1)
#3 0x403818b9:0x3fcaa320 in vPortTaskWrapper at C:\Users\Frank.FUTURELIGHT\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162
I have worked a lot in the Arduino framework, but have recently switched to ESP-IDF.
And it seems everything that should be simple, is not - at the first glance.
I want to use ADC1. And I must be missing something. Is there any parameters in menuconfig to set, in order to use it?
This is the first in my code, moved it there for testing. But somehow it triggers the wdt. How can it do that?
Any help would be apreciated
I also have the driver is deprecated in the first 2 lines. Is that a problem, I use platform 6.4.0 and:
Code: Select all
#include "driver/timer.h"
#include "driver/adc.h"
Code: Select all
extern "C" void app_main(void)
{
ESP_LOGE("ADC", "Boot");
vTaskDelay(20000/portTICK_PERIOD_MS);
ESP_LOGE("ADC", "before ADC");
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(ADC1_CHANNEL_0, ADC_ATTEN_DB_11);
adc1_get_raw(ADC1_CHANNEL_0); <-----------------------------------this is line 145
ESP_LOGE("ADC", "After ADC");
vTaskDelay(10000/portTICK_PERIOD_MS);
ESP_LOGE("ADC", "Confinue");
..... more code
W (1504) timer_group: legacy driver is deprecated, please migrate to `driver/gptimer.h`
W (1505) ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`
I (1507) sleep: Configure to isolate all GPIO pins in sleep state
I (1507) sleep: Enable automatic switching of GPIO sleep configuration
I (1508) app_start: Starting scheduler on CPU0
I (1508) app_start: Starting scheduler on CPU1
I (1508) main_task: Started on CPU0
I (1518) main_task: Calling app_main()
E (1518) ADC: Boot
E (21518) ADC: before ADC
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
Core 0 register dump:
PC : 0x4201073a PS : 0x00060534 A0 : 0x820107cc A1 : 0x3fca8f60
A2 : 0x800e0000 A3 : 0x00000000 A4 : 0x8007ffff A5 : 0x00060723
A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x820106fc A9 : 0x3fca8f30
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x00000000 A13 : 0x00000007
A14 : 0x00000000 A15 : 0x000000bf SAR : 0x00000020 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffffe
Backtrace: 0x42010737:0x3fca8f60 0x420107c9:0x3fca8f80 0x42010b90:0x3fca8fb0 0x42004337:0x3fca8ff0 0x40381cc0:0x3fca9440 0x403818b9:0x3fca9470
#0 0x42010737:0x3fca8f60 in adc_oneshot_ll_get_event at C:\Users\Frank\.platformio\packages\framework-espidf\components\hal\esp32s3\include/hal/adc_ll.h:927
#1 0x420107c9:0x3fca8f80 in adc_hal_convert at C:\Users\Frank\.platformio\packages\framework-espidf\components\driver\deprecated/adc_legacy.c:904 (discriminator 1)
#2 0x42010b90:0x3fca8fb0 in adc1_get_raw at C:\Users\Frank\.platformio\packages\framework-espidf\components\driver\deprecated/adc_legacy.c:399 (discriminator 2)
#3 0x42004337:0x3fca8ff0 in app_main at src/main.cpp:145
#4 0x40381cc0:0x3fca9440 in main_task at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos/app_startup.c:208 (discriminator 13)
#5 0x403818b9:0x3fca9470 in vPortTaskWrapper at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162
Core 1 register dump:
PC : 0x4037bf0e PS : 0x00060734 A0 : 0x820215c1 A1 : 0x3fcaa2c0
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3fca7140 A5 : 0x3fca7120
A6 : 0x403767fc A7 : 0x00000001 A8 : 0x8202080e A9 : 0x3fcaa280
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3fca7120 A13 : 0x3fca70f0
A14 : 0x00000001 A15 : 0x00000001 SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x4037bf0b:0x3fcaa2c0 0x420215be:0x3fcaa2e0 0x4037fdf5:0x3fcaa300 0x403818b9:0x3fcaa320
#0 0x4037bf0b:0x3fcaa2c0 in xt_utils_wait_for_intr at C:/Users/Frank/.platformio/packages/framework-espidf/components/xtensa/include/xt_utils.h:81
(inlined by) esp_cpu_wait_for_intr at C:/Users/Frank/.platformio/packages/framework-espidf/components/esp_hw_support/cpu.c:111
#1 0x420215be:0x3fcaa2e0 in esp_vApplicationIdleHook at C:/Users/Frank/.platformio/packages/framework-espidf/components/esp_system/freertos_hooks.c:59
#2 0x4037fdf5:0x3fcaa300 in prvIdleTask at C:\Users\Frank\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel/tasks.c:4327 (discriminator 1)
#3 0x403818b9:0x3fcaa320 in vPortTaskWrapper at C:\Users\Frank.FUTURELIGHT\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162