Commit Graph

16 Commits

Author SHA1 Message Date
Kevin O'Connor 9572ad4327 tmc_uart: Limit to only one active uart at a time on an mcu
The tmcuart_send command increases cpu usage on the micro-controller.
Should multiple tmcuart_send commands be issued at the same time to a
single AVR micro-controller, it could increase the load to the point
that it introduces a failure. It could also lead to tmcuart_send
transmission errors, which would cause retransmission requests, which
further increase the load.

Track and share mutexes so that only one tmcuart_send command can be
active on a single mcu at a time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-03-12 20:51:11 -05:00
Kevin O'Connor 86c943467f tmc_uart: Minor change - make the baud rate setting more clear
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-27 11:46:03 -05:00
Kevin O'Connor f5cdfad333 mcu: Avoid using "async" for variables as it conflicts with Python3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor a61d483e21 tmc_uart: Use nominal mcu frequency in baud calculation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-06 16:29:18 -05:00
Kevin O'Connor 245917bf03 mcu: Introduce new lookup_query_command() command wrapper
Use new mcu.lookup_query_command() for all commands that query
information from the micro-controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 13:24:53 -05:00
Kevin O'Connor 332038ea01 serialhdl: Convert queries to use new notify message ack system
Convert standard queries to use the acknowledgments of the sent
command to determine if the response was received or not.  This also
controls command retransmissions (should the response have been lost).

The tmc_uart.py will continue to use the old mechanism as the tmcuart
responses are not sent synchronously with the query command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 12:01:21 -05:00
Kevin O'Connor 0ba5819370 tmc_uart: Don't try to configure analog pins to -1 value
Commit 6f5f2a3b incorrectly altered the analog mux pin config.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 11:33:30 -04:00
Kevin O'Connor 6f5f2a3bc7 tmc_uart: Make sure to set analog mux pins after a restart
Don't assume the analog mux pins are in a low state at startup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 22:00:58 -04:00
Kevin O'Connor c356e8362d tmc_uart: Make sure address is at least 0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-31 13:13:27 -04:00
Kevin O'Connor a730aec8bc tmc_uart: Add support for configuring the uart address on tmc2209 chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-31 13:02:27 -04:00
Kevin O'Connor 1fcfff2ac6 tmc_uart: Remove references to the TMC2208 in the generic UART code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-21 09:39:07 -04:00
Kevin O'Connor 041831f93a tmc_uart: Hold a mutex during MCU_TMC_uart get/set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor 9855354c75 tmc_uart: Use print_time=None as default (not print_time=0)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 18:27:59 -04:00
Kevin O'Connor 6ec7dee07d tmc: It's not valid to schedule messages with print_time=0
A print_time of zero may translate to a negative clock on a secondary
micro-controller, which would cause an internal error.  Change the
code to pass a real print_time or None if it is not needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 18:19:05 -04:00
Kevin O'Connor 0b02d7a1f2 tmc_uart: Support print_time in set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:47:37 -04:00
Kevin O'Connor 0173bb3f71 tmc_uart: Move UART code from tmc2208.py to new file tmc_uart.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 18:06:05 -04:00