Moar flash 4MB->16MB

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
AaronKelly
Posts: 7
Joined: Sun Jun 19, 2016 7:44 am

25Q128 16MB Flash chip compatibility

Post by AaronKelly » Sun Jul 17, 2016 4:12 am

Hey there, I was wondering if the 25Q128 was compatible with micropython. I know that the nodeMCU firmware supports it but was wondering if anyone had tried it out with micropython? Thanks in advance.

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

Re: 25Q128 16MB Flash chip compatibility

Post by pythoncoder » Mon Jul 18, 2016 6:58 am

As far as I know nobody has written a driver. One way to write one is to implement the block protocol, which enables MicroPython to create and use a FAT filesystem on the device. The block protocol is normally straightforward to implement.

A quick glance at the datasheet indicates that the SPI interface should be compatible. However the smallest storage unit that can be erased is 2Mb or 256KB. On smaller devices to modify a sector you buffer it in RAM, modify the RAM image, erase the sector, then write the buffered image back to flash. Lack of RAM will preclude this approach. So a driver would have to perform the buffering to the device itself, copying a page at a time (modifying it on the fly) to an unused sector, erasing the original sector, and copying the data back. Better would be to devise a way of remapping the sector. This would speed things up but you'd need to store a mapping table on the device. You'd need to keep a portion of the device outside of the declared capacity to support the buffering and any mapping table; even if that were only two sectors, that's 25% of its capacity. So the device architecture isn't ideal.

But an interesting project...
Peter Hinch
Index to my micropython libraries.

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

Moar flash 4MB->16MB

Post by mcauser » Fri Jul 22, 2016 12:30 am

I haven't seen any ESP8266 boards running more than 4MB flash, presumably to keep production costs to a minimum.

Has anyone tried desoldering their 4MB flash chip and replacing it with a 8MB or 16MB chip?
Would MicroPython be able to use the extra space?

This guy upgraded an ESP-03 (512KB) with 16MB WinBond W25Q128FV:
http://www.instructables.com/id/ESP-03- ... 128-M-Bit/
http://www.esp8266.com/viewtopic.php?p=49002#p49002

Given that it's SPI flash, and SDHC cards communicate over SPI, could you even replace the chip with a MicroSD slot and add your favourite high speed Micro SDHC card for unlimited* storage!?
Last edited by mcauser on Fri Jul 22, 2016 12:42 am, edited 1 time in total.

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

Re: Moar flash

Post by mcauser » Fri Jul 22, 2016 12:40 am

Hmm... max 16MB.
Current ESP8266EX chip SPI interface supports external Flash, a theoretical maximum support to 16 MB of SPI flash. At present, the module is 4MB of external SPI Flash.
Source: http://www.electrodragon.com/w/ESP-12F_ ... Wifi_Board

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

Re: Moar flash 4MB->16MB

Post by mcauser » Fri Jul 22, 2016 5:52 am

I bought a Winbond W25Q128FV 128Mb/16MB and am going to try to upgrade a WeMos D1 Mini.
Will post my results in a few weeks once it arrives. On the slow boat from China.

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

Re: 25Q128 16MB Flash chip compatibility

Post by mcauser » Fri Jul 22, 2016 8:34 am

Are you talking about replacing an existing 512KB through 4MB flash chip with a 16MB one?
That's what I'm planing on doing: viewtopic.php?f=16&t=2161
I have until the package arrives to figure out if it can be done and how to do it :)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Moar flash 4MB->16MB

Post by pfalcon » Fri Jul 22, 2016 9:26 am

Please avoid creating duplicate topics. And the answer to the original question: MicroPython uses standard ESP8266 SDK API to access flash, so as long as ESP8266 SDK supports a particular chip, it will work (to the extent supported by SDK).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply