I am getting this error mssg in ESP32 board in arduino IDE, kindly 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_TEMPLATE_ID "TMPLF1ZHrzwN"
#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>
#include<TinyGPSPlus.h>
#define RXD2 16
#define TXD2 17
const byte numSamples=10;
int engineon,
    pinmod=36,
    lowest,
    highest,
    gap=30,
    difference,
    total=0;
float ratio=0,
      potvalueavg,
      consumrate=0;
     // multi=1.5684;
unsigned long timeStart=0,
              prevMillis=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()
{
  //-----------------------------------------------------------
  while(neogps.available())
  {
    if (gps.encode(neogps.read()))
    {
      break;
    }
  }
  //-----------------------------------------------------------
  if (!gps.location.isValid())
  {
    Serial.println("Failed to read from GPS Module!");
    return;
  }
  double latitude = gps.location.lat();
  double longitude = gps.location.lng();
  float speed1 = gps.speed.kmph();
  latitude=constrain(latitude,20.94,20.96);
  longitude=constrain(longitude,85.16,85.22);
  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));
  Blynk.virtualWrite(V6,longitude,latitude);
  /*if(longitude>85.16 && longitude<85.22)
  {{if(latitude>20.94 && latitude<20.96)
   Blynk.virtualWrite(V6,longitude,latitude);
  }}*/
  //-----------------------------------------------------------
}
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);
    Serial.println(samples[j]);
    delay(500);
    }
    for (byte k = 0; k < numSamples; k++)
     { total += samples[k]; }            // sum values in array
    ratio = total*1.0/numSamples;
    potvalueavg = (4095-ratio)*0.51;
    Serial.println("potvalueavg");
    Serial.println(potvalueavg);
    Blynk.virtualWrite(V1, potvalueavg);
    Blynk.virtualWrite(V5, ratio);
   // Blynk.virtualWrite(V8, engineon);
   // timeStart = millis()+600;
    total=0;
    potvalueavg=0;
    
  //}
}
void hsdConsump()
{
      int rate[numSamples];
      Serial.println("Pin Mode");
      Serial.println(engineon);
     // unsigned long currentMillis=millis();             exp millis
      for (byte l = 0; l < numSamples; l++)
      {
      // if(currentMillis-prevMillis>=interval) {         exp millis
       rate[l]=ratio;
       delay(400);
     //  prevMillis=currentMillis;}
       }
      for (byte m = 1; m < numSamples; m++)
      {
        highest=max(rate[m],rate[m-1]);
        lowest=min(rate[m],rate[m-1]);
      }
       difference=(highest-lowest);
       if(difference<0)
       Blynk.virtualWrite(V8,difference);
      if(difference>=gap)
      {
      Blynk.virtualWrite(V7,difference);
      }
}
void setup()
{
  // Debug console
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  Serial.println("potvalue");
  Serial.print(potvalue);
  timer.setInterval(6000L, sendData);
  neogps.begin(9600, SERIAL_8N1, RXD2, TXD2);
  timer.setInterval(8000L, sendGps);
  //pinMode(pinmod,INPUT);
    engineon=digitalRead(36);
  Blynk.virtualWrite(V9,engineon);
  while(!engineon)
  {
    timer.setInterval(12000L, hsdConsump);
  } 
}
void loop()
{
  Blynk.run();
  timer.run();
}

error mssg is below

Blockquote
Rebooting...
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...

Blockquote

You should post the error-messages as a code-section
The error is talking about
E (246) spi_flash: Detected size(4096k) smaller than the size in the binary image header(8192k).
I guess you adjusted the flash-size to a wrong value
as this information is hardly available as real textual this i one of the rare cases where providing textual information as picture. Make a screenshot like this

Change the flash-size to 4MB like shown here

best regards Stefan
Be the change you want to see in the world

This notion of be the change you want to see in the world does 3 powerful things when we adopt it:
It stops us from judging others;
It replaces complaining about others with reflection on self;
It stirs us into taking action within the only thing in the world over which we have any control: ourselves.

1 Like

I'd suggest that all the connections be removed from the ESP, except the programing cable and a blank sketch be uploaded to the ESP. If the error goes away its the code. I doubt it but it's worth a shot. Otherwise your ESP32 is broken, one of the core's is failing to start up.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.