[SOLVED] Memory upgrade: Expand flash to 32 MB

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
crizeo
Posts: 42
Joined: Sun Aug 06, 2017 12:55 pm
Location: Germany

[SOLVED] Memory upgrade: Expand flash to 32 MB

Post by crizeo » Mon Oct 09, 2017 3:49 pm

Hey!

First of all: What do I want to do? I want to increase the memory of my ESP8266 (or ESP32) to at least 28MB using as few space as possible.

I saw a video where somebody replaced the memory chip (hardware) on the ESP8266 to get 4MB instead of 1MB. Now, I have a ESP-12F with 4MB and thought of expanding the memory to 32MB, because I don't want to use a microSD card. Therefore, I bought a WINBOND 25Q256FV (32MB; unfortunately with SOIC 300-MIL pin configuration, which should work as well, but I will buy the 8-pin version later). The problem is that esptool only supports flash memory up to 16MB. So: Is there a solution to increase the memory of an ESP to 32MB? I don't want to use a SD card because the module would require to much extra space.

E. g.: Is it possible to use the six extra pins on the ESP-12F (and 12E) model? They have something to do with memory but I couldn't figure out how to use them in order to replace/expand the memory...

Thanks!

Edit: For solution see post 11.
Last edited by crizeo on Sat Oct 14, 2017 4:05 pm, edited 1 time in total.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Memory upgrade: Expand flash to 32 MB

Post by deshipu » Mon Oct 09, 2017 4:43 pm

It gets worse. The esptool.py only supports up to 16MB, but MicroPython itself only supports up to 4MB. We are still waiting for support for the 16MB D1 Mini Pro boards. So even if you got that memory chip to work with ESP8266, MicroPython wouldn't use more than 4MB of it.

There is another idea: you can connect the memory chip over the user SPI, and use it as if it was an SD card — you would of course need to write a driver similar to that for the SD card, but that should be relatively easy, and it's done in Python.

crizeo
Posts: 42
Joined: Sun Aug 06, 2017 12:55 pm
Location: Germany

Re: Memory upgrade: Expand flash to 32 MB

Post by crizeo » Mon Oct 09, 2017 5:17 pm

Hm, thanks for your answer anyway! To explain my intention a bit more in detail: I have a btree database (~23 MB), which I want to access (only read, not write!). All the rest fits on the 4 MB flash memory.

Regarding the second part of your answer: You are talking about the additional six pins on ESP-12 (GPIO 6-11)? I can't imagine that it is easy to write a driver for this purpose :shock: Could this driver help?

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

Re: Memory upgrade: Expand flash to 32 MB

Post by Roberthh » Mon Oct 09, 2017 6:27 pm

SPI would require 3 GPIO ports (MISO, MOSI and CS). And a blueprint of the driver is flashbdev.py in the esp8266/modules directory of the repository. https://github.com/micropython/micropyt ... ashbdev.py.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Memory upgrade: Expand flash to 32 MB

Post by deshipu » Mon Oct 09, 2017 8:46 pm

crizeo wrote:Regarding the second part of your answer: You are talking about the additional six pins on ESP-12 (GPIO 6-11)?
No, I mean the gpio12-15 pins of the "user" SPI, also known as HSPI, the gpio6-11 pins are the flash SPI, which is already being used by the flash built in on the module, and are not available from within MicroPython.

crizeo
Posts: 42
Joined: Sun Aug 06, 2017 12:55 pm
Location: Germany

Re: Memory upgrade: Expand flash to 32 MB

Post by crizeo » Mon Oct 09, 2017 9:42 pm

Hm, okay, thanks.. So I will probably have to stay with my SD card :/ Will try to solder it.

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Memory upgrade: Expand flash to 32 MB

Post by mcauser » Tue Oct 10, 2017 4:51 am

If you are using a D1 Mini, there's a SD card shield wired up to the SPI pins:
https://www.aliexpress.com/store/produc ... 62865.html
https://wiki.wemos.cc/products:d1_mini_ ... ard_shield
D5 - GPIO14 - SCK
D6 - GPIO12 - MISO
D7 - GPIO13 - MOSI
D8 - GPIO15 - SS

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

Re: Memory upgrade: Expand flash to 32 MB

Post by pythoncoder » Tue Oct 10, 2017 8:01 am

@crizeo There is a MicroPython driver for a Winbond W25Q32 chip here https://github.com/peterhinch/micropyth ... r/flash.py which might be adapted for your Winbond W25Q256FV chip. It uses buffering to minimise wear on frequently updated sectors - a read-only version for the ESP8266 could be radically simplified.
Last edited by pythoncoder on Tue Oct 10, 2017 8:28 am, edited 1 time in total.
Peter Hinch
Index to my micropython libraries.

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

Re: Memory upgrade: Expand flash to 32 MB

Post by Roberthh » Tue Oct 10, 2017 8:10 am

Hi Peter, the link you gave does not work. For some reason it includes the closing bracket. This one works:
https://github.com/peterhinch/micropyth ... r/flash.py

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

Re: Memory upgrade: Expand flash to 32 MB

Post by pythoncoder » Tue Oct 10, 2017 8:28 am

Thanks, Robert. Now fixed.
Peter Hinch
Index to my micropython libraries.

Post Reply