TMC5160 CS and Vsense

Basic Information:

Printer Model: Custom
MCU / Printerboard: SKR 3 EZ
klippy.log

Fill out above information and in all cases attach your klippy.log file. Pasting your printer.cfg is not needed

Describe your issue:

Dear Kevin or whoever has the knowledge:),

I have a few questions about the TMC5160 settings for Klipper, mainly around the customization of the parameter set.

After downloading the excel sheet provided by Trinamic to find the correct values for the parameters, I came across some parameters in the excel sheet but, not among the customizable parameters from within printer.cfg. However, please correct me if I am wrong.

-As far as I understand, the EZ5160 drivers (like most 5160 it seems) have 0.075 Ohm Sense resistors in them. But, the excel sheet, with 12Mhz for fCLK, 48V, 0.0015 mH inductivity and 2.5A peak current gives me 0.108 Ohms as Rsense. Now, the only way to change Rsense to 0.075 Ohm seems to be to change CS to 23 instead of the default 31. I can not find a way to change this parameter on the drivers, is there a way to change this, or am I missing something?

  • The calculation sheet that I downloaded from Trinamic website from 5160 documentation does not include two Rsense values depending on Vsense=0 and Vsense=1. Is there some other calc sheet used for Klipper and where exactly can we control Vsense value?

Thank you.

The vsense and cs tmc driver fields are automatically set to appropriate values based on the run_current and sense_resistor values provided in the printer.cfg file. If you need to find out the exact cs and vsense settings that Klipper chose (eg, for use with the tmc spreadsheet) then run the DUMP_TMC command to query the actual values from the driver.

-Kevin

I tried to optimize those parameters as well but the TMC_DUMP always gave me cs_actual as 31.
Only the global scaler seemed to have changed a bit.

Ah, yes. Each tmc driver is a little different. On the tmc5160 the code will automatically set IRUN and GLOBALSCALER based on the configured run_current (the tmc2660 has CS and VSENSE, the tmc2130/tmc220x have IRUN and VSENSE).

Cheers,
-Kevin

Thanks for the reply.

Are we to understand that it is not possible to modify the CS value directly and that the motors will always see over current unless the RSense is physically changed to a higher value (like the excel sheet suggest) on the actual drivers?

Because TMC_DUMP also always gives me a CS value of 31 which, in my case, corresponds to a current rating of 3.3A peak, and my motors are 2.5A peak.

On a side note, the external 2160 drivers have CS adjustable by a DIP switch, and I guess that means it is a hardware setting only.