ESP8266 already in flash mode, still getting "timed out waiting for packet header" error message

  • Thread starter Deleted member 750607
  • Start date

Ya’akov

Joined Jan 27, 2019
9,170
One last thing: flash mode is a temporary state. You use it when you want to upload. So, set flash mode then upload, then reset to run.

Next upload, do it all again. It's not a persistent state.
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
I think its time to step back and start over. I have no idea what im doing with flashing...I need to do some research and start from step one...
 

Ya’akov

Joined Jan 27, 2019
9,170
I think its time to step back and start over. I have no idea what im doing with flashing...I need to do some research and start from step one...
That sounds pretty good. Read about boot loaders and programmers.

Basically, "flashing" or "programming" is the process of getting the sketch (program) into non-volatile memory. It requires the MCU to be put into a mode for that purpose. On the ESP-01, it's a manual process (though it can be automated) on other boards it's hidden from you but it still happens.

I don't know if esptool can toggle the lines for you but in theory you could use some of the serial lines to automate the ESP-01 upload. The manual process isn't hard, though. Just keep in mind you are temporarily putting the MCU into a mode to accept the sketch and then reseting it to allow the program to run.

I think you are very close to making this work, the housekeeping parts are annoying but prerequisite.
 

geekoftheweek

Joined Oct 6, 2013
1,223
Sorry, this is a continuation of a previous thread and I have no idea why the TS would return it to the UNO. I can no longer follow what is going on, so I guess it's time to call it quits.

I hope you can help.
Something about this did sound familiar... I only glanced at the previous thread. I've been working with an ESP12F myself for the last year or so now and unfortunately I'm very familiar with the messages.

right now, no. im trying to flash the esp8266 into programming mode. once I get it in programming mode, ill switch back to connecting the Arduino UNO to the esp8266 and upload my code which is suopposed to track the international space station in the serial monitor.
I don't understand flashing the esp8266 into programming mode. You can only enter programming mode by reset or power on.
 

Ya’akov

Joined Jan 27, 2019
9,170
Something about this did sound familiar... I only glanced at the previous thread. I've been working with an ESP12F myself for the last year or so now and unfortunately I'm very familiar with the messages.



I don't understand flashing the esp8266 into programming mode. You can only enter programming mode by reset or power on.
Just confused terminology caused by a confusion about what flash mode is.
 

geekoftheweek

Joined Oct 6, 2013
1,223
While it probably is not relevant to this project I have found if I have my USB logic analyzer or PicKIT plugged in at the same time it won't connect to the ESP12F. It may be a Linux issue or USB hardware issue. Just thought I would throw it out there.
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
Andreas' videos are excellent. Very well organized and presented, plus a Swiss accent.
ok so im still not very well versed in the hardware, software, flashing, programming methods and all that...but I did manage to get one single reading of the longitude and lattitude of the ISS in my serial monitor. I figured out an ok way to get the board ready for my code, then I skipped the arduino and just programmed right onto the esp8266.

not even sure its an accurate reading or if its working but I think its a good first step toward finishing with something where I can get an update/reading once a minute or so, and display the coordinates on a small OLED display.

thanks again!!!
 
Last edited by a moderator:

Ya’akov

Joined Jan 27, 2019
9,170
ok so im still not very well versed in the hardware, software, flashing, programming methods and all that...but I did manage to get one single reading of the longitude and lattitude of the ISS in my serial monitor. I figured out an ok way to get the board ready for my code, then I skipped the arduino and just programmed right onto the esp8266.

not even sure its an accurate reading or if its working but I think its a good first step toward finishing with something where I can get an update/reading once a minute or so, and display the coordinates on a small OLED display.

thanks again!!!
Great news! It takes time to get all the details organized. Starting out with this stuff is like drinking for a fire hose. Please don't hesitate to ask more questions, it's great to hear about your success!
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
Great news! It takes time to get all the details organized. Starting out with this stuff is like drinking for a fire hose. Please don't hesitate to ask more questions, it's great to hear about your success!
so its able to do one reading, but then it disconnects...thought it would repeat since its under "void loop"

