Open VNovytskyi opened 11 months ago
@VNovytskyi Thank you for reporting the issue. In commit https://github.com/espressif/esp-idf/commit/9a6a28734b88a2d29d2a0459010eff83e876e1da, we may have fixed the problem. Could you please check if the version you are using includes this commit? If it doesn't, would the issue still occur after applying this commit?
@zhp0406 Thank you for your reply! I found a possible fix for this problem: I changed the BLE controller core from CPU0 to CPU1. And it has been fixed. I am using ESP-IDF 5.0.4 and I haven't found the commit https://github.com/espressif/esp-idf/commit/9a6a28734b88a2d29d2a0459010eff83e876e1da on this branch. But I have found the commit https://github.com/espressif/esp-idf/commit/9a6a28734b88a2d29d2a0459010eff83e876e1da on the ESP-IDF 4.4.6:
Merge: 2c41b01771 9a6a28734b
commit 9a6a28734b88a2d29d2a0459010eff83e876e1da
I try to test my version of ESP-IDF with this commit and reply to you. If you have some more ideas please tell me.
@VNovytskyi Hi, Have the issue been resolved?
Thanks @VNovytskyi for getting me on the right track. I had the same issue and was able to fix it after reading your bug report. Maybe it helps you too what i found out.
You wrote "If you turn on the single core mode this issue doesn't arise.". With this in mind, i remembered that if you initialize something and handle its output later on another core, this can lead to issues. So, i put all my initialization logic on the same core where i also handle its outcome. As my I2C things run on Core 1 and its initialization was somewhere inside the app_main()
which runs on Core 0, i got the exact same issue you have. After putting thie I2C initialization on Core 1 too, it worked fine. However, the problem only persitis if i turned on bluetooth, which also runs on Core 0. Now, after putting init and handling code for a component on one core, it worked, even if the different components (BLE, UART, I2C...) are on different cores.
In short words: Put your init code on the same core as your handling/looping code if it is bound to one component.
In detail, i think, this is due to initializing things that need special handlers or interrupts, you also initialize these interrupts to the core you are running on. If you now run your handling code on a different core while the interrupt rises on the former core, this might lead to problems.
Thanks @timoxd7! I will use your observations in my future designs! In addition, I can advise avoiding unpinned task creation. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html#creation In my opinion, using _tskNOAFFINITY while creating the task is very dangerous. It means that the created task can be executed on both CPUs at different times. Maybe this behaviour produces self-blocking or something else. If you know additional information or if I am wrong - please provide the information you know!
Answers checklist.
IDF version.
ESP-IDF 5.0.4
Espressif SoC revision.
ESP32 rev3
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.
CMD
Development Kit.
ESP32-WROVER-E
Power Supply used.
USB
What is the expected behavior?
I expected normal behaviour without the interrupt watchdog triggering.
What is the actual behavior?
In random time the interrupt watchdog timeout occurs. Needs a few minutes to catch the bug.
Steps to reproduce.
Use BLE, Wi-Fi, I2C and UART modules.
Debug Logs.
More Information.