How to increase the timeout value for chip erase?

lukecam95
Posts: 14
Joined: Thu Sep 23, 2021 9:37 am

How to increase the timeout value for chip erase?

Postby lukecam95 » Thu Sep 23, 2021 9:46 am

Hi,

I have a Winbond W25Q32JVZPIQ flash chip which I am successfully writing and reading data to. I have now added the functionality in my application to erase the whole chip contents on first bootup using the esp flash API function:

Code: Select all

esp_flash_erase_chip(esp_flash_t *chip)
This also seems to work, but I am getting a time out error like below:

ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x40085630

From the datasheet of the flash chip the erase time is 10seconds, however the timeout error is being triggered before.

How can I increase this timeout value? Surely there is a setting in menuconfig somewhere?

Thank you for your time.

lukecam95
Posts: 14
Joined: Thu Sep 23, 2021 9:37 am

Re: How to increase the timeout value for chip erase?

Postby lukecam95 » Thu Sep 23, 2021 12:44 pm

I have found a setting in Menuconfig that switches off the timeout in Component config -> SPI flash driver -> Flash timeout checkout disabled []

I do hope there is a better solution to this though...

ESP_Sprite
Posts: 8999
Joined: Thu Nov 26, 2015 4:08 am

Re: How to increase the timeout value for chip erase?

Postby ESP_Sprite » Fri Sep 24, 2021 3:46 am

It looks like the code has some provisions for custom timeouts, but these are determined by the flash driver... the 'nicest' way to solve this is by creating your own driver, e.g. by copying spi_flash/spi_flash_chip_winbond.c, and using a modified timeout structure rather than spi_flash_chip_generic_timeout. That may need some CMake wrangling to work correctly, though, it's not a trivial endeavour. Alternatively, you can file an issue on the ESP-IDF Github; attach a datasheet of the flash chip in question, and we'll see what we can do. (That may take a while before it ends up in a release, though.)

Who is online

Users browsing this forum: Google [Bot] and 86 guests