Determine flash size on your module

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
c.man
Posts: 21
Joined: Thu Jul 06, 2017 9:12 pm

Re: Determine flash size on your module

Post by c.man » Fri Jul 28, 2017 10:24 am

ok. But Is it possible to use the free space to save information ? (ex. temperature acquisition, time, etc)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Determine flash size on your module

Post by pythoncoder » Sat Jul 29, 2017 10:09 am

You can save data to the filesystem using Python file I/O.
Peter Hinch
Index to my micropython libraries.

User avatar
c.man
Posts: 21
Joined: Thu Jul 06, 2017 9:12 pm

Re: Determine flash size on your module

Post by c.man » Sun Sep 03, 2017 1:22 pm

pfalcon wrote: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.
I tried with port_diag library in ESP32 with last micropython, but don't work. Why ?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Determine flash size on your module

Post by Roberthh » Sun Sep 03, 2017 8:00 pm

For both the ESP8266 and ESP32 port, you can use

Code: Select all

import esp
esp.flash_size()
to get the flash_size, which is seen and used by MicroPython. That may be less then the physical flash size, and is shared by both the firmware and the file system.

Ricardo
Posts: 11
Joined: Mon Dec 09, 2019 9:49 pm

Re: Determine flash size on your module

Post by Ricardo » Sun Dec 15, 2019 2:22 am

Hello, MicroPython World! :D

Sorry to bump such an old thread, but I'd like to share some information that could be helpful to others.

As a complete newbie, I wanted to find out how much flash my modules have to know if I could use MicroPython on them - but I received no manual, specs or any kind of details about the modules, and my research on the web produced conflicting results.

So at first I just used the AT commands to get information directly from the module using a terminal software (Putty on Windows). I connected a USB to TTL cable (3.3V) to the module like this:

Code: Select all

VCC <-> VCC, GND <-> GND, TX <-> RX, RX <-> TX, VCC <-> CH_PD
Then I connected the cable to PC, opened the terminal software and connected to the board. I pressed:

Code: Select all

AT+RST[ENTER][CTRL+J]
and got:
ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0

2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rl▒▒rl▒▒
Ai-Thinker Technology Co.,Ltd.

ready
So it seems my board does have 1 MB of flash! :D

I still wanted to test the OP method, but I noticed right away that the link to https://code.coreboot.org/svn/flashrom/ ... ashchips.h is currently dead. Yet, I set the board into bootloader mode (adding these connections to the board):

Code: Select all

GND <-> GPIO0, VCC <-> GPIO2
... and run:

Code: Select all

esptool.py --port COM5 flash_id
... the output directly showed the amount of flash (with no need to consult any other sources):
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ..:..:..:..:..:..
Uploading stub...
Running stub...
Stub running...
Manufacturer: e0
Device: 4014
Detected flash size: 1MB
Hard resetting via RTS pin...
I hope this helps other newbies like me. ;)

Post Reply