Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using NeoEsp8266AsyncUart800KbpsMethod> and calling Serial.begin() again causes wdt reset. #119

Open
sticilface opened this issue Jul 22, 2016 · 3 comments
Assignees

Comments

@sticilface
Copy link

sticilface commented Jul 22, 2016

This behaviour is new since commit esp8266/Arduino#2239, which causes wdt reset whenever serial.begin() was called again, however, this has been fixed in esp8266/Arduino#2307. Prior to all these commits NeoEsp8266AsyncUart800KbpsMethod worked fine. Currently DMA and normal UART work fine, but using async and calling serial.begin() again, even with the same serial speed, and making the stip buffer dirty, causes a wdt. @me-no-dev has suggested that the RX buffer interrupt that is now being used is shared between both Serial and Serial1. When serial is changed, something is getting messed up...

sketch below causes it

#include <NeoPixelBus.h>


//NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(20, 2); // does not wdt 
//NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(20, 2); //  does not wdt

NeoPixelBus<NeoGrbFeature, NeoEsp8266AsyncUart800KbpsMethod> strip(20, 2); //  causes wdt


bool triggered = false; 
uint32_t timer = 0; 

void setup() {

  Serial.begin(115200);
  Serial.println("BEGIN 115200"); 
  strip.Begin();
  strip.Show();

}

void loop() {

  if (millis() - timer > 500) {
    Serial.println("working.....");
    timer = millis(); 
  }

  if (!triggered && millis() > 5000) {

  if (Serial) {
    Serial.println("Changing Serial\n\n");
    Serial.flush();
    Serial.begin(115200);
  }

  strip.Dirty(); // this is important.. otherwise it works.  can set a color too... 
  strip.Show(); 
  triggered = true;
  }

}

@sticilface sticilface changed the title Using NeoEsp8266AsyncUart800KbpsMethod> and changing calling Serial.begin() again causes wdt reset. Using NeoEsp8266AsyncUart800KbpsMethod> and calling Serial.begin() again causes wdt reset. Jul 22, 2016
@Makuna
Copy link
Owner

Makuna commented Sep 3, 2016

In general, calling Serial.begin() will reset hardware state which Dma and Uart methods rely on. For DMA method it is documented that you can't call Serial.begin() after calling NeoPixelBus.Begin() due to this.

The work around is to destruct the NeoPixelBus before calling Serial.begin(), and then recreate it afterwards.

@Makuna
Copy link
Owner

Makuna commented Jan 7, 2019

The fix for this requires changes in the Esp8266 hardware serial core code to expose a model of sharing the single shared interrupt. This work is actively under construction.

@Makuna
Copy link
Owner

Makuna commented Jan 7, 2019

New branch created with changes to match pull request to esp8266/Arduino
https://github.com/Makuna/NeoPixelBus/tree/SharedUartIsr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants