-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
ADC continuous does crash when CONFIG_GDMA_ISR_IRAM_SAFE=yes (IDFGH-10537) #11781
Comments
This isn't as expected. The Hal functions you referred are placed into internal ram by linker.lf and we have test cases for this. Maybe there're something that tests didn't cover. Which optimisation level are you using? And could you help upload your sdkconfig here? @pggh |
The linker script was not on my radar. When looking at it, I think the problem is caused by CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE not being set (see below) sdkconfig.defaults:
|
You may refer to this line, where CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE will select CONFIG_GDMA_ISR_IRAM_SAFE. If you only set CONFIG_GDMA_ISR_IRAM_SAFE, we won't know if you're going to use ADC with DMA or I2S with DMA or others, so we won't let the CONFIG_GDMA_ISR_IRAM_SAFE select other peripheral-specific IRAM-SAFE kconfig options. Besides, here is a doc about the IRAM-SAFE part of the driver. The ADC_CONTINUOUS_ISR_IRAM_SAFE and its prompt also say it's to make the driver ISR IRAM-SAFE, callback is part of it. |
I had set CONFIG_GDMA_ISR_IRAM_SAFE for something else, not the continuous-mode driver. I suggest to have only one setting in the long term and implement a compile time consistency check for now because:
Also the doc linked above should include this information. |
Ah ok, thanks for clarifying the condition. Now I understand your situation~ It's because if CONFIG_GDMA_ISR_IRAM_SAFE is set, then the GDMA ISR dispatcher will be placed into / marked as internal ram, and peripheral-specific ISR callbacks will get run when cache is disabled. Then the peripheral functions called in its ISR (which is dispatched by the gdma ISR callbacks) must be placed into internal ram otherwise lead to crash. We'll discuss this then and give you a reply or solution. |
I completely agree. Spent too much time trying to figure out why I was seeing intermittent |
Answers checklist.
IDF version.
5.0
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-S3
Power Supply used.
USB
What is the expected behavior?
ADC continuous driver should work
What is the actual behavior?
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Core 0 register dump:
PC : 0x4206a48a PS : 0x00060034 A0 : 0x8037998c A1 : 0x3fc9a3c0
0x4206a48a: adc_hal_get_reading_result at C:/Applications/Develop/SDK/esp-idf-5.0/frameworks/esp-idf-v5.0/components/hal/adc_hal.c:291
A2 : 0x00000000 A3 : 0x3fca7ba8 A4 : 0x3fca7ba4 A5 : 0x3fca6740
A6 : 0x3fc9ac48 A7 : 0x3fca6884 A8 : 0x803798eb A9 : 0x00000000
A10 : 0x3fca7c28 A11 : 0x3fca7c28 A12 : 0x3fc9a3c4 A13 : 0x3fca6720
A14 : 0x3fc9acb8 A15 : 0x00000002 SAR : 0x00000008 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x400557e1 LEND : 0x400557e5 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x40041a6b EPC2 : 0x4004f3e7 EPC3 : 0x40045c48 EPC4 : 0x4206a48a
0x4206a48a: adc_hal_get_reading_result at C:/Applications/Develop/SDK/esp-idf-5.0/frameworks/esp-idf-v5.0/components/hal/adc_hal.c:291
Backtrace: 0x4206a487:0x3fc9a3c0 0x40379989:0x3fc9a3f0 0x40379b9e:0x3fc9a410 0x403770c6:0x3fc9a440 0x4004f3e4:0x3fca66a0 |<-CORRUPTED
Steps to reproduce.
Use the ADC continuous mode for ADC1 of an ESP32-S3.
In my case I have the following code fragment for init:
Debug Logs.
No response
More Information.
With CONFIG_GDMA_ISR_IRAM_SAFE=yes, the
adc_dma_in_suc_eof_callback
function in adc_continuous.c is called while the cache is disabled.adc_dma_in_suc_eof_callback
callss_adc_dma_intr
which callsadc_hal_get_reading_result
in adc_hal.c.adc_dma_in_suc_eof_callback
ands_adc_dma_intr
are marked with IRAM_ATTR, butadc_hal_get_reading_result
is not.Same for
adc_hal_digi_start
and everything called in it.The text was updated successfully, but these errors were encountered: