I am getting this error in Arduino IDE plz help

I am getting error in arduino IDE installed as windows app for ESP32 board. The error message mentions <E (246) spi_flash: Detected size(4096k) smaller than the size in the binary image header(8192k). Probe failed >

the code is below .

/* This Monitors the Fuel level data at Ananlog input Pin 32 and sends this data along with GPS to the blynk server.  sendData() function reads the analog data at > potpin=32 then stores tis value in an array >samples[numSamples] then the >ratio takes average of it and potvalueavg sends this data to Blynkvirtual pins. The sendGps() simply reads the GPS coordinates and sends them to the Virtual pins of BLYNK, three of them for latitude,longitude and speed and fourth one location pin. 
The hsdConsump() function keeps track of the fuel level when the engine is in off position and stores this in array int rate[numSamples] and calculate max and min and compares them so that the data <ratio> is monitored through comparison of maximum and minimum value and if the level is becoming less then trigger is generated if its more then trigger is generated that fuel is being filled. */

#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "-vpautkpAWeHO868vkMmb-WGBqov4jGg"
//#define BLYNK_AUTH_TOKEN         "N12LFtoQrw3wjv1xqnCpERk6c_fSjivD"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define RXD2 16
#define TXD2 17
const byte numSamples=10;
int engineon,
float ratio=0,
     // multi=1.5684;
unsigned long timeStart=0,
const long interval=3000;             
HardwareSerial neogps(2);
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "INTELLISENSE1";
char pass[] = "hmt4yjsacn";
BlynkTimer timer;
//WidgetMap myMap(V6);
const int potpin=32;
int potvalue;
TinyGPSPlus gps;
void sendGps()
    if (gps.encode(neogps.read()))
  if (!gps.location.isValid())
    Serial.println("Failed to read from GPS Module!");
  double latitude = gps.location.lat();
  double longitude = gps.location.lng();
  float speed1 = gps.speed.kmph();
  Serial.print("Latitude:  ");
  Serial.println(latitude, 6);
  Serial.print("Longitude: ");
  Serial.println(longitude, 6);
  Serial.print("Speed: ");
  Serial.println(speed1, 4);
  // You can send any value at any time.
  Blynk.virtualWrite(V2, String(latitude, 6));
  Blynk.virtualWrite(V3, String(longitude, 6));
  Blynk.virtualWrite(V4, String(speed1));
  /*if(longitude>85.16 && longitude<85.22)
  {{if(latitude>20.94 && latitude<20.96)
void sendData()
  int samples[numSamples];
  Blynk.virtualWrite(V0, millis() / 1000);
  // if (millis() - timeStart > 3000)
  // {
    for (byte j = 0; j < numSamples; j++)
    samples[j] = analogRead(potpin);
    for (byte k = 0; k < numSamples; k++)
     { total += samples[k]; }            // sum values in array
    ratio = total*1.0/numSamples;
    potvalueavg = (4095-ratio)*0.51;
    Blynk.virtualWrite(V1, potvalueavg);
    Blynk.virtualWrite(V5, ratio);
   // Blynk.virtualWrite(V8, engineon);
   // timeStart = millis()+600;
void hsdConsump()
      int rate[numSamples];
      Serial.println("Pin Mode");
     // unsigned long currentMillis=millis();             exp millis
      for (byte l = 0; l < numSamples; l++)
      // if(currentMillis-prevMillis>=interval) {         exp millis
     //  prevMillis=currentMillis;}
      for (byte m = 1; m < numSamples; m++)
void setup()
  // Debug console
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(6000L, sendData);
  neogps.begin(9600, SERIAL_8N1, RXD2, TXD2);
  timer.setInterval(8000L, sendGps);
    timer.setInterval(12000L, hsdConsump);
void loop()

error mssg is below

11:51:48.618 β†’ ets Jun 8 2016 00:22:57
11:51:48.618 β†’
11:51:48.618 β†’ rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
11:51:48.618 β†’ configsip: 0, SPIWP:0xee
11:51:48.618 β†’ clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
11:51:48.665 β†’ mode:DIO, clock div:1
11:51:48.665 β†’ load:0x3fff0030,len:1324
11:51:48.665 β†’ ho 0 tail 12 room 4
11:51:48.665 β†’ load:0x40078000,len:13508
11:51:48.665 β†’ load:0x40080400,len:3604
11:51:48.665 β†’ entry 0x400805f0
11:51:48.854 β†’ E (246) spi_flash: Detected size(4096k) smaller than the size in the binary image header(8192k). Probe failed.
11:51:48.901 β†’
11:51:48.901 β†’ assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)
11:51:48.901 β†’
11:51:48.901 β†’
11:51:48.901 β†’ Backtrace:0x4008307d:0x3ffe3aa00x4008b305:0x3ffe3ac0 0x4009052d:0x3ffe3ae0 0x400e13d6:0x3ffe3c10 0x40082912:0x3ffe3c40 0x40079202:0x3ffe3c90 |<-CORRUPTED
11:51:48.901 β†’
11:51:48.901 β†’
11:51:48.901 β†’
11:51:48.901 β†’
11:51:48.901 β†’ ELF file SHA256: 0000000000000000
11:51:48.901 β†’
11:51:48.901 β†’ Rebooting…
11:51:48.901 β†’ ets Jun 8 2016 00:22:57
11:51:48.901 β†’
11:51:48.901 β†’ rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
11:51:48.901 β†’ configsip: 0, SPIWP:0xee
11:51:48.901 β†’ clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
11:51:48.901 β†’ mode:DIO, clock div:1
11:51:48.948 β†’ load:0x3fff0030,len:1324
11:51:48.948 β†’ ho 0 tail 12 room 4
11:51:48.948 β†’ load:0x40078000,len:13508
11:51:48.948 β†’ load:0x40080400,len:3604
11:51:48.948 β†’ entry 0x400805f0
11:51:49.137 β†’ E (246) spi_flash: Detected size(4096k) smaller than the size in the binary image header(8192k). Probe failed.
11:51:49.184 β†’
11:51:49.184 β†’ assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)
11:51:49.184 β†’
11:51:49.184 β†’
11:51:49.184 β†’ Backtrace:0x4008307d:0x3ffe3aa00x4008b305:0x3ffe3ac0 0x4009052d:0x3ffe3ae0 0x400e13d6:0x3ffe3c10 0x40082912:0x3ffe3c40 0x40079202:0x3ffe3c90 |<-CORRUPTED
11:51:49.184 β†’
11:51:49.184 β†’
11:51:49.184 β†’
11:51:49.184 β†’
11:51:49.184 β†’ ELF file SHA256: 0000000000000000
11:51:49.184 β†’
11:51:49.184 β†’ Rebooting…


This isn’t anything to do with Blynk, or the sketch that you’ve posted.

The uploader is warning you that you’ve chosen a board type that expects the SPI_Flash to be 8192k, but when the board is asked how much SPI_Flash memory it actually has it reports that it has half of what is expected (4096k)

I assume (but this a guess because you haven’t told us what board type you are using and what specific ESP32 chip it has onboard, or what board type you chose in the IDE) that you’ve selected the wrong board type in the IDE.

If you’re using an unusual board that required its own board definition file to be added to the IDE then maybe there is a problem with that board definition file.

Also, you’ll most likely find that Blynk.virtualWrite in the void setup will either be either unsuccessful, or unreliable.
You should add a BLYNK_CONNECTED() function and move your Blynk.virtualWrite to that from your void setup.


1 Like

I am sorry the program is getting compiled , by mistake I have changed the flash size, but still the code is not running after two lines , it is stopping some where. Below is the serial monitor.
kindly help!

12:58:42.615 β†’ [22] Connecting to INTELLISENSE1
12:58:42.615 β†’ [ 35][D][WiFiGeneric.cpp:831] eventCallback(): Arduino Event: 0 - WIFI_READY
12:58:42.710 β†’ [ 126][V][WiFiGeneric.cpp:272] arduino_event_cb(): STA Started
12:58:42.710 β†’ [ 127][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP:, MASK:, GW:
12:58:42.758 β†’ [ 128][D][WiFiGeneric.cpp:831] eventCallback(): Arduino Event: 2 - STA_START
12:58:44.834 β†’ [ 2264][V][WiFiGeneric.cpp:284] arduino_event_cb(): STA Connected: SSID: INTELLISENSE1, BSSID: 56:93:33:ef:d0:07, Channel: 5, Auth: WPA2_PSK
12:58:44.881 β†’ [ 2265][D][WiFiGeneric.cpp:831] eventCallback(): Arduino Event: 4 - STA_CONNECTED
12:58:44.881 β†’ [ 2290][V][WiFiGeneric.cpp:294] arduino_event_cb(): STA Got New IP:
12:58:44.881 β†’ [ 2291][D][WiFiGeneric.cpp:831] eventCallback(): Arduino Event: 7 - STA_GOT_IP
12:58:44.881 β†’ [ 2294][D][WiFiGeneric.cpp:880] eventCallback(): STA IP:, MASK:, GW:
12:58:45.259 β†’ [2647] Connected to WiFi
12:58:45.259 β†’ [2647] IP:
12:58:45.259 β†’ [2647]
12:58:45.259 β†’ ___ __ __
12:58:45.259 β†’ / _ )/ /
_____ / /

12:58:45.259 β†’ / _ / / // / _ / '
12:58:45.259 β†’ /
//_, /////_
12:58:45.259 β†’ /___/ v1.0.1 on ESP32
12:58:45.259 β†’
12:58:45.259 β†’ [2658] Connecting to blynk.cloud:80
12:58:47.097 β†’ [4488] Ready (ping: 1426ms).
12:58:47.145 β†’ potvalue
12:58:47.145 β†’ 0


Please edit your post and remove the blockquotes and the screenshot from your post, then copy/paste the output from your serial monitor with triple backticks at the beginning and end (as you did with your sketch in the first post).

I’d suggest that you take a look at the way in you are using the serial ports, as there appears to be a conflict there.
Also, your code seems to jump between using gps and neogps as your GPS object name.

Once again, these aren’t Blynk related issues.