ESPtool not releasing serial port

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

ESPtool not releasing serial port

Post by PM-TPI » Wed Jun 08, 2022 2:52 pm

Flash with ESPtool no problem but mpremote won't run...
if I comment out ESPtool then mpremote runs fine.

ESPtool hangs on to COM Port , how to release ?

Code: Select all

import esptool, subprocess

print('mimic Flash')
arg1 = ['--port', 'COM13', 'flash_id']
esptool.main(arg1)

print('copy files')
arg2 = 'mpremote connect COM13 cp assets/boot.py assets/main.py :'
sub = subprocess.Popen(arg2, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

Close serial port before exit from main() #316
From <https://github.com/espressif/esptool/pull/316>

Release COM port when flash process is finished #37
From <https://github.com/marcelstoer/nodemcu- ... /issues/37>

Why is the serial port still open when killing a subprocess?
From <https://stackoverflow.com/questions/702 ... subprocess>

Updated from 3.1 to...
esptool.py v4.1 - Espressif chips ROM Bootloader Utility

no change

Post Reply