Skip to content

Instantly share code, notes, and snippets.

@Josverl
Created October 16, 2022 18:24
Show Gist options
  • Save Josverl/8985ccd1f7b756759e69a9b8fab1d504 to your computer and use it in GitHub Desktop.
Save Josverl/8985ccd1f7b756759e69a9b8fab1d504 to your computer and use it in GitHub Desktop.
Mpremote timing
.\minimal.ps1
COM20
COM9
Hello 1
Hello 2
Hello 3
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\develop\MyPython\micropython-stubber\.venv\Scripts\mpremote.exe\__main__.py", line 7, in <module>
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\main.py", line 485, in main
handler_func(state, args)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\commands.py", line 202, in do_exec
_do_execbuffer(state, args.expr[0], args.follow)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\commands.py", line 184, in _do_execbuffer
state.ensure_raw_repl()
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\main.py", line 429, in ensure_raw_repl
self.pyb.enter_raw_repl(soft_reset=soft_reset)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\pyboard.py", line 340, in enter_raw_repl
raise PyboardError("could not enter raw repl")
mpremote.pyboard.PyboardError: could not enter raw repl
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\develop\MyPython\micropython-stubber\.venv\Scripts\mpremote.exe\__main__.py", line 7, in <module>
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\main.py", line 485, in main
handler_func(state, args)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\commands.py", line 202, in do_exec
_do_execbuffer(state, args.expr[0], args.follow)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\commands.py", line 184, in _do_execbuffer
state.ensure_raw_repl()
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\main.py", line 429, in ensure_raw_repl
self.pyb.enter_raw_repl(soft_reset=soft_reset)
File "C:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\mpremote\pyboard.py", line 340, in enter_raw_repl
raise PyboardError("could not enter raw repl")
mpremote.pyboard.PyboardError: could not enter raw repl
Hello 4
b'MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32\r\nType "help()" for more information.\r\n>>> '
b'MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32\r\nType "help()" for more information.\r\n>>> '
# test mpremote commands in quick succession
# this is a minimal test case for a bug in mpremote/pyboard
# COM9 - ESP32 with v1.19.1 firmware
# COM20 - Uart to indicate timing in the logic analyser - Optional
# the bug is that when 2 commands are ecexudet in quick succession the second command is not executed
# the bug is not present when the commands are separated by a delay > 1.6 - 2 seconds as that allows the ESP32 to restart micropython. ( soft-reset)
# problem s
[System.IO.Ports.SerialPort]::getportnames()
$serialport = "COM9"
$debugport = "COM20"
$debug = new-Object System.IO.Ports.SerialPort $debugport, 115200, None, 8, one
$debug.open()
$debug.WriteLine("Debug port opened")
$delay = 1.6
(1..3).foreach{
$debug.WriteLine("[[[ $_")
&mpremote connect $serialport exec "print('Hello $_')"
$debug.WriteLine("$_ ]]]")
sleep $delay
}
$delay = 0
(5..7).foreach{
$debug.WriteLine("[[[ $_")
&mpremote connect $serialport exec "print('Hello $_')"
$debug.WriteLine("$_ ]]]")
sleep $delay
}
$debug.WriteLine("Done")
$debug.Close()
Debug port opened
[[[ 1
\x01\x04
>>>
>>>
>>>
>>>
raw REPL; CTRL-B to exit
>OK
MPY: soft reboot
\x02raw REPL; CTRL-B to exit4
>R\x01\x80\0\x01\x04Hello 1
\x04\x04>ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 41 ]]]
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> [[[ 2
\x01\x04
>>>
>>>
>>>
>>>
raw REPL; CTRL-B to exit
>OK
MPY: soft reboot
\x02raw REPL; CTRL-B to exit4
>R\x01\x80\0\x01\x04Hello 2
\x04\x04>ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
2 ]]]
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> [[[ 3
\x01\x03
>>>
>>>
>>>
>>>
raw REPL; CTRL-B to exit
>OK
\x04MPY: soft reboot
\x05raw REPL; CTRL-B to exit
>R\x01\x80\0\x01\x04Hello 3
\x0222:57ets Jun 8 2016 00:A\x01print('Hello 3')\x04
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
3 ]]]
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> [[[ 4
\x01\x04
>>>
>>>
>>>
>>>
raw REPL; CTRL-B to exit
>OK
MPY: soft reboot
\x05A\x01print('Hello 4')\x04raw REPL; CTRL-B to exit
\x02\x04Hello 41
\x04\x04>ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
4 ]]]
[[[ 5
\x01MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
5 ]]]
[[[ 6
\x01MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12788
load:0x40080400,len:4176
entry 0x40080680
6 ]]]
Done
MicroPython v1.19.1 on 2022-06-18; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment