Closed Wind-stormger closed 1 year ago
Windows10 powershell:
mpbridge dev COM21 D:\temp\temp
- Syncing files on COM21 with D:/temp/temp
- Entering raw repl
- Syncing files
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
✓ Hard reset board successfully
R Entering REPL using mpremote
Connected to MicroPython at COM21
Use Ctrl-] to exit this shell
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Scripts\mpbridge.exe\__main__.py", line 7, in <module>
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\shell.py", line 64, in dev
bridge.start_dev_mode(port, dir_path)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\bridge.py", line 71, in start_dev_mode
start_repl(port)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\bridge.py", line 82, in start_repl
do_repl(state, argparse_repl().parse_args([]))
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\repl.py", line 79, in do_repl
do_repl_main_loop(
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\repl.py", line 8, in do_repl_main_loop
console_in.waitchar(state.pyb.serial)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\console.py", line 99, in waitchar
while not (self.inWaiting() or pyb_serial.inWaiting()):
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\serialutil.py", line 594, in inWaiting
return self.in_waiting
^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\serialwin32.py", line 259, in in_waiting
raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed
I've tested it on esp32 and it worked. Would you please tell me which board you are working with?
It seems there's a problem with hard reset. What is your opinion about disabling auto hard reset?
It is the ESP32S3 development board, REPL is output through built-in USB, not UART, this may affect the hard reset.
I will add an -r option to dev command to enable hard reset and make it disabled by default.
@Wind-stormger would you please uninstall mpbridge
with:
pip uninstall mpbridge
And install it with this command:
pip install git+https://github.com/AmirHmZz/mpbridge.git@disable-hard-reset
- Syncing files on COM21 with D:/temp/temp
- Entering raw repl
- Syncing files
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
- Exiting raw repl
R Entering REPL using mpremote
failed to access COM21 (it may be in use by another program)
@Wind-stormger would you please reinstall mpbridge
with the same commands again and check if the bug is gone?
No, still exists.
What about now? Would you please retry?
mpbridge dev COM21 D:\temp\temp
- Syncing files on COM21 with D:/temp/temp
- Entering raw repl
- Syncing files
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
- Exiting raw repl
R Entering REPL using mpremote
Connected to MicroPython at COM21
Use Ctrl-] to exit this shell
>>>
>>>
MPY: soft reboot
start
0
1
2
end
MicroPython v1.19.1-782-g699477d12 on 2022-12-20; ESP32S3 module (spiram) with ESP32S3
Type "help()" for more information.
>>>
R Exiting REPL
- Entering raw repl
- Syncing files
↑ Putting /main.py |████████████████████| 100% Complete
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
- Exiting raw repl
R Entering REPL using mpremote
Connected to MicroPython at COM21
Use Ctrl-] to exit this shell
>>>
MPY: soft reboot
start
0
1
2
3
4
5
end
MicroPython v1.19.1-782-g699477d12 on 2022-12-20; ESP32S3 module (spiram) with ESP32S3
Type "help()" for more information.
>>>
It works.
pyb.close()
Maybe time. sleep (0.3)
is unnecessary.
After I tried to comment it out, I didn't encounter any problems for the time being.
Perhaps conservative or keep it?
@Wind-stormger Wait! We are not done yet :D Would you please try again? I've enabled auto hard reset again in order to test it.
In windows10
mpbridge dev COM21 D:\temp\temp
- Syncing files on COM21 with D:/temp/temp
- Entering raw repl
- Syncing files
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
✓ Hard reset board successfully
R Entering REPL using mpremote
Connected to MicroPython at COM21
Use Ctrl-] to exit this shell
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Scripts\mpbridge.exe\__main__.py", line 7, in <module>
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\shell.py", line 64, in dev
bridge.start_dev_mode(port, dir_path)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\bridge.py", line 73, in start_dev_mode
start_repl(port)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpbridge\bridge.py", line 84, in start_repl
do_repl(state, argparse_repl().parse_args([]))
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\repl.py", line 79, in do_repl
do_repl_main_loop(
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\repl.py", line 8, in do_repl_main_loop
console_in.waitchar(state.pyb.serial)
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\mpremote\console.py", line 99, in waitchar
while not (self.inWaiting() or pyb_serial.inWaiting()):
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\serialutil.py", line 594, in inWaiting
return self.in_waiting
^^^^^^^^^^^^^^^
File "C:\Users\Wind\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\serialwin32.py", line 259, in in_waiting
raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (PermissionError
What about now?
time.sleep(0.5)
, not enough to support.
mpbridge dev COM21 D:\temp\temp
- Syncing files on COM21 with D:/temp/temp
- Entering raw repl
- Syncing files
✓ Synced files successfully
? Press [Enter] to Sync >> Hard Reset >> Enter REPL Press [Ctrl + C] to exit
- Syncing files
✓ Synced files successfully
✓ Hard reset board successfully
R Entering REPL using mpremote
failed to access COM21 (it may be in use by another program)
time.sleep(0.8)
, just fine.
time.sleep(1)
, fine.
Perhaps this is related to the USB reaction speed of the PC system?
Thanks for your cooperation! I will make auto hard reset optional and increase sleep time to 1.2 seconds.
# pyb.close()
time.sleep(0.8)
It works.
Tested in Ubuntu 22.04.1 LTS and Windows10, same err.