Unable to read tmc uart 'winch' register IFCNT

I’ve never actually wired up my uart line, always just dropped my drivers. But today I’m using Klipper for something a little different.

When I’m using my TMC2209 in step/dir mode (not defining a tmc2209 section) the driver works just fine. When I define the driver and put in the uart pin I get the error in the title. I also tried using separate tx and rx lines with a 1k resistor as recommended by BTT. So I’m lost.

Here is my entire config

[mcu]
serial: /tmp/klipper_host_mcu

[printer]
kinematics: none
max_velocity: 100
max_accel: 500

[manual_stepper winch]
step_pin: gpio0
dir_pin: gpio5
enable_pin: !gpio19
microsteps: 16
rotation_distance: 10
velocity: 10
accel: 10
#endstop_pin: tmc2209_manual_stepper_winch:virtual_endstop
#homing_retract_dist: 0

[tmc2209 manual_stepper winch]
uart_pin: gpio6
tx_pin: gpio13
run_current: 1.42
stealthchop_threshold: 9999
#diag_pin: gpio24
#driver_SGTHRS: 255

Well, the error indicates that Klipper was unable to contact the driver - as described at: TMC drivers - Klipper documentation . It’s hard to say why it can’t contact the driver - this is typically a wiring or config issue.

However, I’m not sure anyone has tried to use TMC uart communication using the “host linux mcu” code. I don’t know of any reason why it wouldn’t work, but it is an uncommon setup.

-Kevin

How exactly is uart supposed to be wired? My 2 actual printers just use the uart_pin param, but btt says to use a 1k resistor on the tx line to a different pin on the mcu.

Here is my wiring, really simple so I don’t see how it could be a wiring issue unless my idea of how uart works is seriously broken. Again, the driver is clearly getting power on both the motor and logic sides so it isn’t that. And I remember checking my pins like 8 times but I’ll try it again later today.

I also tested the connection through an Arduino and got the same result so I’ve ruled out the host process being the issue.

It appears as if uart does not work on the host mcu. I configured my pi with an external Arduino and 2 winch config sections and I was able to INIT_TMC and DUMP_TMC the driver when connected to the Arduino but not the pi repeatedly. I assume this is related to the need for a synced clock for uart communication and the host mcu’s lack of time-sensitive operation.

I think it’s worth adding a warning to klippy that shows up when one tries to configure a uart pin on the host mcu.

That’s surprising. If you try again, could you try with both an rx pin and a tx pin (don’t use one wire configuration). If that also fails, could you try modifying klippy/extras/tmc_uart.py and change the line that reads TMC_BAUD_RATE = 40000 to TMC_BAUD_RATE = 9000. (Be sure to run sudo service klipper restart after any code changes.)

-Kevin

Also, in case this wasn’t mentioned earlier, make sure you always have motor power applied to the tmc drivers as they generally can’t respond without motor power.

-Kevin

Also, make sure you’re not mixing 5V with 3.3V - if you use IO from the rpi, everything (besides motor voltage) must also be 3.3v .

-Kevin

I’ll try lowering the baudrate later today, otherwise I’m going with spi drivers.

Yeah I made sure there was motor power and 5v power. in fact I actually found out that, at least my drivers don’t need motor power to connect to uart.

Once again, I forgot that the raspberry pi is 3.3v. Unfortunately though that still doesn’t look like it’s done it. I have 20v power applied to the driver, 2 wires going to the 3.3v and g pins on the pi, and one wire between the PDN line and gpio21 and it still won’t work.

Also tried 2 wire but I couldn’t get that to work.

I also tried lowering the baud rate, still didn’t work.