-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Modbus Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed) (IDFGH-3775) #5694
Comments
Thanks for the detailed report and sorry for the inconvenience, we will look into. |
Hi @simon-thiebaut, Thanks for your issue. I investigated the issue and files you provided.
I investigated some uart driver, modbus port functions and other as well as their references to .flash.text segment:
The references above are ok and do not cause any issue. |
Hi @alisitsyn , Thank you for the quick reply. Indeed my mistake I forgot to mention that we forked the repo. But as it was working before rebasing to release/v4.1 head, I didn't find relevant to state it. However this might be a combination of our changes + SDK changes that create the problem... Also from your answer, I've been misreading the map files, actually I didn't think to check the elf. By the way, I've found this comment on this link => https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/spi_master.html
Could it be a wrong compiler option in the SDK config that optimizes badly this function location ? I'll continue checking compiler options. Thank you for your feedback. |
Yes, this issue exists in even latest master when optimization for size is selected. The correct commit for v4.1-rc is
Yes, the inlined function should not appear as a symbol in elf. For quick fix I propose to change the uart_ll_is_tx_idle as below (it could work even without
In this case it is inlined correctly by both compilers. Let me know if the temporary fix above works for you. AND Thanks for good finding... |
@alisitsyn thank you for these confirmations, I was going crazy trying to put IRAM everywhere without success... So far with your fix, I don't face the problem anymore after more than 1 hour (whereas before problem was showing up after roughly 4/5 minutes). I need to do more test, but this is encouraging.
AND Thanks for good support 👍 Shall I close the ticket or will you do it after official fix delivery ? Thank you again. |
Good to hear it helps even as temporary solution. Let me know if you have some further results. Please leave the ticket opened, it will be closed automatically once fix is merged. 👍 |
We recently experienced this issue with both the UART (used for modbus) and the RMT peripheral using IRAM on v4.2. We require both of these peripherals be active during an OTA download i.e flash writes. Our project has not got to state yet where we need to fork the IDF to apply the workarounds mentioned above as we are looking to avoid this as much as possible. Currently changing the compiler settings to -Og instead of -Os resolves the problem. However, this does result in significantly larger binary images which are downloaded on metered connections and there is currently no support for bindiff updates. Also now not everything will fit inside the IRAM and storing application code in IRAM is useful as it can free up RAM used so that you can run BLE, WIFI and TLS simultaneously. TLDR: -Os solution cascades to other problems Oh, how I just love how embedded development is full of trade-offs, compromises and random limitations you would never could have foreseen, its what I wake up in the morning for. |
Still present in v4.3-beta-2 |
Can try to ask about merge but I do not control it. Unfortunately the MR is still not merged. |
In the mean time can you share a patch that works with 4.3-beta-2 ? I tried cherry picking 40636d6 but it has conflicts. |
Yes, sure I can provide the patches: Let me know if you have any issues. |
v4.3 fixed by d761226 |
Hello ESP32 experts. I have kind a problem, when I initialize I2C driver on core 1 with i2c_driver_install(i2c_port, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0); my firmware works, but I sometimes had problem with reading from I2C. When I use i2c_driver_install(i2c_port, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, (ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL3)); I constantly receive Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed). Firmware uses esp-idf version 4.3. With sdk version 4.2.1 it is working without any problem. So are you sure that sdk v4.3 is stable? |
@RuslanSpartak |
@RuslanSpartak, |
It's already reported in #7249 |
Ok, Thank you for update. |
Environment
git describe --tags
to find it):xtensa-esp32-elf-gcc --version
to find it):Problem Description
We were encountering a memory leak in the wifi stack on the previous version (v4.1-dev-1100-g18d435e26). As it was fixed on release/v4.1, we decided to move to this branch head (also, we're going to production so it was better to go to a release branch rather than staying on master).
So now we are on v4.1-rc-10-g70675c7d1.
Problem is that we always get "Core 1 panic'ed (Cache disabled but cached memory region accessed)" errors causing reboot after some minutes, without explanation, as our code has not changed before and after SDK update.
We suspect it comes from Modbus/UART ISR handlers, because we've tried the following independently:
Also, we've checked the differences between the 2 versions, and dug a bit in the code, and we've found inconsistencies for code that should be in IRAM, for example:
There might be others as well, it is only the ones we've identified.
So maybe this added to other amount of running code can cause more chances to get cache exceptions. We've tried to move the objects we've identified from flash to IRAM/DRAM, but without success...
Expected Behavior
Code shall not crash with the new SDK version, as before.
Actual Behavior
Code crashes with the new SDK version.
Steps to reproduce
I have not made the effort yet to try the simple Modbus examples. But I'm not sure this will fail... I'm afraid it could be due to the size of the binary: the more it is, the more cache accesses might be required, and so the more the problem could occur.
Code to reproduce this issue
NA
Debug Logs
Other items if possible
4.1-dev.zip
4.1-rc.zip
I've also checked tickets #5072 and #4049, but the do not present exactly the same symptoms.
Also, please let us know if we too the wrong branch to upgrade and get the fix of wifi leak, maybe it has an impact...
Thank you for your help.
Best regards,
Simon
The text was updated successfully, but these errors were encountered: