如何诊断 ESP8266/D1 迷你重启循环问题?

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

我正在尝试在 Thingiverse 上构建 Automatic Blind Controller 的软件方面,但我认为根据串行监视器输出,我认为重复重启有问题:

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

看起来这只是引导加载程序重新启动,它对 Arduino setup() 函数的影响还不够大,无法产生任何串行输出。

我该如何调试?

  1. Arduino Blink 草图工作正常 - blinks LED 以合理的速率
  2. Arduino DigitalReadSerial 工作正常 - 在串行端口上输出按钮状态
  3. 甚至 ESP8266WiFi/WiFiScan 工作,我认为这可能是问题所在。
  4. 我怀疑是电源问题(尽管使用了外部电源),所以我开始注释掉 void setup() 的大部分内容以限制其他无用的内容:

摘自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. 继续我对电源问题的怀疑,我已经开始注释掉在 setup() 运行之前可能初始化的任何内容:

摘自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;

...

这似乎仍然无法解决问题。 Arduino IDE 如何选择要库到 link 的内容? Arduino-land 中的 Makefile 相当于什么。

我还应该尝试什么:

  1. 从头开始编写整个代码,并在我进行时添加库,直到它崩溃?
  2. 扔掉 D1 mini,因为它感觉像是劣质仿冒品,再买一个(但不保证会更好)?

我仍然怀疑这是因为它是来自 Banggood with an insufficient current regulator. Hopefully the replacement I've ordered from ebay 的克隆版 Wemos 板,将是具有合理规格并按预期工作的正品。

Reddit 线程 Warning: Clone WeMos D1 Minis with only 150mA 3.3V regualtors [sic] - Buyer Beware 显示问题:

Folks, if the 3.3V regualtor on your brand new Wemos D1 Mini is marked 4Ax or 4Bx where x is some random number/letter, and the middle letter does not have an underline, then congratulations, you have purchased a guaranteed to be flaky WeMos D1 Mini clone. To confirm this, please review the marking codes on this data sheet. This a 150mA 3.3V regulator!

确实,我的电路板有一个标有 4A2D 的调节器:

来自the data sheet


我的猜测可能不正确。带有 LOLIN 标记的(看起来是真的)木板到了:

它同样适用于一些 noddy 代码,但使用更复杂的代码启动时会遇到同样的重启问题:

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

调节器的标记不同 'S2SK',但我还没有找到数据表。我什至不确定那个标志是哪个制造商。

这是旧 Encoder.h 库的问题,有一个新版本或者您可以使用旧的 ESP8266 2.4.2 库,因为它也会停止它。这与ESP中断有关。