Closed jw-redpanda closed 1 year ago
I am building a commercial product using esp-idf + esp-adf, which utilizes BLE, Wi-Fi, audio playback/recording, and implemented some parallel running tasks. The memory optimization is critical and required. Since the crash is repeatable and the demo repo code has been prepared for the investigation, including detail backtrace, I look forward to seeing the esp-adf team's response. Thank you.
@jw-redpanda Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Please refer to fatal errors docs https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/fatal-errors.html?highlight=crash#fatal-errors
@jw-redpanda
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Please refer to fatal errors docs https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/fatal-errors.html?highlight=crash#fatal-errors
Thanks for your reply.
I am aware of this error. However, this error happens in the i2s driver, instead of the higher level of app code. We, as a developer, has not had enough knowledge to check and fix the drive code.
If the official sample code could crash inside the driver code, is there any possibility that some driver code does not explicitly allocate internal memory, e.g. heap_caps_malloc(memSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT), but may use standard malloc() that allocates memory from SPIRAM, when memory optimization is applied? If this is the case, the crash may happen.
We have met a similar issue before when turn on maximum malloc() size in bytes, to always put in internal memory and change it too smaller value such as 16. You can enlarge this value to avoid structure which not huge put to psram directly. For inetrrupt can not access psram when cache disabled during fs reading.
@TempoTian Yes, I guess some developers also encountered a similar issue.
Since this memory optimization (malloc() that uses PSRAM) is officially supported, applying this optimization should not cause a crash at the driver level. Or else the official documentation should indicate this memory optimization should not be applied if some esp-idf/esp-adf components are used.
I still hope that the esp-adf team to look into this issue.
Thank you for your advice. I'm going to close this inactive issue. Please reopen this if you have any questions or need any further assistance.
Environment
Core 0 register dump: PC : 0x400865a9 PS : 0x00050034 A0 : 0x40084214 A1 : 0x3ffb0be0 A2 : 0x3f807adc A3 : 0xbad00bad A4 : 0x00000000 A5 : 0x400889ce A6 : 0xe0000020 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000 A10 : 0x3ffb2e70 A11 : 0x00000001 A12 : 0x80084bbd A13 : 0x3ffbecb0 A14 : 0x00000001 A15 : 0x3ffb2bc8 SAR : 0x00000018 EXCCAUSE: 0x00000007 EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000002
Backtrace: 0x400865a6:0x3ffb0be0 0x40084211:0x3ffb0c10 0x4000c2e1:0x3ffbeca0 0x4008cf1a:0x3ffbecb0 0x4008fd21:0x3ffbece0 0x400857bf:0x3ffbed60 0x400db826:0x3ffbeda0 0x400 e31a2:0x3ffbedd0 0x400e4391:0x3ffbedf0 0x400e30ba:0x3ffbee30 0x400ddf1d:0x3ffbee50 0x400dde45:0x3ffbee70 0x400de309:0x3ffbee90 0x400ded30:0x3ffbeeb0 0x400dedc9:0x3ffbeed0 0x400df103:0x3ffbef00 0x400e0c4b:0x3ffbef60 0x400d3559:0x3ffbef90 0x400f44ab:0x3ffbefb0 0x400f4550:0x3ffbefe0 0x400d700f:0x3ffbf000 0x400d718b:0x3ffbf030 0x4008c12d:0x3f fbf050
ELF file SHA256: 9fdf0ba3f393bbae
Rebooting...
Problem Description
Expected Behavior
File operations, e.g. read, write, should work when audio is playing or recording.
Actual Behavior
When there is a file operation, e.g. fopen(), it will crash immediately.
Steps to Reproduce
Copied from an esp-idf get-started example, I created a repo which has inserted some test code and is able to reproduce the issue. Please check and see the repo.
The repo inserts code that will run a task to perform file read/write periodically. In details:
Some build assets for your reference
Code to Reproduce This Issue