Page 1 of 1

Bootloader reports wrong flash size?

Posted: Fri Sep 23, 2016 3:07 am
by jmattsson
I had assumed that the ESP3212 module I got had a 4MB flash since that's what the bootloader reports:

Code: Select all

**************************************
*       hello espressif ESP32!       *
*        2nd boot is running!        *
*            version (V0.1)          *
**************************************
compile time 18:13:20

  SPI Speed      : 40MHz
  SPI Mode       : DIO
  SPI Flash Size : 4MB
However, any attempts to access past the 2MB boundary consistently fails. Access to the first 2MB works fine (read/erase/write).

I'm using the interface from esp_spi_flash.h, and the error code I get is ESP_ERR_FLASH_OP_FAIL.

Is the bootloader reporting the wrong flash size, or am I doing something wrong?

Re: Bootloader reports wrong flash size?

Posted: Fri Sep 23, 2016 5:32 am
by ESP_igrr
It's a bug, we fail to set chip size member in global flashchip structure to the size found in the binary image header. Default value is 2 megabytes, and it's not updated in the 2nd stage bootloader. I haven't gotten around to fix it yet. Here's the line you may add as a workaround:
https://github.com/igrr/esp32-spi-flash ... main.c#L56
There is one thing missing in this example though. You need to call SPIParamCfg from a function which is in IRAM.

Re: Bootloader reports wrong flash size?

Posted: Fri Sep 23, 2016 7:34 am
by jmattsson
Thanks, that gave me access to the rest of the flash! Sweeeet :)

Is there any (easy) way of reading out the existing values before clobbering them via SPIParamCfg()?