esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
16.05k stars 13.33k forks source link

ESP Huzzah board hang after deep sleep and wake up ( pin 16 to rst connected) #2049

Closed Zyxmn closed 8 years ago

Zyxmn commented 8 years ago

I have been testing the deepsleep function on the huzzah board and the board crashes average after 9 to 14 consecutive deepsleep and wakeup cycles.

Sometimes it crashes with only 3 to 4 deepsleep and wakeup cycles and sometimes goes to about 20 plus cycles before crashing.

Here is the sketch I use:

include "Esp.h"

void setup() { Serial.begin(115200); Serial.println(); Serial.println(ESP.getResetReason()); Serial.println(); delay(100); ESP.deepSleep(1000000, WAKE_RF_DEFAULT); // Sleep for 1 second }

void loop() {

}

igrr commented 8 years ago

Could you please decode the stack dump and paste the result here? Thanks. https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md

Zyxmn commented 8 years ago

How can I get the stack dump printed on the serial monitor?

The device hangs ( normal operation ceases and the led on gpio 0 glows like when in programming mode) but no stack dump on the serial monitor occurs during the hang.

On Mon, May 23, 2016 at 5:07 PM, Zyxmn Daley Jes zyxmndaleyjes@gmail.com wrote:

How can I get the stack dump printed on the serial monitor?

On Mon, May 23, 2016 at 4:23 PM, Ivan Grokhotkov <notifications@github.com

wrote:

Could you please decode the stack dump and paste the result here? Thanks.

https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/2049#issuecomment-221009365

igrr commented 8 years ago

The chip has a watchdog timer, so it shouldn't "hang" for more than 6 seconds. Can you check if there is any output on the serial monitor at 74880 baud?

Zyxmn commented 8 years ago

This is output on the serial at 74880 baud before it hangs

²j¤øtail 0 chksum 0x0f csum 0x0f ~ld ",vërAer§ê "üm?ýk5êõh?üiõ(e|Zôj1ËÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 tail 0 chksum 0x0f csum 0x0f ~ld "jÅjÒdpªòNXÍmÍ+ýë%êåhQ,üiõ(u|Ztj1ËÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 tail 0 chksum 0x0f csum 0x0f ~ld ¢êÅjRdpºòNXÍm?ýk5êõhQ¬üéõ(e|Jôj3KÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 tail 0 chksum 0x0f csum 0x0f ~ld "êÅêÒdpºrNXÍmÍ+ýë%jåhQ,üéõ(e|Jôj3ËÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 tail 0 chksum 0x0f csum 0x0f ~ld "êÅêÒdpªrNXÍm?ýk5êõh?üéõ(e|Jôj3KÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 tail 0 chksum 0x0f csum 0x0f ~ld ¢êÅjÒdpºrNXÍmÍ+ýë%êåhQ,üéõ(e|Zôj3KÈ ets Jan 8 2013,rst cause:2, boot mode:(3,6)

igrr commented 8 years ago

Does it end like this? I.e. the last line before it hangs is ets Jan 8 2013 ...?

Zyxmn commented 8 years ago

yes that is the last line

igrr commented 8 years ago

In that case this is most likely a hardware issue. This indicates that the ROM bootloader didn't load anything from the flash chip.

Zyxmn commented 8 years ago

tested on another board just now. having the same issue . can you possibly replicate this on your end?

Zyxmn commented 8 years ago

on a second run in the new board, the device is chugging away nicely. will post the results again after an hour of testing

Zyxmn commented 8 years ago

it seems to be a bug. The device hangs after a few consecutive deep sleep cycles even on the new board.

Here is a link of the espressif forum of someone having the same issue: http://bbs.espressif.com/viewtopic.php?t=1161

Edit: Forums such as this :http://www.esp8266.com/viewtopic.php?f=32&t=6763

suggested a 4.7k pull up each for pin 0 and 2 and pull down for pin 15 as insurance. After fitting the pull ups and pull down , the number of sleep wake up cycles before hang has significantly increased, but the esp still hangs in the end :( .

protodude commented 8 years ago

Hello, I have exactly the same issue as Zyxmn described. (Also using the Adafruit Huzzah Feather) Also here: "rst cause:2, boot mode:(3,6)" is last serial output. I was also able to extend the number of working wake up cycles by adding a 4.7k pull up each for pin 0 and 2 and pull down for pin 15. I was even able to increase the cycles by adding a 2200uF Cap on the the 3.3V power net.

Still it crashes after something between Xhours and a few days....

THis is the method used to put it asleep: ESP.deepSleep(SLEEP_LENGTH * 1000000, WAKE_RF_DEFAULT);

igrr commented 8 years ago

I've set up a board to run deep sleep in a loop, will see if this can be reproduced.

igrr commented 8 years ago

The board ran 13517 deep sleep cycles, no issues so far. Here's the log: http://arduino.esp8266.com/deepsleep.log.zip

@protodude @Zyxmn the fact that crashes become less frequent when you fix hardware issues indicates that this is hardware-related. As I have mentioned above, if it hangs right after the ets Jan 8 2013 line, it means that the program wasn't even loaded from the flash chip. So there isn't anything which you could change with software here. Be sure to have pull up resistors on RST, CH_PD, GPIO 0 and 2, capacitor on RST and adequate filtering caps on supply lines. You can find correct component values in the reference designs posted here, look for "Hardware resources".