terjeio / Trinamic-library

Plain C library for Trinamic TMC2130 stepper drivers
Other
54 stars 21 forks source link

globalscaler and cs with TMC5160 #13

Open Autocrit opened 1 week ago

Autocrit commented 1 week ago

I have an SKR 3, TMC5160T Plus (22mA sense resistor) and NEMA 23 motor (rated at 2.8A)

I see that your method for calculating globalscaler and cs is quite different to Klipper's and RRF, i.e. your minimum value for is globalscaler is 128 vs. 32 in Klipper/RRF.

https://github.com/Klipper3d/klipper/blob/b89d552387da9734292a182c7040c418996ca350/klippy/extras/tmc5160.py#L281

https://github.com/Duet3D/RepRapFirmware/blob/fc1cd16cee3b5c5fa3a0992cf1b483423e4381a1/src/Movement/StepperDrivers/TMC51xx.cpp#L731

I'm curious what the driver does with this value but I'm waiting for a better power supply in order to compare current draw.

globalscaler (r_sense = 22) cs (r_sense = 22)

Autocrit commented 1 day ago

Some initial current measurements:

TMC5160 _set_rms_current methods compared

The code I used is this monstrosity https://gist.github.com/Autocrit/b7d634b89355d59e2a01b8e89d432194

I probably need to test with a load applied to the motor