Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP.getFlashChipSize() returns different values #785

Closed
robertgregor opened this issue Sep 14, 2015 · 3 comments
Closed

ESP.getFlashChipSize() returns different values #785

robertgregor opened this issue Sep 14, 2015 · 3 comments

Comments

@robertgregor
Copy link

Hello,
I have strange behaviour of the ESP.getFlashChipSize(). I have bought several ESP-12 modules. I wanted to check the flash size, to be able to set correct value in the Flash size menu. So I have created simple sketch where I put:
void setup() {
Serial.begin(115200);
Serial.print("Flash size: ");
Serial.println(ESP.getFlashChipSize(), DEC);
}
It gave me 1M flash. OK, I have set it and loaded the big shetch - around Sketch uses 433,064 bytes
Then at the begining I have called this again and I've got Flash size: 524288

How this is possible???

@robertgregor
Copy link
Author

Hello, OK, I have found on google interresting thing, that the size is stored in the flash and it is overwritten when there is a bin download. So this is not relevant and better solution is to check the chipId and based on this dedicate the real flash size. Maybe you can add the comment to the reference manual, because it can be confusing.

@igrr
Copy link
Member

igrr commented Sep 15, 2015

documentation mentions this:

ESP.getFlashChipSize() returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).

@Links2004
Copy link
Collaborator

may this helps you:
https://github.com/Links2004/Arduino/blob/esp8266/hardware/esp8266com/esp8266/libraries/esp8266/examples/CheckFlashConfig/CheckFlashConfig.ino

ESP.getFlashChipRealSize(); will return the size based of the flash chipId

keramlevap added a commit to keramlevap/Arduino that referenced this issue Jun 30, 2016
Hi, 
I added ESP.getFlashChipRealSize() function to the documentation. I couldn't determine flash size of my ESP based on getFlashChipSize function, so I was googling and found this: esp8266#785
I tested functionality and now adding here to official documentation.
Cheers!
igrr pushed a commit that referenced this issue Jul 4, 2016
Hi, 
I added ESP.getFlashChipRealSize() function to the documentation. I couldn't determine flash size of my ESP based on getFlashChipSize function, so I was googling and found this: #785
I tested functionality and now adding here to official documentation.
Cheers!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants