Page 1 of 2

Determine flash size on your module

Posted: Thu Apr 14, 2016 11:25 am
by platforma
There doesn't seem to be a single way of figuring out flash size of an ESP8266 module. Aside from the filesystem related, programmatic way of figuring out how much memory is currently free, it would be useful to have the means of getting the total size before the firmware is even flashed, or perhaps as a part of modesp as well, but I don't see the need for it. For example to avoid warning users about 1MB minimum flash size and let makefile/esptool.py handle this before attempting to flash the build that would cause problems.

I wanted to take a chance and sum up how to determine your flash size manually. With your ESP in bootloader mode, use the esptool.py that comes with the pfalcon/esp-open-sdk (change the port accordingly):

Code: Select all

esptool.py --port /dev/ttyUSB0 flash_id
Connecting...
this will give the manufacturer and device IDs:

Code: Select all

Manufacturer: c8
Device: 4016
The same manufacturer/device ID combo can be obtained by running:

Code: Select all

import esp
hex(esp.flash_id())
'0x1640c8' # note that it's backwards
What I found so far, is a header file with flash chip manufacturers and devices they produced mapped to part numbers, can be pulled from here. Searching through this I see lines:

Code: Select all

#define GIGADEVICE_ID		0xC8		/* GigaDevice */
#define GIGADEVICE_GD25Q32	0x4016	/* Same as GD25Q32B */
Googling the part number takes me to a page that describes the naming convention of this device, which indicates that the last two digits decode to device density: 32 = 32Mbit = 4MB of flash. This is incredibly convoluted and I hope there will be a way of doing this without depending on 2 external sources. But in the meantime I wanted to share my findings with others and perhaps hear suggestions on how can this be tackled.

Re: Determine flash size on your module

Posted: Thu Apr 14, 2016 1:12 pm
by deshipu
Personally, I always just used the Arduino IDE and flashed this example on the board:
https://github.com/esp8266/Arduino/tree ... lashConfig

Then it will print all the relevant information on the serial.

Re: Determine flash size on your module

Posted: Thu Apr 14, 2016 2:25 pm
by platforma
That is of course absolutely fine as well! But I don't have Arduino IDE installed, and setting that up/flashing just to see the flash size seems like a lot of unnecessary work. So having our own way of dealing with this would have been great :)

Re: Determine flash size on your module

Posted: Thu Apr 14, 2016 4:03 pm
by pfalcon
MicroPython ESP8266 port (in git master) now includes "port_diag" module to query various diagnostic information about port/board for own review or submitting with bug reports. Use it as:

Code: Select all

import port_diag
It will be extended over time.

Re: Determine flash size on your module

Posted: Thu Apr 14, 2016 9:13 pm
by gojimmypi
platforma wrote:... how to determine your flash size manually. With your ESP in bootloader mode, use the esptool.py that comes with the pfalcon/esp-open-sdk (change the port accordingly):

Code: Select all

esptool.py --port /dev/ttyUSB0 flash_id
Connecting...
interesting. fwiw, my Manufacturer ID (0xe0) was not on that page:

Code: Select all

mylogin@mymachine:~$ ~/workspace/esptool/esptool.py --port /dev/ttyUSB0 flash_id
Connecting...
Manufacturer: e0
Device: 4016
I'm a usingGeekcreit™ Doit NodeMcu Lua ESP8266 ESP-12E WIFI Development Board:
http://www.banggood.com/Geekcreit-Doit- ... 85891.html

Let me know if this is helpful - I have several other types of boards that I could check if you are interested.

Re: Determine flash size on your module

Posted: Wed Sep 07, 2016 7:59 pm
by beic
Hi there,

Ok, but how can I determine flash size on Windows platform?!

Thank you! ;)

Re: Determine flash size on your module

Posted: Fri Sep 09, 2016 1:46 pm
by platforma
beic wrote:Hi there,

Ok, but how can I determine flash size on Windows platform?!

Thank you! ;)
Same thing, as pfalcon said, import port_diag when connected to your python prompt.

Re: Determine flash size on your module

Posted: Mon Sep 12, 2016 9:00 am
by jms
Or use the NodeMCU flashing tool which just works and knows what you have.

Re: Determine flash size on your module

Posted: Tue Jul 25, 2017 6:57 pm
by c.man
I bought a "WeMos D1 USB NodeMcu Lua V3 CH340G".
I confirm that this has 4 MB (=32 Mbit) flash size memory.
Is there a NodeMCU with 16 MB flash size memory ?
Did you buy someone?

Re: Determine flash size on your module

Posted: Tue Jul 25, 2017 10:55 pm
by deshipu
There is WeMos D1 Mini Pro, which has a 16MB flash chip on it. However, MicroPython still doesn't support that size, and will not make use of all the space.