Closed rajeshdoshi closed 2 years ago
use the stack decoder IDE plugin https://github.com/me-no-dev/EspExceptionDecoder
Hi. Thanks for your reply and help. I have found that it is the delay which makes the difference. If I do not have delay called, the ESP resets abruptly. I have no explanation for it.
Hi, I have connected ESP8266 to ENC28J60. Using 5 and 4 pins for CS and Reset respectively. Following code works beautifully well.
include
typedef unsigned char N8;
define LED D0
EthernetServer server(port); uint8_t mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; IPAddress ip = {192,168,131,171}; uint8_t myDns[] = {192,168,131,1};
unsigned long ledmil; unsigned char ledon=0; unsigned char xmbuf[60]; unsigned char datrdy=0; int xmcnt;
//======================================================================= // Power on setup //======================================================================= void setup() { Serial.begin(9600); Serial.println();
pinMode(4, OUTPUT); digitalWrite(4,LOW); delay(100); digitalWrite(4,HIGH);
Ethernet.init(5); Ethernet.begin(mac,ip,myDns); //Connect to wifi
Serial.println(Ethernet.localIP()); server.begin(); ledmil=millis(); } //======================================================================= // Loop //======================================================================= unsigned char buf; unsigned long curmil;
void loop() { EthernetClient client = server.available();
if (client) { if(client.connected()) { Serial.println("Client Connected"); }
} client.stop(); Serial.println("Client disconnected");
Ethernet.maintain(); } Ethernet.maintain(); }//=======================================================================
However, moment I replace while(Serial.available()>0) { client.write(Serial.read()); }
with if(datrdy) { client.write (xmbuf,13'); datrdy=0; } ESP8266 starts resetting randomly on receipt of data.