here's my code maybe you can tell me why it won't do more than one reading without uploading the sketch all over...it says disconnecting in the serial monitor after the reading. I know the code says to do that or something at one point, but there must be a way to change it...?

I know that the website im getting the data from doesn't update any more often than maybe once a minute...so how do I keep it connected and have it print a new value every time the website updates?

I wonder if I could rig it to update when I press a button, or if it could just update automatically

main file:
#include "USE_ESP8266.h"
#include <TimeLib.h>
char server [] = "api.open-notify.org";
void digitalClockDisplay();

void setup ()
{
  Serial.begin(115200);
  if (!configureNetwork()) //start the network
  {
    Serial.println("Failed to configure the network");
    while(1)
    {
      delay(0); //halt; ESP8266 does not like infinity loop without a delay
    }
   }
int ret = client.connect(server, 80);
if (ret == 1)
{
  Serial.println("Connected");
  client.println("GET /iss-now.json HTTP/1.0"); //the http request
  client.print("Host: "); client.println(server);
  client.println("Connection: close");
  client.println();
}
else
{
  Serial.println("Connection failed, error was: ");
  Serial.print(ret, DEC);
  while(1)
  {
    delay(0); //halt; esp8266 does not like infinite loop without a delay
  }
}
}

char timestampMarker[] = "\"timestamp\":";
char posMarker[] = "\"iss_position\":";

void loop ()
{
  if (client.available())
  {
    String id = client.readStringUntil('"');
    if (id.equals("timestamp")) //start of timestamp
    {
      if (client.find(':')) //a ":" follows each identifier
      {
      unsigned long timestamp = client.parseInt();
      setTime(timestamp);
      digitalClockDisplay();
      }
      else
      {
        Serial.println("failed to parse timestamp.");
      }
    }
    if (id.equals("iss_position")) //start of position data
    {
      if (client.find(':'))
      {
       while(client.peek () != '}' && client.find('"'))
       {
        String id = client.readStringUntil ('"');
        float val = client.parseFloat ();
        client.find ('"');
        Serial.print(id + ":"); Serial.println(val, 4);
       }
      }
      else
      {
        Serial.print("Failed to parse position data.");
      }
    }
  }
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
}
}
String padDigits(int digit)
{
  String str = String("0") + digit; //put a zero in front of digit
  return str.substring(str.length() - 2);
}

void digitalClockDisplay ()
{
  String datestr = String(year()) + "-" + padDigits(month()) +
                   "-" + padDigits(day());
  String timestr = String(hour()) + ":" + padDigits(minute()) +
                   ":" + padDigits(second());
  Serial.println(datestr + " " + timestr);
}


and here's my header file:


header file:
#include <SPI.h>
#include <ESP8266WiFi.h>
const char ssid[] = "Home25";
const char password[] = "6033216098";
WiFiClient client;

bool configureNetwork()
{
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay (1000);
    Serial.print("Waiting for connection to "); Serial.println(ssid);
  }
    return true;
  }
 
Last edited by a moderator:

Ya’akov

Joined Jan 27, 2019
9,170
Starting at line 76:

C++:
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
Starting at line 76:

C++:
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
yes how do I fix it?
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
You need to understand the code. Follow the logic. You really can't progress if you don't know what these things you are copying and pasting mean and do.

When does this function get called? Why? What is it doing?
yeah I know...this code is so cryptic that its hard for me to understand. I thought I could go back and learn it all once its working...I will keep trying!
 

Ya’akov

Joined Jan 27, 2019
9,170
yeah I know...this code is so cryptic that its hard for me to understand. I thought I could go back and learn it all once its working...I will keep trying!
It's really not that hard. You just have to one step at a time. You need to figure out how the program flow works. If I "fix it" for you, you aren't going to be able to fix the next thing. I am happy to answer questions about your attempts to make it work differently, but keep in mind, it's not broken. The code is running as it was written.

You need to think about changing the program flow to act the way you want. If there is an error condition you can fix that, if the code is written to do something different than you want, you need to rewrite it.
 
Top