Search code examples
arduinoesp8266

How to diagnose an ESP8266/D1 mini reboot loop issue?


Blind controller

I'm trying to build the software side of an Automatic Blind Controller on Thingiverse, but having am trouble with what I think is repetitive rebooting, based on the serial monitor output:

17:53:28.964 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
17:53:28.964 -> 
17:53:28.964 -> load 0x4010f000, len 3456, room 16 
17:53:28.998 -> tail 0
17:53:28.998 -> chksum 0x84
17:53:28.998 -> csum 0x84
17:53:28.998 -> va5432625
17:53:28.998 -> ~ld
17:53:30.728 -> 
17:53:30.728 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
17:53:30.728 -> 
17:53:30.728 -> load 0x4010f000, len 3456, room 16 
17:53:30.728 -> tail 0
17:53:30.728 -> chksum 0x84
17:53:30.728 -> csum 0x84
17:53:30.728 -> va5432625
17:53:30.728 -> ~ld

It looks like this is just the bootloader restarting, it doesn't get far enough into the Arduino setup() function to produce any serial output.

How should I debug this?

  1. Arduino Blink sketch works fine - blinks LED at a sensible rate
  2. Arduino DigitalReadSerial works fine - outputs button status on serial port
  3. Even ESP8266WiFi/WiFiScan worked which I thought might be the problem.
  4. I'm suspecting a power issue (despite using an external power supply), so I've started commenting out much of void setup() to limit what else starts up to no avail:

Extract from BCV2_02_Blank.ino:

void setup()
{
  // Debug console
  Serial.begin(9600); // I've also tried 115200 to match the bootloader, but ultimately nothing comes out

  //NeoPixel library
  pixels.begin(); // This initializes the NeoPixel library.
  pixels.setBrightness(200);
  
  if (digitalRead(downButtonPin) == HIGH) {
    Serial.println("Resetting...");
    flash_LED(8,String("Green")); 
    delay(3000);
    resetAll();
  }

  Serial.println("Initiallising...");
  //Turn on led as boot status
  pixels.setPixelColor(0,255,165,0); 
  pixels.show();
  delay(2000);

  ...
  1. Continuing with my suspicion of power issues, I've begun to comment out anything that may be initialised before setup() runs:

Extract from BCV2_02_Blank.ino:

//Automatic Blind Controller v2.02
//Copyright CABUU.COM
//Arduino Sketch Version 2.02
//29 May 2019

//v2.02 Include safety cut off feature and LED (requires udate to Blynk app)

//This is a beta, and works for CCW (UP) and CW (Down) motion only
//Replicates a WemoSwitch in Alexa
//Replace the relevant variables below

//------- Substitute your own variables below ------
char ssid[] = "...";         // your network SSID (name)
char password[] = "...";  // your network key
char DeviceName[] = "Blind Controller";       //Name of the device as seen by Alexa etc.

boolean useBlynk = false;                    //Use Blynk
char auth[] = "..."; //Blynk authentication token
//End of user defined variables

#include "WemoSwitch.h"
//#include "WemoManager.h"
#include "CallbackFunction.h"

//#include <Adafruit_NeoPixel.h>
#define PIN            D3
//Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);

// prototypes
boolean connectWifi();

//WemoManager wemoManager;
//WemoSwitch *light = NULL;

...

This still doesn't seem to do the trick. How does Arduino IDE choose what to libraries to link? What's the equivalent of a Makefile in Arduino-land.

What else should I try:

  1. Code the whole thing up from scratch, and adding libraries as I go until it breaks?
  2. Throw the D1 mini away as it feels like a poor quality knock-off and get another one (but not guarantee that'll be any better)?

Solution

  • This is a problem with the old Encoder.h library, there is a new version of this or you can use the older ESP8266 2.4.2 Library as that also stops it. it's something to do with the ESP interrupts.