-->
Page 1 of 3

Reset Issue with ESP8266

PostPosted: Wed Jun 29, 2016 3:24 pm
by davemohla
Hello,

I have an ESP8266 Huzzah breakout board from Adafruit and am having a reset issue.

I ran the example ESP8266 sketches (WiFiClient, WiFiWebServer, and WiFiAccessPoint) and was able to get them to work.

I then connected it to an ArduCam and was able to get the sketch to work. But then later on, the same sketch started giving me reset errors shown below.

I'm powering the device using an FTDI cable from Adafruit connected to my laptop's USB port. I'm using pins GPIO4, GPIO5, GPIO12, GPIO13, GPIO14, GPIO16, GND, and 3.3V. The ESP8266 Huzzah breakout board takes care of pulling up or down the GPIO0, Reset, GPIO2, CH_PD, and GPIO15 pins to their appropriate states.

Do you know why it keeps resetting and how to fix it? The reasons for the reset from the Serial Output are "rst cause:2, boot mode:(1,7)" and "rst cause:4, boot mode:(1,7)".

I searched on this forum and wasn't able to find the cause of this issue.

Thanks for your help!

Serial Output
ArduCAM Start!
OV5642 detected.

Connecting to HOME-D292
WiFi connected

10.0.0.9
Server started
CAM Capturing
capture total_time used (in miliseconds):132
CAM Capture Done!
send total_time used (in miliseconds):2
CAM send Done!
CAM Capturing

Soft WDT reset

ctx: cont
sp: 3fff23e0 end: 3fff26d0 offset: 01b0

>>>stack>>>
3fff2590: 00000041 3fff0be0 3fff1588 40206194
3fff25a0: 0000a337 3fff167c 00000008 402061e4
3fff25b0: 4020179e 000007d0 3fff167c 40206274
3fff25c0: 00000001 3fff167c 3fff0be0 40202976
3fff25d0: 3fff165c 000000f7 000000f7 40204734
3fff25e0: 00000001 00000001 3fff35cc 402079c2
3fff25f0: 00000000 000000f7 3fff35cc 4020472a
3fff2600: 3fff35cc 3fff0c2c 3fff35cc 40204766
3fff2610: 00000000 00000000 00000000 402071f4
3fff2620: 3fff35cc 3fff0c2c 3fff0bec 402047f9
3fff2630: 3fff3684 0000000f 00000008 402036b8
3fff2640: 3fff0c2c 3fff0bec 3fff16b0 00000001
3fff2650: 00000001 40203dc4 0000000f 40203642
3fff2660: 00000000 00000000 3fff0bec 3fff16a8
3fff2670: 00000001 3fff0c10 3fff0bec 40204a40
3fff2680: 3ffea878 00000000 000003e8 402079b8
3fff2690: 00000000 3fff39bc feefeffe feefeffe
3fff26a0: 3fffdad0 00000000 3fff16a0 40202798
3fff26b0: 3fffdad0 00000000 3fff16a0 402077f0
3fff26c0: feefeffe feefeffe 3fff16b0 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,7)


ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Re: Reset Issue with ESP8266

PostPosted: Wed Jun 29, 2016 4:37 pm
by martinayotte
You should install the EspExceptionDecoder from https://github.com/me-no-dev/EspExceptionDecoder to got more meaningful stacktrace.

Re: Reset Issue with ESP8266

PostPosted: Wed Jun 29, 2016 4:51 pm
by davemohla
Thank you martinayotte.

I installed EspExceptionDecoder. Below is the decoded error stack.

I'm not really sure how to read it or what it means. It seems like it is referring to a number of libraries that I'm using.

Are you able to determine what is causing the issue? If there's any more information you need or debugging I can do, please let me know! Thanks :)

0x40206194: ArduCAM::bus_read(int) at /Users/davemohla/Documents/Arduino/libraries/ArduCAM/ArduCAM.cpp line 356
0x402061e4: ArduCAM::read_reg(unsigned char) at /Users/davemohla/Documents/Arduino/libraries/ArduCAM/ArduCAM.cpp line 356
0x4020179e: delay at /Users/davemohla/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_wiring.c line 53
0x40206274: ArduCAM::get_bit(unsigned char, unsigned char) at /Users/davemohla/Documents/Arduino/libraries/ArduCAM/ArduCAM.cpp line 356
0x40202976: serverCapture() at /Users/davemohla/Documents/Arduino/Old/ArduCam/ArduCAM_ESP8266_OV5642_Capture/ArduCAM_ESP8266_OV5642_Capture.ino line 95 (discriminator 1)
0x40204734: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x402079c2: std::_Function_handler ::_M_invoke(std::_Any_data const&) at /Users/davemohla/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2073
0x4020472a: std::function ::operator()() const at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x40204766: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x402071f4: String::String(String const&) at /Users/davemohla/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 519
0x402047f9: ESP8266WebServer::_handleRequest() at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x402036b8: WiFiClient::~WiFiClient() at /Users/davemohla/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClient.cpp line 149
0x40203dc4: FunctionRequestHandler::canHandle(HTTPMethod, String) at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x40203642: ClientContext::unref() at /Users/davemohla/Documents/Arduino/libraries/ESP8266WiFi/src/WiFiClient.cpp line 149
0x40204a40: ESP8266WebServer::handleClient() at /Users/davemohla/Documents/Arduino/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 342
0x402079b8: std::_Function_handler ::_M_invoke(std::_Any_data const&) at /Users/davemohla/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2069
0x40202798: loop at /Users/davemohla/Documents/Arduino/Old/ArduCam/ArduCAM_ESP8266_OV5642_Capture/ArduCAM_ESP8266_OV5642_Capture.ino line 261
0x402077f0: loop_wrapper at /Users/davemohla/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56

Re: Reset Issue with ESP8266

PostPosted: Wed Jun 29, 2016 5:01 pm
by pmcdonaldesp
Software watchdog timer : it generally means that something you are doing is taking too long before returning from setup or loop with out a call to delay or yield.

So, on esp there is a timer that checks to make sure everything is working correctly. It expects a particular variable to change regularly and if it does not change it assumes the system is hung and reboots.

Any long processing loops you have need to incorporate delay or yield to ensure that the watchdog variable gets reset often enough.

for (x = 0; x<10000;x++)
{
dosomethingslow();
}

Will crash with wdt.
for (x = 0; x<10000;x++)
{
dosomethingslow();
yield();
}

will work correctly.