IPC Task Lock-Up and Watchdog Triggering with SPI Flash Operations
Posted: Mon Apr 01, 2024 10:41 am
Hi all,
I'm facing a challenging issue with an ESP32 project (using ESP_IDF) that involves Inter-Processor Call (IPC) tasks sometimes locking up, subsequently triggering the watchdog. The problem seems to occur within the spi_flash_op_block_func, specifically in a while loop that waits for flash operations to complete. Here's the relevant code snippet:
This suggests that the s_flash_op_complete flag is sometimes not being set by the other core. I've ensured compliance with ESP_INTR_FLAG_IRAM constraints, verifying that IRAM interrupts do not access any flash content, they only modify some static variables.
The issue becomes more obvious with frequent writes to NVS_Storage, which also resides on the onboard flash with an ESP NVS partition. Temporarily disabling NVS writes seems to stop the problem, indicating a potential conflict or resource contention issue related to flash access.
For context, all NVS writes are protected by a mutex to prevent concurrent write attempts that could block the SPI bus. Despite this, the lock-up still occurs, and since the NVS is needed for this project, there seems no obvious solution until I can work out what is causing this.
Has anyone encountered a similar issue or have insights into what might be causing this and how to resolve it? Any advice on troubleshooting or fixing this issue would be greatly appreciated. Thanks in advance for your help!
For context this is on an ESP32S3
I'm facing a challenging issue with an ESP32 project (using ESP_IDF) that involves Inter-Processor Call (IPC) tasks sometimes locking up, subsequently triggering the watchdog. The problem seems to occur within the spi_flash_op_block_func, specifically in a while loop that waits for flash operations to complete. Here's the relevant code snippet:
Code: Select all
while (!s_flash_op_complete) {
// busy loop here and wait for the other CPU to finish flash operation
}
The issue becomes more obvious with frequent writes to NVS_Storage, which also resides on the onboard flash with an ESP NVS partition. Temporarily disabling NVS writes seems to stop the problem, indicating a potential conflict or resource contention issue related to flash access.
For context, all NVS writes are protected by a mutex to prevent concurrent write attempts that could block the SPI bus. Despite this, the lock-up still occurs, and since the NVS is needed for this project, there seems no obvious solution until I can work out what is causing this.
Has anyone encountered a similar issue or have insights into what might be causing this and how to resolve it? Any advice on troubleshooting or fixing this issue would be greatly appreciated. Thanks in advance for your help!
For context this is on an ESP32S3