Page 1 of 1

SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Posted: Thu Jan 04, 2024 12:02 am
by derricksenva
Can someone explain what SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS do? The descriptions from docs.espressif.com are not worded very well and almost sound exactly the same. Is CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS the amount of time passed to vTaskDelay() at the end of a call to esp_partition_erase_range()? How is CONFIG_SPI_FLASH_ERASE_YIELD_TICKS any different?
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS
Duration of erasing to yield CPUs (ms)

Found in: Component config > SPI Flash driver > CONFIG_SPI_FLASH_YIELD_DURING_ERASE

If a duration of one erase command is large then it will yield CPUs after finishing a current command.

Default value:
20

CONFIG_SPI_FLASH_ERASE_YIELD_TICKS
CPU release time (tick) for an erase operation

Found in: Component config > SPI Flash driver > CONFIG_SPI_FLASH_YIELD_DURING_ERASE

Defines how many ticks will be before returning to continue a erasing.

Default value:
1
I've also looked at the source in

Code: Select all

components/spi_flash/spi_flash_os_func_app.c
and the comments there seem to require a deeper understanding of the entire SPI flash component.

Re: SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Posted: Thu Jan 04, 2024 9:44 am
by MicroController
Erasing will yield every CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS for CONFIG_SPI_FLASH_ERASE_YIELD_TICKS, i.e. by default, it will yield/pause for 1 OS tick (10ms) after running for 20ms.

Re: SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Posted: Mon Jan 15, 2024 9:54 pm
by ViennaTom
Having you knowing and understanding SPI-flash memory of all manufactures here is really a pity !!!

I hope in this case you can easily explain why
E (7149) mqtt: Writing to partition subtype 130 at offset 0x700000
E (7149) mqtt: partition size 655360 datalen:655360
E (8829) mqtt: Erasing took 1686924 uSecs for partition size 655360

will return ESP_OK but without waiting for another 500 to 1000mSecs flash will not be written correctly ?

Interested in your knowledge !