ESP8266 Wifi issues with Serial monitor? Exception 0?

Sorry if this is a long post, I'm trying to provide as much info as possible as I'm at a loss what to do (other than assume the boards are junk)

Trying to use the Wifi capabilities of an ESP8266 and debugging in Serial monitor results in a reset loop and exception 0 error. Occurs with 10 / 10 of a batch of Clone D1 Minis recently received.

These are clone D1 Minis. issue doesn't occur when using an official Lolin Mini, or another clone ordered through other channels.

Wemos D1 Mini clones from Aliexpress, from following link:{"sku_id"%3A"66938717676"}

Using a fresh install of the Arduino IDE (

Code such as Blink etc appears to work. But if I put a Serial.println in the blink loop, I get a little more garbage than normal thrown out at the start of the session (IE, normally you would see a few random characters instantly...and then the normal output. With these boards serial Monitor appears to write out junk characters for a few seconds and then normal text appears).

If I attempt to use the HelloServer example code, with the only modification being inputting my wifi SSID and password, I get the following error. This seems to happen no matter which "basic" example code I use.

(I've updated this thread to remove the original stack exception and just post the decoded exception information)

Exception 0: Illegal instruction
PC: 0x403060ff
EXCVADDR: 0x0000003a

Decoding stack results
0x40100bb8: umm_init() at D:\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc\umm_malloc.cpp line 476
0x401000ac: app_entry_redefinable() at D:\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 325
0x401003e8: ets_post(uint8, ETSSignal, ETSParam) at D:\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 181
0x401000c0: app_entry() at D:\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 331

And the HelloServer example code I'm using to troubleshoot.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#ifndef STASSID
#define STASSID "xxx"
#define STAPSK  "xxx"

const char* ssid = STASSID;
const char* password = STAPSK;

ESP8266WebServer server(80);

const int led = 13;

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp8266!\r\n");
  digitalWrite(led, 0);

void handleNotFound() {
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i = 0; i < server.args(); i++) {
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);

void setup(void) {
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to ");
  Serial.print("IP address: ");

  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");

  server.on("/", handleRoot);

  server.on("/inline", []() {
    server.send(200, "text/plain", "this works as well");

  server.on("/gif", []() {
    static const uint8_t gif[] PROGMEM = {
      0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80, 0x01,
      0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00,
      0x10, 0x00, 0x10, 0x00, 0x00, 0x02, 0x19, 0x8c, 0x8f, 0xa9, 0xcb, 0x9d,
      0x00, 0x5f, 0x74, 0xb4, 0x56, 0xb0, 0xb0, 0xd2, 0xf2, 0x35, 0x1e, 0x4c,
      0x0c, 0x24, 0x5a, 0xe6, 0x89, 0xa6, 0x4d, 0x01, 0x00, 0x3b
    char gif_colored[sizeof(gif)];
    memcpy_P(gif_colored, gif, sizeof(gif));
    // Set the background to a random set of colors
    gif_colored[16] = millis() % 256;
    gif_colored[17] = millis() % 256;
    gif_colored[18] = millis() % 256;
    server.send(200, "image/gif", gif_colored, sizeof(gif_colored));


  // Hook examples

  server.addHook([](const String & method, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction contentType) {
    (void)method;      // GET, PUT, ...
    (void)url;         // example: /root/myfile.html
    (void)client;      // the webserver tcp client connection
    (void)contentType; // contentType(".html") => "text/html"
    Serial.printf("A useless web hook has passed\n");
    Serial.printf("(this hook is in 0x%08x area (401x=IRAM 402x=FLASH))\n", esp_get_program_counter());

  server.addHook([](const String&, const String & url, WiFiClient*, ESP8266WebServer::ContentTypeFunction) {
    if (url.startsWith("/fail")) {
      Serial.printf("An always failing web hook has been triggered\n");
      return ESP8266WebServer::CLIENT_MUST_STOP;

  server.addHook([](const String&, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction) {
    if (url.startsWith("/dump")) {
      Serial.printf("The dumper web hook is on the run\n");

      // Here the request is not interpreted, so we cannot for sure
      // swallow the exact amount matching the full request+content,
      // hence the tcp connection cannot be handled anymore by the
      // webserver.
      // we are lucky
      client->sendAll(Serial, 500);
      auto last = millis();
      while ((millis() - last) < 500) {
        char buf[32];
        size_t len = client->read((uint8_t*)buf, sizeof(buf));
        if (len > 0) {
          Serial.printf("(<%d> chars)", (int)len);
          Serial.write(buf, len);
          last = millis();
      // Two choices: return MUST STOP and webserver will close it
      //                       (we already have the example with '/fail' hook)
      // or                  IS GIVEN and webserver will forget it
      // trying with IS GIVEN and storing it on a dumb WiFiClient.
      // check the client connection: it should not immediately be closed
      // (make another '/dump' one to close the first)
      Serial.printf("\nTelling server to forget this connection\n");
      static WiFiClient forgetme = *client; // stop previous one if present and transfer client refcounter
      return ESP8266WebServer::CLIENT_IS_GIVEN;

  // Hook examples

  Serial.println("HTTP server started");

void loop(void) {

I'm wondering if there is a setting I need to change within the Arduino IDE. I've only recently moved from Arduino to ESP8266 and see there are many many options in the board manager. I'm using the default settings at the moment and taken a screenshot of what they are.

The supplier page doesn't list all the board specs, I know it'd be foolish to assume that the specs are an exact match for a genuine Lolin D1, but you'd hope that the same upload settings would work on them though?

I've tried changing the flash erase settings to both Sketch and Wifi, and All, but still have the same issue. ![D1 Settings|392x500]

The codes have been upploaded to just the boards with no sensors or peripherals attached.

Is there anything else I can try before getting in touch with the supplier?

1 Like

@cjamoody, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

I'm not really familiar with the ESP8266 so there is a risk that I'm writing something stupid :wink:

  1. There is an exception decoder that you can download; I've never used it but it should give some form of human readable data.
  2. If not mistaken, there are clones that don't have the amount of memory that is specified. The fact that a Lolin Mini works but the clones don't might point in that direction and can be the cause of your problem.

Thanks @sterretje , apologies for putting the question in the wrong forum, I must admit I'm a little confused as I thought I had worded my question in a non-project specific way. My issue is related purely with the ESP8266 microcontroller and is not related to a specific project. I'm mostly perplexed over the myriad options for the board manager and wanting to ensure I've not missed something that could be causing this. As such I thought installation and troubleshooting was appropriate, as I'm not sure if I've installed the board manager options correctly and I am in the process of troubleshooting it! :slight_smile:

I'll be trying the decoder later today, hopefully it'll provide some more meaningful context.

I'm assuming there is some hardware difference with the clones, but would hope they wouldn't be so massively different as to not be able to perform basic wifi tasks, I'll be speaking to the vendor (Once I've got the exception decoder running )and hopefully getting a meaningful response!

Also, I noticed that this thread appears to crash chrome on my Android phone. Apologies to any other android/chrome users who read this thread and have the same issue!


I've updated the original post with the decoded version of the exception. I've also re-uploaded the screenshot of the settings I've used, shown below:

Pretty much, but one of the things you can find out is what type of flash is on the board. Simply read whatever is written on the flash-chip (that is the 8-pin IC) and google that.
I don't have the same esp-core installed as you so i don't have the same options in your menu, most of the options will be fine in their default setting.

Just to make sure that you don't have anything connected to the units GPIO 0, 1 & 2, which should not be pulled "LOW' at boot, but i think the issue is elsewhere.

Thanks @Deva_Rishi. Unfortunately the older versions of the esp8266 chips have a metal covering so the 8 pin IC is not visible:

The official V3 version does away with that though so it is visible:

I've contacted the supplier and will see if I can get to the bottom of it. I've also just accepted that when it comes to these parts it's better not to be a cheapskate and have ordered some official Lolin parts... They may be 60% more expensive but they're still only about $7 NZD each (bought with NZ they'd be $20-30 ea!)

The D1 mini is my go-to board for most of my projects and I buy whatever is cheapest at the time. Clone or not and usually 5 or 10 in one purchase. I have never seen this error.

I use the defaults in the IDE tools tab, but I have never used the (Clone) board.

I'm wondering if something is stuck in the eeprom from the manufacturers. Am looking in to how to clear the memory and reflash the firmware to confirm this.

I've never need to do this and I have flashed code to dozens or hundreds of ESPs over the years.

I have done occasionally to test how a sketch behaves when it is first uploaded and run (which otherwise can't be tested) The OP shouldn't need to do this, and won't help with the issue i think. The 'All Flash Contents' basically erases the (flash) EEPROM as well as the Wifi settings.

It shouldn't matter at all.
I still suspect that either the Flash size isn't the 4MB specified or somehow one of the boot-mode pins are shorting out. Did you solder the header pins on yourself ?

I did solder the headers on but belive me I've scrutinised them to make sure there aren't any solder bridges.

I've gone back to the suppliers feedback and looked at the negative feedback. Seen several other accounts describing the same kind of boot loop issues, those people have more technical knowledge than me and pointed in the direction of very poor voltage regulators resulting in brown out events and boot loops. This might make sense why I can do a simple blink sketch and get the mac address of the esp8266, but as soon as I try to use the chip properly there is insufficient power? Some did point to the memory too.

The supplier is asking me to return them but as I'm in NZ the postage will be such I think I'll just chalk this down to a learning experience to buy official when it comes to the meat of a project.

Or you could use them at 3.3V.

I just compiled your code in Post#1 on two Wemos D1 Minis. One a Lolin board and the other a random clone board. No problems, no errors.

It would be good to verify that using another regulator, but it may even be just the capacitors. A power issue would be an easy fix.


Same for me too. Its just this batch.

The exception decoder indicates the API has an issue assigning a RAM space. As was mentioned, you may have been short changed on the RAM in some way.


The board does not follow ESPRESSIF's API. Typically the cheap ones do not.


The boards API is old.

Thanks for posting your code and the decoded exception.

I'm too much of a novice to know how to do that. I certainly haven't done any surface mount soldering, and I'd say my "normal"soldering has only recently gotten passable haha.

Thanks Idaho for that input too. I've tried changing the settings to the D1 Lite (1mb) version without success also. Oh well.

I don't think that is really required, though i have to admit, a RAM error is a more likely cause.

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