usb-device-cdc raises TypeError when using default timeout of None and going to block
https://github.com/micropython/micropython-lib/blob/master/micropython/usb/usb-device-cdc/usb/device/cdc.py#L368
and same for read function.
# check for timeout
if time.ticks_diff(time.ticks_ms(), start) >= self._timeout:
return len(buf) - len(mv)
machine.idle()
should be something like this:
if isinstance(self._timeout, int) and time.ticks_diff(time.ticks_ms(), start) >= self._timeout:
ESP8266 - Board auto-reset when using overlong delay machine.time_pulse_us()
I'm using a ESP8266 port (v1.8.7 and v1.8.6), The board is a Wemos D1 mini PRO.
When I call the method machine.time_pulse_us() using the default timeout or a lower value the method works perfectly, but If I use higher timeouts (3 seconds or more) then the board is automatically reset, the timeout error is not raised.
In my tests the GPIO doesn't change, so the timeout should be raised.
>>> import machine
>>> machine.time_pulse_us(machine.Pin(0), 1, 1000000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT
>>> machine.time_pulse_us(machine.Pin(0), 1, 1000000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT
>>> machine.time_pulse_us(machine.Pin(0), 1, 1000000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT
>>> machine.time_pulse_us(machine.Pin(0), 1, 3000000)
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 32028, room 16
tail 12
chksum 0x40
ho 0 tail 12 room 4
load 0x3ffe8000, len 1092, room 12
tail 8
chksum 0x17
load 0x3ffe8450, len 3000, room 0
tail 8
chksum 0x56
csum 0x56
l��|��rrnb��l�b�lb쌜����b�lrlll��|��rrnb��ll�pr�b�b쌜��b��lrl�l��|��rrnb��l���b�b쌜���b�lbl����n�r��n|�llll`��r�l�l�l`��r�l�l�l`��r�l���ll`rl��rl���b��b�bbr�rb��n�nn�l��l�l��ll������l�n����bll�rp���bl�brlrlr�n����brb��b쎜����lllb�b��n����brb��b쎜����lllbl�l��|��rrnb��l��b�b쌜��|�bllbl��ln�l`��ln�prl�l��|��rrnb���#5 ets_task(40100164, 3, 3fff8398, 4)
could not open file 'main.py' for reading
MicroPython v1.8.7-7-gb5a1a20a3 on 2017-01-09; ESP module with ESP8266
Type "help()" for more information.
>>>
I don't know if this is a issue related with my board or with the core. Is there some timeout limit value for this method ?
BTW, I'm not sure if this can be relevant, in my board the "ticks limit" is 1073741823.
>>> import time
>>> time.ticks_add(0, -1)
1073741823