Merge branch 'bugfix/idf_monitor_usbser_sys_v4.0' into 'release/v4.0'

tools: work around usbser.sys bug in IDF monitor (v4.0)

See merge request espressif/esp-idf!7470
This commit is contained in:
Ivan Grokhotkov 2020-02-10 17:34:00 +08:00
commit c3961fdacb

View file

@ -225,6 +225,7 @@ class SerialReader(StoppableThread):
self.serial.rts = True # Force an RTS reset on open self.serial.rts = True # Force an RTS reset on open
self.serial.open() self.serial.open()
self.serial.rts = False self.serial.rts = False
self.serial.dtr = self.serial.dtr # usbser.sys workaround
try: try:
while self.alive: while self.alive:
data = self.serial.read(self.serial.in_waiting or 1) data = self.serial.read(self.serial.in_waiting or 1)
@ -473,8 +474,10 @@ class Monitor(object):
red_print(self.get_help_text()) red_print(self.get_help_text())
elif c == CTRL_R: # Reset device via RTS elif c == CTRL_R: # Reset device via RTS
self.serial.setRTS(True) self.serial.setRTS(True)
self.serial.setDTR(self.serial.dtr) # usbser.sys workaround
time.sleep(0.2) time.sleep(0.2)
self.serial.setRTS(False) self.serial.setRTS(False)
self.serial.setDTR(self.serial.dtr) # usbser.sys workaround
self.output_enable(True) self.output_enable(True)
elif c == CTRL_F: # Recompile & upload elif c == CTRL_F: # Recompile & upload
self.run_make("flash") self.run_make("flash")
@ -491,9 +494,11 @@ class Monitor(object):
# to fast trigger pause without press menu key # to fast trigger pause without press menu key
self.serial.setDTR(False) # IO0=HIGH self.serial.setDTR(False) # IO0=HIGH
self.serial.setRTS(True) # EN=LOW, chip in reset self.serial.setRTS(True) # EN=LOW, chip in reset
self.serial.setDTR(self.serial.dtr) # usbser.sys workaround
time.sleep(1.3) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.1 time.sleep(1.3) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.1
self.serial.setDTR(True) # IO0=LOW self.serial.setDTR(True) # IO0=LOW
self.serial.setRTS(False) # EN=HIGH, chip out of reset self.serial.setRTS(False) # EN=HIGH, chip out of reset
self.serial.setDTR(self.serial.dtr) # usbser.sys workaround
time.sleep(0.45) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.05 time.sleep(0.45) # timeouts taken from esptool.py, includes esp32r0 workaround. defaults: 0.05
self.serial.setDTR(False) # IO0=HIGH, done self.serial.setDTR(False) # IO0=HIGH, done
elif c in [CTRL_X, 'x', 'X']: # Exiting from within the menu elif c in [CTRL_X, 'x', 'X']: # Exiting from within the menu