ESP8266 and the Reset button. How it works?

Hi. I have Wemos D1 board and GPS module connected to tx/rx pins. I uploaded NeoGPS NMEAOrder.ino sketch and see strange effect.

I got this:

NMEAorder.INO: started
21:52:52.406 -> fix object size = 44
21:52:52.453 -> NMEAGPS object size = 124
21:52:52.506 -> Looking for GPS device on Serial
21:52:53.355 -> 
21:52:53.355 -> Check GPS device and/or connections.  No characters received.
21:52:53.409 -> 
21:52:53.409 -> 
21:52:53.409 -> END.
21:52:55.616 -> 
21:52:55.616 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:52:55.663 -> 
21:52:55.663 -> Soft WDT reset
21:52:55.663 -> 
21:52:55.663 -> >>>stack>>>
21:52:55.716 -> 
21:52:55.716 -> ctx: cont
21:52:55.716 -> sp: 3ffffde0 end: 3fffffc0 offset: 01a0
21:52:55.763 -> 3fffff80:  3ffee510 00000000 3ffee5b4 402011d4  
21:52:55.816 -> 3fffff90:  3fffdad0 00000000 3ffee608 3ffee61c  
21:52:55.863 -> 3fffffa0:  3fffdad0 00000000 3ffee608 4020264c  
21:52:55.917 -> 3fffffb0:  feefeffe feefeffe 3ffe85d8 40100b51  
21:52:55.964 -> <<<stack<<<
21:52:55.964 -> 
21:52:55.964 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------

If I pressed Reset button twice I got clear NMEA data in a Serial monitor like:

21:52:50.548 -> $GNGLL,5546.62227,N,03754.65726,E,185251.00,A,A*75
21:52:50.902 -> $GNRMC,185252.00,A,5546.62251,N,03754.65743,E,0.144,,311021,,,A*6C
21:52:50.949 -> $GNVTG,,T,,M,0.144,N,0.267,K,A*3F
21:52:51.002 -> $GNGGA,185252.00,5546.62251,N,03754.65743,E,1,04,3.98,168.3,M,13.0,M,,*49
21:52:51.049 -> $GNGSA,A,3,17,14,32,,,,,,,,,,4.83,3.98,2.73*15
21:52:51.102 -> $GNGSA,A,3,67,,,,,,,,,,,,4.83,3.98,2.73*16
21:52:51.149 -> $GPGSV,4,1,13,01,13,024,,06,18,131,,10,01,300,,12,32,261,11*73
21:52:51.203 -> $GPGSV,4,2,13,13,06,187,,14,18,084,20,15,14,215,,17,47,063,30*71
21:52:51.303 -> $GPGSV,4,3,13,19,65,104,13,22,03,033,09,24,67,259,,25,02,265,*77
21:52:51.350 -> $GPGSV,4,4,13,32,11,333,26*4D
21:52:51.403 -> $GLGSV,3,1,09,66,18,255,,67,28,310,17,68,11,359,22,75,48,099,18*6C
21:52:51.450 -> $GLGSV,3,2,09,76,68,313,,77,17,294,,84,20,024,,85,57,092,16*61
21:52:51.503 -> $GLGSV,3,3,09,86,32,159,*5E

I can press again Reset button and got first code block again. So what does it do actually??

Hi! When you see an output like the first, normally, there is a programming error.
Check if you are pointing at variables in the correct way... It can be just a problem like "load the fourth value in a three elements array"

Sketch is an example from library. Also I tried another one, but same strange issue - "check wiring"

#include <NMEAGPS.h>
#include <GPSport.h>

#ifndef NMEAGPS_RECOGNIZE_ALL
  #error You must define NMEAGPS_RECOGNIZE_ALL in NMEAGPS_cfg.h!
#endif

#ifdef NMEAGPS_INTERRUPT_PROCESSING
  #error You must *NOT* define NMEAGPS_INTERRUPT_PROCESSING in NMEAGPS_cfg.h!
#endif

static NMEAGPS  gps         ; // This parses received characters
static uint32_t last_rx = 0L; // The last millis() time a character was
                              
static NMEAGPS::nmea_msg_t last_sentence_in_interval = NMEAGPS::NMEA_UNKNOWN;
static       uint8_t       prev_sentence_count       = 0;
static       uint8_t       sentence_count            = 0;
static const uint8_t       MAX_SENTENCES             = 20; // per second
static NMEAGPS::nmea_msg_t sentences[ MAX_SENTENCES ];

static void recordSentenceTypes()
{
  // Always save the last sentence, even if we're full
  sentences[ sentence_count ] = gps.nmeaMessage;
  if (sentence_count < MAX_SENTENCES-1)
    sentence_count++;
  
} // recordSentenceTypes

