Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By anujmattoo
#54763 I am getting exception 29 and it crashes the ESP12F. I am sending HTTP Request every 15-30ms to ESP. It sometimes crashes after thousand request and sometimes crashes after few hundred request. My project requires HTTP Request to be sent every 15-30ms but I have used Millis in order to receive request and perform some function every 100ms in order to avoid any incomplete close connection or overflow. I have increased the CPU Frequency from 80Mhz to 120Mhz, but it still crashes.

I have attached the ESP Exception stack decoder result.

Code: Select all#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

#define RED_LED     12

WiFiServer server(80);

const char* ssid = "Led_Downlight1";
char GetString[100];
unsigned int long RedValue;
unsigned long previousMillis = 0;       
const long interval = 100;         

void setup()
{

  Serial.begin(115200); //Start communication between the ESP8266-12E and the monitor window
  Serial.println();
  Serial.print("Configuring access point...");

  WiFi.mode(WIFI_AP);
  WiFi.disconnect();
  delay(100);
  WiFi.softAP(ssid);
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("SoftAP IP: ");
  Serial.println(WiFi.softAPIP());

  server.begin();
  Serial.println("Server started");
}

void loop()
{

  WiFiClient client = server.available();
  if (!client)
  {
    return;
  }

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval)
  {

  Serial.println("Somebody has connected :)");

  previousMillis = currentMillis;
  String incoming = client.readStringUntil('\r');
  Serial.println(incoming);
  client.flush();
  incoming.toCharArray(GetString, 100);   

  char *get = strtok(GetString, " ");
  char *request = strtok(NULL, " ");
  char *rtype = strtok(NULL, " ");

  if (request != NULL)
  {
    char *part = strtok(request, "/");
    bool seenSTA = false;
    bool seenRGBW = false;

    while (part)
    {
      if (!strcmp(part, "RGBW"))
      {
        seenRGBW = true;
      }

      else if (seenRGBW)
      {
        if (!strncmp(part, "R=", 2))
        {         
          RedValue  = atoi(part + 2);
          analogWrite(RED_LED, RedValue);
          Serial.print("\n");
          Serial.print("Red:");
          Serial.print(RedValue);

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println(""); //  do not forget this one
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          client.println("Red value: ");
          client.println(RedValue);
          client.println("<br><br>");
          client.println("</html>");

          Serial.println("Client disonnected");
        }
      }
      part = strtok(NULL, "/");
    }
  }
 }
}


Image
Image
Image