SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

derricksenva
Posts: 21
Joined: Tue Aug 02, 2022 8:19 pm

SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Postby derricksenva » Thu Jan 04, 2024 12:02 am

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.

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Postby MicroController » Thu Jan 04, 2024 9:44 am

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.

ViennaTom
Posts: 4
Joined: Tue Dec 19, 2023 9:19 pm

Re: SPI_FLASH_ERASE_YIELD_DURATION_MS and CONFIG_SPI_FLASH_ERASE_YIELD_TICKS

Postby ViennaTom » Mon Jan 15, 2024 9:54 pm

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 !

Who is online

Users browsing this forum: Gaston1980, Google [Bot] and 215 guests