ESP8266 ESP01 Module upload error

Hi,

I have received the;

  • ESP-01 ESP8266
  • ESP-01 ESP8266 Programmer Adapter

I have followed the guides around. Added the URL for additional board manager. Installed the library for ESP8266 and went on to try and test uploading first; blank program, then the blink program to test it out. Sadly, i got an error allready on my first goal, when trying to upload clean sketch.

I get the following Errorcode:

. Variables and constants in RAM (global, static), used 28104 / 80192 bytes (35%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ DATA     1496     initialized variables
╠══ RODATA   920      constants       
╚══ BSS      25688    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59667 / 65536 bytes (91%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ ICACHE   32768    reserved space for flash instruction cache
╚══ IRAM     26899    code in IRAM    
. Code in flash (default, ICACHE_FLASH_ATTR), used 232100 / 1048576 bytes (22%)
║   SEGMENT  BYTES    DESCRIPTION
╚══ IROM     232100   code in flash   
esptool.py v3.0
Serial port COM3
Connecting...
Failed uploading: uploading error: exit status 2

To troubleshoot, i have verified the following:

  • I have selected the correct board; Generic ESP8266 Module
  • Selected to proper COM
  • Confirmed CPU frequency at 80MHz
  • Flashsize 512kb at 64kb

Im looking for help to troubeshoot why i cant upload sketch to the Wifi module.
I have read some that i might need to solder a reset button on the programmer module it self, but dunno if thats strictly needed?

Bonusquestion; This is the main goal, to upload a sketch to my arduino uno, and retrieving the data for correct date and time.

Can i upload the following code to my Arduino Uno? I struggle to understand if i need to program them separately, and how i know which code to "split".

//Tilføjer bibloteker til brug for at indlæse wifi og dato-modul.
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>

// Replace with your network credentials
const char *ssid     = "XYZ";
const char *password = "ZYX";

// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

//Week Days
String weekDays[7]={"Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"};

//Month names
String months[12]={"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"};


void setup() {
  // put your setup code here, to run once:

//Setupprogram for WIFI-modul og til at få tiden
 // Initialize Serial Monitor
  Serial.begin(115200);
  
  // Connect to Wi-Fi
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

// Initialize a NTPClient to get time (sætter den til dansk tid, dvs. GMT +1)
  timeClient.begin();
  // Set offset time in seconds to adjust for your timezone, for example:
  // GMT +1 = 3600
  // GMT +8 = 28800
  // GMT -1 = -3600
  // GMT 0 = 0
  timeClient.setTimeOffset(3600);
}

void loop() {

//Indhenter opdateret tid
  timeClient.update();

//EpocTime, antal sekunder der er gået siden 1970.
  time_t epochTime = timeClient.getEpochTime();
  Serial.print("Epoch Time: ");
  Serial.println(epochTime);
  
// Returnere tiden i HH:MM:SS format.  
  String formattedTime = timeClient.getFormattedTime();
  Serial.print("Formatted Time: ");
  Serial.println(formattedTime);  

// Angiver antal time fra 0-24
  int currentHour = timeClient.getHours();
  Serial.print("Hour: ");
  Serial.println(currentHour);  

//Angiver minut fra 0-59
  int currentMinute = timeClient.getMinutes();
  Serial.print("Minutes: ");
  Serial.println(currentMinute); 
   
// Angiver sekund fra 0- 59
  int currentSecond = timeClient.getSeconds();
  Serial.print("Seconds: ");
  Serial.println(currentSecond);  

//0 corresponds to Sunday and 6 to Saturday. 
  String weekDay = weekDays[timeClient.getDay()];
  Serial.print("Week Day: ");
  Serial.println(weekDay);    

  //Get a time structure
//tm_sec: seconds after the minute;
//tm_min: minutes after the hour;
//tm_hour: hours since midnight;
//tm_mday: day of the month;
//tm_year: years since 1900;
//tm_wday: days since Sunday;
//tm_yday: days since January 1;
//tm_isdst: Daylight Saving Time flag;

  struct tm *ptm = gmtime ((time_t *)&epochTime); 

  int monthDay = ptm->tm_mday;
  Serial.print("Month day: ");
  Serial.println(monthDay);

  int currentMonth = ptm->tm_mon+1;
  Serial.print("Month: ");
  Serial.println(currentMonth);

  String currentMonthName = months[currentMonth-1];
  Serial.print("Month name: ");
  Serial.println(currentMonthName);

  int currentYear = ptm->tm_year+1900;
  Serial.print("Year: ");
  Serial.println(currentYear);

  //Print complete date:
  String currentDate = String(currentYear) + "-" + String(currentMonth) + "-" + String(monthDay);
  Serial.print("Current date: ");
  Serial.println(currentDate);

  Serial.println("");

  delay(500);


}

HoLa Comunidad:
Tengo un problema similar, con el esp8266, cuando voy a verificar errores en el codigo me aparece un texto semejante al que aparece en este foro, intenté con el ejemplo blink que consume pocos recursos de la placa y aun asi me aparece ese mensaje cuando verifico errores, lo raro es que si lo cargo el programa sube sin prolemas y se ejecuta con normalidad. Esto me empezo a ocurrir despues de usar la version 2.0. volvi a la version 1.8 y continua el mismo problema. ¿Alguein sabe como se soluciona?

Desintalé el programa y elimine tododas la carpetas, lo reinstalé y sogue lo mismo.

. Variables and constants in RAM (global, static), used 28104 / 80192 bytes (35%)
║ SEGMENT BYTES DESCRIPTION
╠══ DATA 1496 initialized variables
╠══ RODATA 920 constants
╚══ BSS 25688 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59667 / 65536 bytes (91%)
║ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
╚══ IRAM 26899 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 232148 / 1048576 bytes (22%)
║ SEGMENT BYTES DESCRIPTION
╚══ IROM 232148 code in flash

1 Like

I am also receiving similar error and i am unable to upload the code which is the blink code
. Variables and constants in RAM (global, static), used 28104 / 80192 bytes (35%)
║ SEGMENT BYTES DESCRIPTION
╠══ DATA 1496 initialized variables
╠══ RODATA 920 constants
╚══ BSS 25688 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59667 / 65536 bytes (91%)
║ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
╚══ IRAM 26899 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 232148 / 1048576 bytes (22%)
║ SEGMENT BYTES DESCRIPTION
╚══ IROM 232148 code in flash
esptool.py v3.0
Serial port COM9
Connecting....

Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e0:98:06:06:93:d0
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
A fatal esptool.py error occurred: Timed out waiting for packet header

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