static void printSentenceOrder()
{
  DEBUG_PORT.println( F("\nSentence order in each 1-second interval:") );

  for (uint8_t i=0; i<sentence_count; i++) {
    DEBUG_PORT.print( F("  ") );
    DEBUG_PORT.println( gps.string_for( sentences[i] ) );
  }

  if (sentences[sentence_count-1] == LAST_SENTENCE_IN_INTERVAL) {
    DEBUG_PORT.print( F("\nSUCCESS: LAST_SENTENCE_IN_INTERVAL is correctly set to NMEAGPS::NMEA_") );
  } else {
    DEBUG_PORT.print( F("\nERROR: LAST_SENTENCE_IN_INTERVAL is incorrectly set to NMEAGPS::NMEA_") );
    DEBUG_PORT.print( gps.string_for( LAST_SENTENCE_IN_INTERVAL ) );
    DEBUG_PORT.print( F("!\n  You must change this line in NMEAGPS_cfg.h:\n"
                          "     #define LAST_SENTENCE_IN_INTERVAL NMEAGPS::NMEA_") );
  }
  DEBUG_PORT.println( gps.string_for( sentences[sentence_count-1] ) );
  DEBUG_PORT.println();

} // printSentenceOrder

static void GPSloop()
{  
  while (gpsPort.available()) {
    last_rx = millis();

    if (gps.decode( gpsPort.read() ) == NMEAGPS::DECODE_COMPLETED) {

      if (last_sentence_in_interval == NMEAGPS::NMEA_UNKNOWN) {
        // Still building the list
        recordSentenceTypes();
        DEBUG_PORT.print( '.' );
      }
    }
  }
} // GPSloop

static bool quietTimeStarted()
{
  uint32_t current_ms       = millis();
  uint32_t ms_since_last_rx = current_ms - last_rx;

  if (ms_since_last_rx > 5) {
           bool     getting_chars   = (ms_since_last_rx < 1000UL);
    static uint32_t last_quiet_time = 0UL;
           bool     just_went_quiet =
                            (((int32_t) (last_rx - last_quiet_time)) > 10L);
           bool     next_quiet_time =
                               ((current_ms - last_quiet_time) >= 1000UL);

    if ((getting_chars && just_went_quiet)
          ||
        (!getting_chars && next_quiet_time)) {

      last_quiet_time = current_ms;  // Remember for next loop

      //  If we're not getting good data, make some suggestions.
      
      bool allDone = false;

      if (!getting_chars) {
        
        DEBUG_PORT.println( F("\nCheck GPS device and/or connections.  No characters received.\n") );
        
        allDone = true;

      } else if (sentence_count == 0) {
        
        DEBUG_PORT.println( F("No valid sentences, but characters are being received.\n"
        "Check baud rate or device protocol configuration.\n" ) );

        allDone = true;
      }

      if (allDone) {
        DEBUG_PORT.print( F("\nEND.\n") );
        for (;;)
          ; // hang!
      }

      // No problem, just a real GPS quiet time.
      return true;
    }
  }

  return false;
  
} // quietTimeStarted

static void watchForLastSentence()
{
  if (quietTimeStarted()) {

    if (prev_sentence_count != sentence_count) {
      prev_sentence_count = sentence_count;
      sentence_count      = 0;
      
    } else if (sentence_count > 0) {
      last_sentence_in_interval = sentences[ sentence_count-1 ];
    }
  }

} // watchForLastSentence

void setup()
{
  DEBUG_PORT.begin(9600);
  while (!DEBUG_PORT)
    ;

  DEBUG_PORT.print( F("NMEAorder.INO: started\n") );
  DEBUG_PORT.print( F("fix object size = ") );
  DEBUG_PORT.println( sizeof(gps.fix()) );
  DEBUG_PORT.print( F("NMEAGPS object size = ") );
  DEBUG_PORT.println( sizeof(gps) );
  DEBUG_PORT.println( F("Looking for GPS device on " GPS_PORT_NAME) );
  DEBUG_PORT.flush();
  
  gpsPort.begin( 9600 );
}

//--------------------------

void loop()
{
  GPSloop();

  if (last_sentence_in_interval == NMEAGPS::NMEA_UNKNOWN)
    watchForLastSentence();
  else {

    printSentenceOrder();
    for (;;)
      ; // All done!
  }
}

Another thing to do is download and install into the Arduino IDE the ESP Exception Decoder. Then you can paste the exception into the exception decoder and then post those results.

Also, using one of those ESP8266 things? You'll want some sort of software serial library.