[FW 3.5.2] M569.2 and microstepping lookup table
-
@leone What hardware and firmware version are you using? In the Gcode dictionary for M569.2, it says:
M569.2: Read or write stepper driver register
Supported in RRF 3.3 and later on main boards with TMC22xx or TMC51xx stepper drivers.From RRF 3.4.0 it is supported on expansion boards, I've added this to the Gcode entry. A small bug was fixed in 3.5.1:
[EXP1HCL] The M569.2 command to read stepper driver registers was not supported
You say you have a 'CAN-connected expansion board', is this a Duet 3 one, or something else?
You could try setting and reading back a register that is read/write, to check that it works. Check the datasheet to find which registers are safe to change temporarily.Ian
-
@dc42 thank you for the clarification and the suggestion. Unfortunately I get some errors with some hex values:
M569.2 P10.0 R97 V{0xA5292492} Error: at column 32: M569: expected non-negative integer
and if I echo the string, I get a decimal number which is different from a conversion I've done with a calculator (0xA5292492 --> 2770936978).
echo {0xA5292492} 2770937088.0 echo V{0x44888888} 1149798536
Can you replicate this behaviour?
-
hi @droftarts, I confirm that if I read a readable registry (e.g. M569.2 P10.0 R106) the command works.
What I see now, is that for some hex values, the command doesn't work because the value I'm passing is converted to a floating point.
M569.2 P10.0 R97 V{0xA5292492}
Error: at column 32: M569: expected non-negative integerecho {0xA5292492}
2770937088.0also, this number is different from a conversion I've done with a calculator (0xA5292492 --> 2770936978).
The following value it seems to be ok.
echo V{0x44888888}
1149798536Why do you think the conversion is generating a floating point number?
-
-
@leone please try the firmware build at https://www.dropbox.com/scl/fo/42aeqn7cndtkwe36nwkig/APkS2re8b3ROZZu0Z2NggxA?rlkey=z704mbv9kd3o6t67i857nhtl1&dl=0 and see if that fixes it.
Caution: although this build reports itself as 3.5.3-rc.1 the final 3.5.3-rc.1 build we release may be different.
-
@leone this issue is probably fixed in RRF 3.5.3-rc.1 released yesterday.
-
@dc42 thank you for having looked into that, the conversion now works.
Unfortunately, the behavior of the motors after changing the lookup table is still not the same as with the TMCL-IDE. -
@leone did you change the hysteresis values to the ones given by the TMC IDE too?
-
@dc42 yes, I set the driver parameters as in the TMCL-IDE (I copied the contend of the register 0x6C with M569.2).
I am using a custom board, I will check over the next few days if there is interference in the output of the TMC5160 distorting the signal going to the motor. -
@leone I am trying to understand what the phase modulation settings in TMCL-IDE are doing exactly but I can't see any reference to it in the user manual.
- What steps did you take to get that window in TMCL-IDE?
- Are you using a physical dev board (if so which one), or are you simulating the board with a virtual module in the IDE (again which one)?
-
@AndyE3D I am using the TMC5160 evaluation kit (https://www.mouser.de/ProductDetail/ADI-Trinamic/TMC5160-EVAL-KIT?qs=TiOZkKH1s2TJebvRqsmGsQ%3D%3D).
Once you connect the eval-kit to the pc you will find something called "sinus tool" and you can play with it. This is what in the user manual is called "microstepping look-up table"... I'm not sure if with "phase modulation" you're referring to the same thing. -
@leone Can you share the user manual you are using as "microstepping look-up table" also isn't in the one I have from the software
.I also don't have an evaluation board so I might need you to try and change the sliders and share with me what each one does if you are happy to help me with that?
-
@AndyE3D I followed the driver's datasheet and the application note 26:
https://www.analog.com/en/resources/app-notes/an-026.html
https://www.analog.com/media/en/technical-documentation/data-sheets/TMC5160A_datasheet_rev1.17.pdf
These are settings strongly dependent on the motor itself, and I have only nema24 motors. The configuration I posted is the best I found for this type of motor. -
Hi @leone, if it's not too much trouble, please can you load the IDE and post screenshots similar to the ones you posted already (showing the sliders, waveform, and register values) with the sliders set in the following positions:
- Modulation amplitude zero, sine offset zero.
- Modulation amplitude -20, sine offset zero,
- Modulation amplitude +20, sine offset zero.
- Modulation amplitude zero, sine offset maximum.
You may need to adjust the microstep amplitude in some cases to make the checks pass.
My aim is to see whether the "modulation" is just adding some third harmonic to the sine wave, or something more complicated; and to see what the sine offset does.
Thanks - David
-
@dc42 here they are. The sine offset should be "the absolute current at entry of the lookup table". It shifts up or down the sine wave, so to have it feasible I had to reduce the microstep amplitude. The maximum offset is not feasible, the higher it gets, the flatter the sinewave must be. Hope it's enough to clarify the behaviour, if you need something else, let me know.
-
@leone thanks, that's great!
The sine offset isn't what I expected, and I don't see any use for it. Does the IDE documentation or help indicate when it would be useful?
-
@dc42 unfortunately, the IDE doesn't say anything more than the datasheet/application notes.
My understanding here is that the sine wave is encoded as a list of increments/decrements to add to the START_SIN and START_SIN90 registries while increasing the microsteps. Since START_SIN and START_SIN90 represent the current of the two coils at the beginning of the electrical revolution, the value has to be greater or equal than zero.
It can be tuned for some desired behaviours or to make some weird configurations feasible (as in the picture below, where for offset less than 28 the wave is not feasible).
In general, from the examples in the datasheet and application notes, I saw the START_SIN registry always set to zero. -
@leone thanks again!
We're looking to add the facility to apply "modulation" to the sine table using just 1 or 2 parameters. What are the max and min values of "modulation" that the IDE allows you to apply? Please provide screenshots using those values.
-
@dc42 great news!
The modulation parameter goes from -27 to 39.