Did someone know that tmc fields.set_field() does not set field? I didn't :D
and get_field() does not really read it (I’m not sure here).
def set_field(self, field_name, field_value, reg_value=None, reg_name=None):
# Returns register value with field bits filled with supplied value
if reg_name is None:
reg_name = self.field_to_register[field_name]
if reg_value is None:
reg_value = self.registers.get(reg_name, 0)
mask = self.all_fields[reg_name][field_name]
new_value = (reg_value & ~mask) | ((field_value << ffs(mask)) & mask)
self.registers[reg_name] = new_value
return new_value
I was not aware of that, so I should redo some testing, and make some refactoring.
I implemented TMC2240 offset calibration, snapshot: GitHub - nefelim4ag/klipper at tmc2240-offset90-20241221
It is pretty straightforward actually.
My offset is -11 and as required slightly compressed down the MSLUT table.
(it does sometimes try to be -9 or -10)
90 -> 90 - 90/127 * 11 = 82 degrees.
*SpreadCycle registers are Klipper defaults
It looks like micro steps work better in StealthChop (because of autotuning?), maybe spread on tuned registers in an ideal situation should perform the same way.
(Tuned registers allow for the SpreadCycle to control motor current more precisely).
Phase offset on the other hand seems to make full steps similar, like 1 ~= 3, 2 ~= 4
Without phase offset here, they are more like 1~=4, 2~=3
I’m a little disappointed,
it looks like the phase offset instead of decreased motor oscillation and increased alignment makes vibrations/oscillations worse.
This how it is looks from microstep calibration:
StealthChop + Offset:
FullStep 1.8 angles: 1.73 1.88 1.71 1.83 ~ 7.15
SpreadCycle + Offset:
FullStep 1.8 angles: 1.74 1.86 1.73 1.82 ~ 7.15
Just SpreadCycle for reference:
FullStep 1.8 angles: 1.81 1.81 1.79 1.75 ~ 7.16
My microstep calibration tool does not work here right now, tmc2240 refuses to correctly work after updating MSLUT (even if I do reg read → reg write).







