Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Allow ConSerial to use RTS instead of DTR for reset #57

Open
nevercast opened this issue Aug 7, 2018 · 0 comments
Open

Comments

@nevercast
Copy link

I'm using a LoPy from Pycom, the esptool expects RTS to be used for reset, so we have designed our production PCBs with this in mind. We would like to use mpfshell to copy files to our devices. You have used DTR in ConSerial as the reset line. It would be nice if this was configurable so that the ESP32 device would work correctly over serial.

For what its worth, Mpfshell works well with ESP32 over Telnet.

I should state I'm using Windows and its possible that Windows opens the COM port in a different state than ComSerial might expect with regards to DTR and RTS lines, for best configuration perhaps two states could be given as for "reset" and "nominal", with the high/low lines of both DTR and RTS set accordingly, something like.

def set_control_lines(nominal, reset):
    """ Change the state of the serial control lines during typical state or reset state """
    # nominal and reset are tuples of (Boolean, Boolean), DTR, RTS respectively
    self.ctrl_nominal = nominal
    self.ctrl_reset = reset

def _do_reset(self):
    self.serial.setDTR(self.ctrl_reset[0])
    self.serial.setRTS(self.ctrl_reset[1])
    time.sleep(0.25)
    self.serial.setDTR(self.ctrl_nominal[0])
    self.serial.setRTS(self.ctrl_nominal[1])

def __init__(...):
    ...
    if reset:
        logging.info("Hard resetting device at port: %s" % port)
        self._do_reset()
    ...

Let's discuss the best implementation of this, I can provide a PR once we have nailed down any concerns.

Kind regards,
Josh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant