Chat freely about anything...

User avatar
By QuickFix
#67295 The flash is the 8-pin chip right next to the ESP8266 chip.
Take a magnifying glass and make a note of the characters on it.

If all's well, the partnumber you need starts with 25C (or 25Q) followed by a number, look that number up here:
    05 = 512kbit (64kx8)
    10 = 1Mbit (128kx8)
    20 = 2Mbit (256kx8)

    40 = 4Mbit (512kx8)
    80 = 8Mbit (1024kx8)
    16 = 16Mbit (2048kx8)
    32 = 32Mbit (4096kx8)
    64 = 64Mbit (8192kx8)
    128 = 128Mbit (16384x8)
    256 = 256Mbit (32768x8)
I just took this list somewhere off internet, the ESP actually only has either a 40 (512k), a 80 (1MB) or a 32 (4MB) flash connected to it.
User avatar
By treii28
#79946
Patti4832 wrote:Hello,
Is this a 4MBit version or what type is it?



I recently stumbled on this and it's very handy. It even gave me a surprise when I discovered that one of my ESP-01's in the spares drawer actually had a 16Mbit (2Mbyte) flash on it!


espinfo.cpp
Code: Select all#include <Arduino.h>
#include "FS.h"


void setup() {
   // wait a few seconds before we begin
    delay(4000);
    String realSize = String(ESP.getFlashChipRealSize());
    String ideSize = String(ESP.getFlashChipSize());

    bool flashCorrectlyConfigured = realSize.equals(ideSize);
    FSInfo fs_info;

    Serial.begin(115200);

    if(flashCorrectlyConfigured){
        SPIFFS.begin();
        Serial.println("flash correctly configured, SPIFFS started, IDE size: " + ideSize + ", real size: " + realSize);
    }
    else Serial.println("flash incorrectly configured, SPIFFS cannot start, IDE size: " + ideSize + ", real size: " + realSize);

    SPIFFS.info(fs_info);

    Serial.println("\nVery basic Spiffs example, writing 10 lines to SPIFFS filesystem, and then read them back");
    SPIFFS.begin();

    if (!SPIFFS.exists("/formatComplete.txt")) {
        Serial.println("Please wait 30 secs for SPIFFS to be formatted");
        SPIFFS.format();
        //delay(30000);
        Serial.println("Spiffs formatted");

        File f = SPIFFS.open("/formatComplete.txt", "w");
        if (!f) {
            Serial.println("file open failed");
        } else {
            f.println("Format Complete");
        }
    } else {
        Serial.println("SPIFFS is formatted. Moving along...");
    }

    delay(3000);

    float fileTotalKB = (float)fs_info.totalBytes / 1024.0;
    float fileUsedKB = (float)fs_info.usedBytes / 1024.0;

    float flashChipSize = (float)ESP.getFlashChipSize() / 1024.0 / 1024.0;
    float realFlashChipSize = (float)ESP.getFlashChipRealSize() / 1024.0 / 1024.0;
    float flashFreq = (float)ESP.getFlashChipSpeed() / 1000.0 / 1000.0;
    FlashMode_t ideMode = ESP.getFlashChipMode();

    Serial.printf("\n#####################\n");

    Serial.printf("__________________________\n\n");
    Serial.println("Firmware: ");
    Serial.printf(" Chip Id: %08X\n", ESP.getChipId());
    Serial.print(" Core version: "); Serial.println(ESP.getCoreVersion());
    Serial.print(" SDK version: "); Serial.println(ESP.getSdkVersion());
    Serial.print(" Boot version: "); Serial.println(ESP.getBootVersion());
    Serial.print(" Boot mode: "); Serial.println(ESP.getBootMode());

    Serial.printf("__________________________\n\n");

    Serial.println("Flash chip information: ");
    Serial.printf(" Flash chip Id: %08X (for example: Id=001640E0 Manuf=E0, Device=4016 (swap bytes))\n", ESP.getFlashChipId());
    Serial.printf(" Sketch thinks Flash RAM is size: "); Serial.print(flashChipSize); Serial.println(" MB");
    Serial.print(" Actual size based on chip Id: "); Serial.print(realFlashChipSize);
    Serial.println(" MB ... given by (2^( 'Device' - 1) / 8 / 1024");
    Serial.print(" Flash frequency: "); Serial.print(flashFreq); Serial.println(" MHz");
    Serial.printf(" Flash write mode: %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));

    Serial.printf("__________________________\n\n");

    Serial.println("File system (SPIFFS): ");
    Serial.print(" Total KB: "); Serial.print(fileTotalKB); Serial.println(" KB");
    Serial.print(" Used KB: "); Serial.print(fileUsedKB); Serial.println(" KB");
    Serial.printf(" Block size: %lu\n", fs_info.blockSize);
    Serial.printf(" Page size: %lu\n", fs_info.pageSize);
    Serial.printf(" Maximum open files: %lu\n", fs_info.maxOpenFiles);
    Serial.printf(" Maximum path length: %lu\n\n", fs_info.maxPathLength);

    Dir dir = SPIFFS.openDir("/");
    Serial.println("SPIFFS directory {/} :");
    while (dir.next()) {
        Serial.print(" "); Serial.println(dir.fileName());
        Serial.println(" "); Serial.println(dir.fileSize());
    }

    Serial.printf("__________________________\n\n");

    Serial.printf("CPU frequency: %u MHz\n\n", ESP.getCpuFreqMHz());
    Serial.print("#####################");

    // open file for writing
    File f = SPIFFS.open("/f.txt", "w");
    if (!f) {
        Serial.println("file open failed");
    }
    Serial.println("====== Writing to SPIFFS file =========");
    // write 10 strings to file
    for (int i=1; i<=10; i++){
       f.print("Millis() : ");
        f.println(millis());
        Serial.println(millis());
    }

    f.close();

    // open file for reading
    f = SPIFFS.open("/f.txt", "r");
    if (!f) {
        Serial.println("file open failed");
    } Serial.println("====== Reading from SPIFFS file =======");
    for (int i=1; i<=10; i++){
        String s=f.readStringUntil('\n');
        Serial.print(i);
        Serial.print(":");
        Serial.println(s);
    }
}

void loop() {
    delay(1000);
}