Page 1 of 1

esp_partition_erase_range freeze

Posted: Tue Nov 22, 2022 7:48 pm
by daniSi
Hi,

we have experienced some strange behaviour when using the

Code: Select all

 esp_err_t esp_partition_erase_range(const esp_partition_t* partition, size_t offset, size_t size);
function.

The function was used already previously where the result was as expected. The problems started after enabling the flash encryption.

1. Code same as before causes that the MCU freezes and not even a WDT cause a reset. All other tasks are as well blocked.
2. Experimentally we have putted before the call of the function a 100ms delay. After this when calling the function the WDT causes a reset.
3. Experimentally we have increased the delay to 1000ms. After this when calling the function the result is as expected.

We use esp-idf 4.4.2 and the partition size is 3MB.

Any ideas what could cause this?

Danijel

Re: esp_partition_erase_range freeze

Posted: Wed Nov 23, 2022 5:56 pm
by chegewara
I would suggest to not erase whole partition at once, just do it in chunks.

Re: esp_partition_erase_range freeze

Posted: Wed Nov 23, 2022 9:35 pm
by daniSi
I forgot to mention this, but we have try it as well. Experimentally we have discovered that at least a 150ms delay before the function is still fine, if its less then this, strange behaviour occurs.

Re: esp_partition_erase_range freeze

Posted: Mon Jan 09, 2023 11:08 am
by wilkxt
Hi
I have the same problem in IDF 5.0. TaskDelay(150) doesn't help. Do you resolve this problem?

Re: esp_partition_erase_range freeze

Posted: Tue Jan 10, 2023 6:11 am
by wilkxt
In the function before using esp_partition_erase_range I had a hang (vTaskSuspend(xHandleMonitorTask)) of a task (not related to this task) and it was causing this problem. I don't know why, but as soon as I turned off suspending the task, the freezing problem disappeared. It's possible it's a bug in the IDF.