MajicDesigns / MD_Parola

Library for modular scrolling LED matrix text displays
GNU Lesser General Public License v2.1
433 stars 135 forks source link

P.begin() appears to cause continual reboots on Wemos D1 Mini ESP8266 after MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); #46

Closed emeyedeejay closed 5 years ago

emeyedeejay commented 5 years ago

IMPORTANT

Before submitting this issue

Subject of the issue

~Building an internet "always right" clock project. ~Experienced weird board issues with resets, not uploading etc. ~Troubleshoot for a couple of days and have found that board resets continually if I attempt to begin an instance of MD_Parola using P.begin() after MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); ~If I comment out just that line, the sketch works as expected

Your Environment

Library Version: 3.0.2 Arduino IDE version: 1.8.5 Hardware model/type: Wemos D1 Mini v3 (almost certainly a Chinese clone) OS and Version: Microsoft Windows [Version 10.0.17134.648]

Steps to Reproduce

Uncomment line 36 in the code below being //P.begin();

Expected Behaviour

The sketch should run. The sketch runs with line 36 commented out.

Actual Behaviour

Continual resetting of board every ~8 seconds e.g. Serial output as follows. boot mode 3 means "software reset" https://arduino-esp8266.readthedocs.io/en/latest/boards.html#rst-cause

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

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v951aeffa
~ld

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

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v951aeffa
~ld

Code Demonstrating the Issue

#include <SPI.h>
#include <ezTime.h>
#include <ESP8266WiFi.h>          // Replace with WiFi.h for ESP32
#include <ESP8266WebServer.h>     // Replace with WebServer.h for ESP32
#include <AutoConnect.h>
#include <MD_Parola.h>
//#include <MD_MAX72xx.h>

#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
#define MAX_DEVICES 4
//#define CLK_PIN   5
//#define DATA_PIN  6
#define CS_PIN    7

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
//MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

ESP8266WebServer Server;          // Replace with WebServer for ESP32
AutoConnect Portal(Server);

void rootPage() {
  char content[] = "Hello, world ... browse to http://<ip addres>/_ac to configure AP, SSID, password etc. settings";
  Server.send(200, "text/plain", content);
}

void setup() {

  // Open serial communications and wait for port to open:
  Serial.begin(115200);

  // wait for serial port to connect. Needed for native USB port only
  //while (!Serial) {
  //  ;
  //}

  //P.begin();
  //P.print("Hello!");

  // Set ezTime debug level as required [https://github.com/ropg/ezTime#setdebug]
  setDebug(DEBUG);

  //Beging Debug Output
  Serial.println(">>");
  Serial.println();
  Serial.println();
  Serial.println();
  Serial.println("----Debug Begins--------------------------------------------");
  Serial.println();

  // Enable Autoconnect portal and if successful, output Ip to debug
  Server.on("/", rootPage);
  if (Portal.begin()) {
    Serial.println("WiFi connected: " + WiFi.localIP().toString());
  }

  // We're now online

  // Wait for ezTime to get its time synchronized and wait 5 seconds
  waitForSync();
  delay(5000);

  // Create a timezone called myTZ
  Timezone myTZ;

  // Output UTC
  Serial.println();
  Serial.println("<ezTime> UTC: " + UTC.dateTime());
  Serial.println();

  //Set myTZ's location and outpit the result
  myTZ.setLocation(F("Africa/Johannesburg"));
  Serial.print(F("<ezTime> myTZ: "));
  Serial.println(myTZ.dateTime());
  Serial.println(myTZ.getTimezoneName());
  Serial.println(myTZ.getOlson());

  //Set NTP update frequency in seconds
  setInterval(60); //[https://github.com/ropg/ezTime#setserver-and-setinterval]
}

void loop() {
  //P.print(millis()/1000);
  //Handle the Autoconnect client
  Portal.handleClient();

  //Handle the ezTmine events //[https://github.com/ropg/ezTime#events]
  events();
}
emeyedeejay commented 5 years ago

Looks like this was a simple case of an incorrect CS_PIN assignment to a non-existent pin on the Wemos D1 mini.

Thanks for the awesome libraries!