Search found 22 matches

by jomas
Sat Jul 27, 2019 8:54 am
Forum: ESP8266 boards
Topic: How to encrypt a file?
Replies: 9
Views: 371

Re: How to encrypt a file?

There is no need to store the password in a file. Once you entered the password it will be stored 'somewhere' in the esp. So after reboot it will use that stored password.
by jomas
Tue May 21, 2019 11:00 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

That could be tricky. If for example in an interrupt occurs which calls 'ets_loop_iter', in the middle of 'mp_hal_ticks_ms', then 'system_time_high_word' may be incremented 2 times. I think you should protect the code with ets_intr_lock();/ets_intr_unlock(); just as in 'ets_loop_iter'. Or 'mp_hal_ti...
by jomas
Tue May 21, 2019 9:04 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

MICROPY_PY_UTIME_TICKS_PERIOD = 2^30.
So MICROPY_PY_UTIME_TICKS_PERIOD-1 is used as a mask of 30bits (0b111111111111111111111111111111)
by jomas
Tue May 21, 2019 8:36 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

@pythoncoder, Your suggested mp_hal_ticks_ms will not work because system_get_time() will roll-over after 1:11H. Your assumption that the compiler truncate is true. The result of the 64bit-counter/1000 will just return the lower 32bits as a unsigned int. @kevinkk525, 1. MICROPY_PY_UTIME_TICKS_PERIOD...
by jomas
Mon May 20, 2019 9:59 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

I Think you are right that only one coroutine is blocking. (in fact it is not blocking it is just scheduled with a much to long delay) You know why I concluded that the whole uasyncio was blocked? Look at my test program (first post) I had one coroutine 'time_loop' that updates self.second. The othe...
by jomas
Mon May 20, 2019 7:19 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

@pythoncoder, @kevinkk525, I think I found the bug. In ports/esp8266/ets_alt_task.c there is a function 'ets_loop_iter'. This function is called in the main loop/during idle I think. This function implements a 64 bits counter that represents the system time in uSeconds. A snippet of the code is as f...
by jomas
Sun May 19, 2019 5:52 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

@pythoncoder, all time functions are more or less derived from the esp-sdk call 'system_get_time()' this is just a 32 bits counter that counts from 0 -> 2^32-1 and then rolls over to 0. I hardly can believe that this call would block. I have not found any reports of this. Also my non-uasyncio versio...
by jomas
Sun May 19, 2019 11:10 am
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

uasyncio imports and uses utimeq. If I look at the source of utimeq I see the following code: STATIC bool time_less_than(struct qentry *item, struct qentry *parent) { mp_uint_t item_tm = item->time; mp_uint_t parent_tm = parent->time; mp_uint_t res = parent_tm - item_tm; if (res == 0) { // TODO: Thi...
by jomas
Sat May 18, 2019 10:22 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

Re: uasyncio is blocked for 1 hour, 11 minutes (Bug?)

Thanks kevinkk525 for reporting the problem. @pythoncoder, I have added a coroutine with await asyncio.sleep(0) in my "test" program as you suggested. It is running now. If the testprogram blocks I will report the results. Added code: @asyncio.coroutine def pythoncoder(self): print("Start coroutine ...
by jomas
Fri May 17, 2019 12:21 pm
Forum: ESP8266 boards
Topic: [SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266
Replies: 26
Views: 1045

[SOLVED] uasyncio is blocked for 1 hour, 11 minutes on ESP8266

UPDATE may 22: Cause found. The blocking is caused by a bug in mp_hal_ticks_ms. Under certain conditions uasyncio is blocked for exactly 1 hour, 11 minutes. This was first reported in topic https://forum.micropython.org/viewtopic.php?f=16&t=4706. I have been running several esp8266 (ESP-12) units t...