Hello everyone,
I'm looking for some insight on a problem that occurred to me yesterday.
I am working on a custom ESP32 board that needs to have its firmware updated via OTA. I also have a secondary task continuously communicating with another device via Serial Modbus (RS232, master RTU).
I noticed that the OTA procedure was failing due to the ESP32 panicking with the following message : "Guru Meditation Error: Cache disabled but cached memory region accessed". This is normally due to some interrupt executing non-IRAM code during a flash write operation.
I realized that by cancelling the Modbus task during the update procedure everything went smoothly - which is a definitive solution, because I don't need to keep up the updates during firmware upload. However I would like to understand why the Modbus Communication was causing this panic (if that is the culprit), as I was not directly enabling any interrupt for the UART peripheral.
Modbus Master component causes panic when writing to flash
-
- Posts: 211
- Joined: Fri Feb 01, 2019 4:02 pm
- Contact:
Re: Modbus Master component causes panic when writing to flash
Hello @maldus,
Could you please provide more information about your project:
1. What version of ESP-IDF you are using?
2. Could you provide Modbus and application logs and sdkconfig file?
3. Did you try using some Modbus patches for older release branches (if old version is used)?
4. Are you using the CONFIG_FMB_TIMER_ISR_IN_IRAM to place timer and UART ISR into IRAM?
The Modbus uses the timer group interrupts that can be placed into FLASH or into IRAM memory. The CONFIG_FMB_TIMER_ISR_IN_IRAM=y causes the CONFIG_UART_ISR_IN_IRAM=y and place UART ISR into IRAM. If your interrupt handlers placed into FLASH and you do not disable Modbus while OTA it causes the above issue because flash cache is disabled during update.
Thanks.
Could you please provide more information about your project:
1. What version of ESP-IDF you are using?
2. Could you provide Modbus and application logs and sdkconfig file?
3. Did you try using some Modbus patches for older release branches (if old version is used)?
4. Are you using the CONFIG_FMB_TIMER_ISR_IN_IRAM to place timer and UART ISR into IRAM?
The Modbus uses the timer group interrupts that can be placed into FLASH or into IRAM memory. The CONFIG_FMB_TIMER_ISR_IN_IRAM=y causes the CONFIG_UART_ISR_IN_IRAM=y and place UART ISR into IRAM. If your interrupt handlers placed into FLASH and you do not disable Modbus while OTA it causes the above issue because flash cache is disabled during update.
Thanks.
Last edited by ESP_alisitsyn on Tue Feb 09, 2021 7:52 am, edited 1 time in total.
Re: Modbus Master component causes panic when writing to flash
Thank you for your time, @ESP_alisitsyn.
2. I attached my sdkconfig. Unfortunately I cannot provide logs, as my application needs to use every available UART
3. No
4. I don't seem to have that config option available; perhaps it was added in a later version?
1. I am on branch `release/v4.0`Could you please provide more information about your project:
2. I attached my sdkconfig. Unfortunately I cannot provide logs, as my application needs to use every available UART
3. No
4. I don't seem to have that config option available; perhaps it was added in a later version?
That could explain the panic. Again, I can't find those options in the configuration menu (I only have similar options for SPI transactions), so I'm guessing my idf version is too old. Regardless, stopping all modbus operations during the update procedure is a definitive solution for me, so it's not an issue.The Modbus uses the timer group interrupts that can be placed into FLASH or into IRAM memory. The CONFIG_FMB_TIMER_ISR_IN_IRAM=y cases the CONFIG_UART_ISR_IN_IRAM=y and place UART ISR into IRAM. If your interrupt handlers placed into FLASH and you do not disable Modbus while OTA it cases the above issue because flash cache is disabled during update.
- Attachments
-
- sdkconfig.7z
- (5.19 KiB) Downloaded 322 times
-
- Posts: 211
- Joined: Fri Feb 01, 2019 4:02 pm
- Contact:
Re: Modbus Master component causes panic when writing to flash
Hi @maldus,
This is known bug in the v4.0 which causes the "Guru Meditation Error: Cache disabled but cached memory region accessed".
Please use the patch below to fix this issue and it allows to select "CONFIG_FMB_TIMER_ISR_IN_IRAM".
Please try the patch and let me know if you still have any issues.
Thank you.
This is known bug in the v4.0 which causes the "Guru Meditation Error: Cache disabled but cached memory region accessed".
Please use the patch below to fix this issue and it allows to select "CONFIG_FMB_TIMER_ISR_IN_IRAM".
Please try the patch and let me know if you still have any issues.
Thank you.
- Attachments
-
- bugfix_backport_latest_modbus_fixes_v40.zip
- modbus fix for release/v4.0 branch
- (43.03 KiB) Downloaded 347 times
-
- simple_modbus_fixesv40_.zip
- simple modbus project with integrated patch
- (186.53 KiB) Downloaded 334 times
-
- Posts: 211
- Joined: Fri Feb 01, 2019 4:02 pm
- Contact:
Re: Modbus Master component causes panic when writing to flash
Hi @maldus,
Do you have any results update?
Thanks.
Do you have any results update?
Thanks.