diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-07-20 15:27:12 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-07-23 13:37:20 -0400 |
commit | 0075b29081c1d3f8aa001d68ef6c8899cdbd0adc (patch) | |
tree | fe14a6b3e325fe5b0b3bab2d71072f26a9e71faf | |
parent | b4fec8502c65db769535b1446db235256cf5b991 (diff) | |
download | kutter-0075b29081c1d3f8aa001d68ef6c8899cdbd0adc.tar.gz kutter-0075b29081c1d3f8aa001d68ef6c8899cdbd0adc.tar.xz kutter-0075b29081c1d3f8aa001d68ef6c8899cdbd0adc.zip |
tmc_uart: Increase default UART rate to 40000 on 32bit MCUs
A higher UART baud rate will allow for faster transfers and may result
in more stable operation in general. Increase the baud to 40000 on
32bit MCUs and leave the baud at 9000 baud for 8bit AVR MCUs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/extras/tmc_uart.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/klippy/extras/tmc_uart.py b/klippy/extras/tmc_uart.py index 32e74b24..85be0149 100644 --- a/klippy/extras/tmc_uart.py +++ b/klippy/extras/tmc_uart.py @@ -70,7 +70,8 @@ def lookup_tmc_uart_mutex(mcu): pmutexes.mcu_to_mutex[mcu] = mutex return mutex -TMC_BAUD_RATE = 9000 +TMC_BAUD_RATE = 40000 +TMC_BAUD_RATE_AVR = 9000 # Code for sending messages on a TMC uart class MCU_TMC_uart_bitbang: @@ -90,7 +91,11 @@ class MCU_TMC_uart_bitbang: self.tmcuart_send_cmd = None self.mcu.register_config_callback(self.build_config) def build_config(self): - bit_ticks = self.mcu.seconds_to_clock(1. / TMC_BAUD_RATE) + baud = TMC_BAUD_RATE + mcu_type = self.mcu.get_constants().get("MCU", "") + if mcu_type.startswith("atmega") or mcu_type.startswith("at90usb"): + baud = TMC_BAUD_RATE_AVR + bit_ticks = self.mcu.seconds_to_clock(1. / baud) self.mcu.add_config_cmd( "config_tmcuart oid=%d rx_pin=%s pull_up=%d tx_pin=%s bit_time=%d" % (self.oid, self.rx_pin, self.pullup, self.tx_pin, bit_ticks)) |