These are chat archives for Makuna/NeoPixelBus

18th
Aug 2015
bbx10
@bbx10
Aug 18 2015 09:59

@sticilface I have similar problems and found building with 1.6.4-673-g8cd3697 eliminates WDT reset problem. I also see that disabling interrupts is a key factor.

The WDT reset problem can be created using the example program ESP8266WebServer/HelloServer without NeoPixelBus. Modify the program to add SSID/PSK. Verify is connects. Ping the ESP server using sudo ping -A <ESP IP addr>. This sends about 1000 pings/sec which the ESP handles.

Next modify the loop() function to add noInterrupts().

uint32_t lastTime = 0;

void loop()
{
  server.handleClient();

  // Every 30 ms, disable interupts
  if ((millis() - lastTime) > 30) {
    //uint32_t savedPS;
    lastTime = millis();
    //savedPS = xt_rsil(15);  // does not work either
    noInterrupts();
    delayMicroseconds(2000);
    interrupts();
    //xt_wsr_ps(savedPS);
    Serial.println(lastTime);
  }
}

After downloading the new example code, do sudo ping -A .... On my system this results in WDT reset less than 10 seconds. You can reduce the pings/sec with various ping options but this just makes the failure take longer.

Removing noInterrupts/interrupts eliminates the WDT reset but bit banging the WS281x protocol requires interrupts off.

After putting the noInterrupts/interrupts back in, build with 1.6.4-673-g8cd3697. On my system, the WDT resets do not occur even when handling 1000 pings/sec.

sticilface
@sticilface
Aug 18 2015 11:48
Trying that was on my list, as was working backwards through versions... that means that there might be some hope to solve it. It kind of renders the 8266 useless for anything that requires bit banging.. or interrupts... which would be a shame
sticilface
@sticilface
Aug 18 2015 15:42

@bbx10 you wouldn't happen to know how in 1.6.4-673-g8cd3697, you would send several small strings one after the other using the web server. I have been using

  server.setContentLength(CONTENT_LENGTH_UNKNOWN);
    server.send(200, "text/html", "");
    WiFiClient client = server.client();
    server.sendContent(buf);
...
    server.sendContent(buf);

this works with sending long strings. but the ' server.setContentLength(CONTENT_LENGTH_UNKNOWN);' is not in g8cd3697, and if i take it out it doesn't work?

Michael Miller
@Makuna
Aug 18 2015 17:08
the optimistic yield is interesting for specific scenarios. It will only yield when a certain amount of time has passed since the start of the loop and also when not within an ISR. It was meant to stop yields when they aren't needed or can't be called.
@bbx10 this sample and issue should be raised on the esp8266 chat/repo! Good job tracking this down to a small sample.
sticilface
@sticilface
Aug 18 2015 17:14
True, a well done from me too!
@Makuna, that makes sense. thanks for the explanation.
sticilface
@sticilface
Aug 18 2015 17:44
@bbx10 ignore that question. I just copied over the newer web server... I'm ready to test g8cd3697 with my animations...
bbx10
@bbx10
Aug 18 2015 19:29
@Makuna Ok I will repost on esp8266 chat. I posted here because the test program was inspired by @sticilface commenting out noInterrupts() resulted in no crashes.
sticilface
@sticilface
Aug 18 2015 19:35
I'm trying to work my way through commits... since.. 30th june to work out when this started happening.. i can re-create it easily with your sketch.... unfortunately when i startgoing forwards from the 30th june, i get errors relating to SPIFFS... so it might not be so easy..
Michael Miller
@Makuna
Aug 18 2015 23:29
Also, try it with 500us instead of 2000us if you find the time.