diff options
author | Grigori Goronzy <greg@chown.ath.cx> | 2020-04-01 23:52:55 +0200 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2020-04-02 13:56:50 -0400 |
commit | 0a20430e07801a277e2fc37de30035730d1084f2 (patch) | |
tree | d029b09c5d054f45aa479f1a446310d76bee5a7a /klippy/mcu.py | |
parent | 5c8d15bbee9b1c4c82e3a2ecb5c63ce37f4a8dcb (diff) | |
download | kutter-0a20430e07801a277e2fc37de30035730d1084f2.tar.gz kutter-0a20430e07801a277e2fc37de30035730d1084f2.tar.xz kutter-0a20430e07801a277e2fc37de30035730d1084f2.zip |
serial: Add Fysetc Cheetah board specific reset sequence
Fysetc Cheetah v1.2 boards require a special sequence to reset reliably.
This sequence works for me in all cases. Simpler sequences without
double reset did not work correctly. This is likely because of a weird
stateful circuitry for toggling the bootloader state.
Cheetah boards use RTS to configure bootloader triggering. By default,
pySerial sets RTS on connect, which unfortunately configures the board
to start the bootloader on reset.
Add a toggle for the RTS state to allow users to workaround. The RTS state
is set before the serial connection is opened, so there are no glitches.
Addresses #2026.
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
Diffstat (limited to 'klippy/mcu.py')
-rw-r--r-- | klippy/mcu.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py index 49ec6cb0..36e9c48d 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -386,16 +386,22 @@ class MCU: self._disconnect) # Serial port self._serialport = config.get('serial', '/dev/ttyS0') + serial_rts = True + if config.get('restart_method', None) == "cheetah": + # Special case: Cheetah boards require RTS to be deasserted, else + # a reset will trigger the built-in bootloader. + serial_rts = False baud = 0 if not (self._serialport.startswith("/dev/rpmsg_") or self._serialport.startswith("/tmp/klipper_host_")): baud = config.getint('baud', 250000, minval=2400) self._serial = serialhdl.SerialReader( - self._reactor, self._serialport, baud) + self._reactor, self._serialport, baud, serial_rts) # Restarts self._restart_method = 'command' if baud: - rmethods = {m: m for m in [None, 'arduino', 'command', 'rpi_usb']} + rmethods = {m: m for m in [None, 'arduino', 'cheetah', 'command', + 'rpi_usb']} self._restart_method = config.getchoice( 'restart_method', rmethods, None) self._reset_cmd = self._config_reset_cmd = None @@ -683,6 +689,10 @@ class MCU: logging.info("Attempting MCU '%s' reset", self._name) self._disconnect() serialhdl.arduino_reset(self._serialport, self._reactor) + def _restart_cheetah(self): + logging.info("Attempting MCU '%s' Cheetah-style reset", self._name) + self._disconnect() + serialhdl.cheetah_reset(self._serialport, self._reactor) def _restart_via_command(self): if ((self._reset_cmd is None and self._config_reset_cmd is None) or not self._clocksync.is_active()): @@ -713,6 +723,8 @@ class MCU: self._restart_rpi_usb() elif self._restart_method == 'command': self._restart_via_command() + elif self._restart_method == 'cheetah': + self._restart_cheetah() else: self._restart_arduino() # Misc external commands |