Bootloader reports wrong flash size?

jmattsson
Posts: 37
Joined: Fri Jun 03, 2016 5:37 am
Contact:

Bootloader reports wrong flash size?

Postby jmattsson » Fri Sep 23, 2016 3:07 am

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?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Bootloader reports wrong flash size?

Postby ESP_igrr » Fri Sep 23, 2016 5:32 am

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.

jmattsson
Posts: 37
Joined: Fri Jun 03, 2016 5:37 am
Contact:

Re: Bootloader reports wrong flash size?

Postby jmattsson » Fri Sep 23, 2016 7:34 am

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()?

Who is online

Users browsing this forum: No registered users and 25 guests