Micromod ESP32 W25QXX128 library

I would like to use the Winbond W25QXX128MBIT eeprom on the ESP32 Micromod processor board for data storage, preferably with a structure similar to SPIFFS. I am using the Platformio IDE and I have looked at the various arduino libraries but none seem to be just for this chip. I would greatly appreciate the details if anyone has found and used such a library.

Cheers, Ron

There’s a link to some files here (scroll down a bit) https://github.com/Aircoookie/WLED/issues/1647 that might be what you’re after?

Thanks for that suggestion. However, I think they were dealing with flashing the chip stand-alone, whereas I need to write/read the W25xx from the ESP32 under program control.

Looking at the Sparkfun drawing for the ESP32 Micromod CPU board, the 6 W25xx lines are driven from the ESP32 SPICLK, SPIQ, SPID, SPIHD, SPIWP, and SPICS0 lines. I would have assumed that putting this chip on their board, Sparkfun would have provided software to access it, or at least make a reference to some third party software they based the installation on and have performed some testing with.

So my original question remains: does anyone know of software for the ESP32 that can drive a W25xx eeprom?

I have now tried about every serialflash library available to platformio to try and access the W25QXX128 flash chip on the Sparkfun ESP32 Micromod board. Whatever the problem the chip just reboots when accessing the begin method. It prints:

ets Jul 29 2019 12:21:46

and reboots. It would reboot whether the SPI init code was there or not. The library I am currently using is paulstoffregen/SerialFlash@0.0.0-alpha+sha.2b86eb1e43. I have also tried the Sparkfun library with the same results.

The test code is:

#include <Arduino.h>
#include <SerialFlash.h>
#include <SPI.h>

const byte W25X_SELECT = 11;

void setup() 
{
   Serial.begin(115200);
   Serial.println("Serial flash test");
   // Sparkfun ESP32 micromod
   // sck  - sck   6  unchanged
   // miso - sdo   7
   // mosi - sdi   8
   // ss   - swp  10
   // scs  - CS   11
   // 
   SPI.begin(6, 7, 8, 10);
   SPI.setFrequency(1000000);
   SPI.setDataMode(SPI_MODE0);
   if (SerialFlash.begin(W25X_SELECT) == false)
   {
      Serial.println("Unable to access flash chip");
   }
   else
   {
      Serial.println("W25Q connected");
   }
}

I have not worked on the W25Qxxxx (yet), but found an article that might be of interest :

https://forum.arduino.cc/t/esp32-and-wi … b/887858/3

There is mentioning of :

After power-up, /CS must transition from high to low before a new instruction will be accepted. The /CS
input must track the VCC supply level at power-up and power-down (see “Write Protection” and Figure
58). If needed a pull-up resister on the /CS pin can be used to accomplish this.

I do not see a pull-up on CS in the Sparkfun schematics…

Thanks Paul. Yes, the Micromod ESP32 board presumably must rely on the CPU to manage the power up. After much web searching I cannot find any example of an ESP32 driving a W25QXX with 6 lines. I am inclined to think Sparkfun thought it a good idea to add some flash memory but never worked through making it work. At least I cannot find an example where they deal with this particular board. I need to debug this myself so am investing in an ESP-Prog. Will keep posting when setup.

Regards,

Ron

I am afraid it will never work.

I used a simple sketch (attached). NO SPI, NO Serialflash !

If I select any of the GPIO 6 to 11 which are used for flash it will reboot. E.g. selecting pin 10 I get repeatedly:

test of pinmode flash test
Pin selected: 10
ets Jul 29 2019 12:21:46

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0

If you select another GPIO ( say 2 or 17) it all works.

I found a post on another forum about the SPI_FAST_FLASH_BOOT : Make sure you are NOT using GPIO 6-11 for any purpose and leave these pins floating on your custom board. These pins are connected to the on-board flash and will result in the error you show if you are attempting to use them.

The ESP32 chip on the Micromod is an ESP32-D0WDQ6. The datasheet (https://www.espressif.com/sites/default … eet_en.pdf) has a clear warning about some GPIO’s (including GPIO 6 -11):

allocated for communication with in-package flash/PSRAM and NOT recommended for other uses.

I think it was a design error by Sparkfun and they do not mention the possibility of using the SerialFlash anywhere.

test1.zip (435 Bytes)

Many thanks Paul. I had wondered about the lack of SparkFun references to this chip. Darn nuisance as I had planned to use it in my design. However, not the end of the world.

Thanks again,

Ron

The ESP32 they use with a zero as the second digit of the part number has no internal FLASH. The only internal non volatile memory in the ESP32 is ROM. As in “write once at the factory”.

The W25Q128 16 megabyte flash chip on the MicroMod board is the only flash in the system.

It is the flash memory all your user code runs from.

I have no doubt at all that your program that is trying to run from the QSPI FLASH chip would crash if you tried to interfere with the QSPI pins on the CPU.