Using time.sleep() or pyb.delay() crashes the ESP8266 board

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
hjm
Posts: 5
Joined: Sat Mar 05, 2016 12:42 pm

Using time.sleep() or pyb.delay() crashes the ESP8266 board

Post by hjm » Sat Mar 05, 2016 4:09 pm

Not sure if there is something I'm overlooking (new to the ESP8266 board and MicroPython), but found an issue today that I narrowed done to timing functions (in any case 'time.sleep()' and 'pyb.delay()').

For instance, when I execute this code:

Code: Select all

>>> import time
>>> for i in range(10):
...   print("Hello World!")
...   time.sleep(1)
Then the result is a crash of the board (sometimes recovers by itself, sometimes not). If it recovers, it manages to throw an error message:

Code: Select all

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x40100000, len 31488, room 16
tail 0
chksum 0xb1
load 0x3ffe8000, len 924, room 8
tail 4
chksum 0x87
load 0x3ffe83a0, len 25872, room 4
tail 12
chksum 0x9e
csum 0x9e
don't use rtc mem data
rl��rl���bl�br|�bll���lb��n�nn��l�|�l�l��l������l`�n����b��b���bl�b�,
>>>
MicroPython v1.6-137-gc70637b on 2016-03-05; ESP module with ESP8266
Type "help()" for more information.
That last line of error message just before the board reboots seems to hint at a memory collision with the RTC?

I'm using code from the github repo downloaded this morning. I've successfully built and deployed the firmware both on my Ubuntu 15.04 box as well as my Rpi (Raspbian Jessie). The issue is exactly the same on both my Feather and breakout Huzzah's from AdaFruit. So highly repeatable. However, I haven't seen any bug-reports concerning something like this on Github, so I'm assuming I might be doing something wrong. However, the issue seems similar to the timing issues that plagued the WiPy until recently, but from the forum it seems there was some kind of cryptic solution, until it got fixed in a more permanent way.

Btw, I'm using 'screen' from my Linux boxes to connect at baud-rate 115200. Wondering whether frequency matters (assuming it will also use clock-functions?). I haven't tried compiling in this script with the firmware yet.

Any suggestion would be highly appreciated!

mianos
Posts: 84
Joined: Sat Aug 22, 2015 6:42 am

Re: Using time.sleep() or pyb.delay() crashes the ESP8266 board

Post by mianos » Sat Mar 05, 2016 11:17 pm

This does not work on the board with the current ESP version. The time prevents the watchdog and wifi and the board resets. You either need to use my port with the os_timer, or simpler, wait a few weeks for the new official version that has much the same thing.

hjm
Posts: 5
Joined: Sat Mar 05, 2016 12:42 pm

Re: Using time.sleep() or pyb.delay() crashes the ESP8266 board

Post by hjm » Sun Mar 06, 2016 10:23 am

mianos wrote:This does not work on the board with the current ESP version. The time prevents the watchdog and wifi and the board resets. You either need to use my port with the os_timer, or simpler, wait a few weeks for the new official version that has much the same thing.
Mianos, thanks for your response! I expected as much, I do fully appreciate that it's early stages for the port. Having backed the Kickstarter campaign, couldn't resist to start tinkering though. I also fully appreciate that it will be a few months before, even with all their hard work, Damien, Paul, and all the others that are contributing, will have come to a stable and feature-rich version.

I've found some of your other posts that dealt with this issue, and may try out your port. Quite an interesting discussion to follow for a newbie like myself btw, provides an interesting peek into the workings of the board, hardware and software.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Using time.sleep() or pyb.delay() crashes the ESP8266 board

Post by deshipu » Sun Mar 06, 2016 11:10 am

This is funny, because it shows "rst cause:2", and according to this: http://www.esp8266.com/viewtopic.php?p=2096#p2112
2 means reset by the reset pin... watchdog would be 4.

Post Reply