Soft WDT reset on Wemos D1 Mini

21 views Asked by At

I am getting this error when trying to run exaple code on my WeMos D1 Mini (Clone) Here is the code:

I am not sure why this is happening, I have checked that the wiring is correct and this script does work with a Arduino.

I am not sure if the error judt comes from it being an esp8266 as I am very new and just playing around with this thing

#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
/*
   This sample sketch demonstrates the normal use of a TinyGPSPlus (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
 */
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

// The TinyGPSPlus object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup() {
    Serial.begin(115200);
    ss.begin(GPSBaud);
}

void loop() {
    // This sketch displays information every time a new sentence is correctly encoded.
    while (ss.available() > 0) {
        if (gps.encode(ss.read())) {
            displayInfo();
        }
    }

    if (millis() > 5000 && gps.charsProcessed() < 10) {
        Serial.println(F("No GPS detected: check wiring."));
        while(true);
    }
}

void displayInfo() {
    Serial.print(F("Location: ")); 
    if (gps.location.isValid()) {
        Serial.print(gps.location.lat(), 6);
        Serial.print(F(","));
        Serial.print(gps.location.lng(), 6);
    } else {
        Serial.print(F("INVALID"));
    }

    Serial.print(F("  Date/Time: "));
    if (gps.date.isValid()) {
        Serial.print(gps.date.month());
        Serial.print(F("/"));
        Serial.print(gps.date.day());
        Serial.print(F("/"));
        Serial.print(gps.date.year());
    } else {
        Serial.print(F("INVALID"));
    }

    Serial.print(F(" "));
    if (gps.time.isValid()) {
        if (gps.time.hour() < 10) Serial.print(F("0"));
        Serial.print(gps.time.hour());
        Serial.print(F(":"));
        if (gps.time.minute() < 10) Serial.print(F("0"));
        Serial.print(gps.time.minute());
        Serial.print(F(":"));
        if (gps.time.second() < 10) Serial.print(F("0"));
        Serial.print(gps.time.second());
        Serial.print(F("."));
        if (gps.time.centisecond() < 10) Serial.print(F("0"));
        Serial.print(gps.time.centisecond());
    } else {
        Serial.print(F("INVALID"));
    }

    Serial.println();
}

and here is the error:

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

Exception (4):
epc1=0x402013a0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffe50 end: 3fffffd0 offset: 0160
3fffffb0:  00000000 00000000 3ffee6dc 40203378  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 

I have read some post before this and is leads me to believe the program is crashing somewhere

1

There are 1 answers

0
hcheung On BEST ANSWER
    while(true);

Your code probably can't detect the GPS for some reason, so it go into this infinite while(true) loop. For ESP8266, the watchdog timer running in the background need to be "feed" regularly, this infinite loop choke the "dog" to death, change the line to the follow would allow the watchdog to "breath".

while(true) { delay(1); }

This will solve the reboot problem, you still need to deal with why the GPS is not working, so check the connection and test it outdoor with clear view of open sky.