Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    [FW 3.5.2] M569.2 and microstepping lookup table

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    4
    21
    936
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • leoneundefined
      leone
      last edited by

      Hi all,

      I'm doing some tests with NEMA24 ST6018 motors and TMC5160 driver using the Trinamic eval-kit and the TMCL-IDE.
      The IDE allows also to define a lookup table to compensate torque ripples, and by using the settings in the picture below, I noticed a huge noise reduction of the motor.
      You can find also attached the export of the registries' content from the TMCL-IDE.

      microlut.PNG
      20240815_10.40.36_TMC5160_Settings.txt

      Now I'm trying to port these settings in a Duet-based system but unfortunately, I'm not getting the same results... I'd say the noise even got slightly worse.
      I have a CAN-connected expansion board and I've run these commands to set the microstepping LUT (I converted to decimal the content of the registry from 0x60 to 0x69).

      M569.2 P10.0 R96 V1149798536
      M569.2 P10.0 R97 V2770936978
      M569.2 P10.0 R98 V2840930900
      M569.2 P10.0 R99 V575228500
      M569.2 P10.0 R100 V2082
      M569.2 P10.0 R101 V2876095456
      M569.2 P10.0 R102 V2299679402
      M569.2 P10.0 R103 V525328
      M569.2 P10.0 R104 V4294943830
      M569.2 P10.0 R105 V16121857

      Furthermore, if I run the M569.2 commands without the V param to check if the registries are correctly written, I always get 0x00000000.

      Does anyone have a hint if this could be the right approach to implement the lookup table and how I could check the registries' content?
      Did someone try to exploit this Trinamic feature?

      Thank you in advance.

      dc42undefined droftartsundefined 2 Replies Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @leone
        last edited by dc42

        @leone most TMC5160 registers are write only, so they read back as zero.

        You can provide hex values directly like this:

        M569.2 P10.0 R96 V{0x44888888}
        

        I suggest you try again using this notation, in case you made a mistake converting any of the values to decimal.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        leoneundefined 1 Reply Last reply Reply Quote 0
        • droftartsundefined
          droftarts administrators @leone
          last edited by droftarts

          @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

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          leoneundefined 1 Reply Last reply Reply Quote 0
          • leoneundefined
            leone @dc42
            last edited by

            @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?

            1 Reply Last reply Reply Quote 0
            • leoneundefined
              leone @droftarts
              last edited by

              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 integer

              echo {0xA5292492}
              2770937088.0

              also, 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}
              1149798536

              Why do you think the conversion is generating a floating point number?

              droftartsundefined dc42undefined 3 Replies Last reply Reply Quote 0
              • droftartsundefined
                droftarts administrators @leone
                last edited by

                @leone @dc42 will need to have a look at that. I've forwarded to him.

                Ian

                Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @leone
                  last edited by

                  @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.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @leone
                    last edited by

                    @leone this issue is probably fixed in RRF 3.5.3-rc.1 released yesterday.

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    leoneundefined 1 Reply Last reply Reply Quote 0
                    • leoneundefined
                      leone @dc42
                      last edited by

                      @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.

                      dc42undefined 1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @leone
                        last edited by

                        @leone did you change the hysteresis values to the ones given by the TMC IDE too?

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        leoneundefined 1 Reply Last reply Reply Quote 0
                        • leoneundefined
                          leone @dc42
                          last edited by

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • AndyE3Dundefined
                            AndyE3D
                            last edited by

                            @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)?
                            leoneundefined 1 Reply Last reply Reply Quote 0
                            • leoneundefined
                              leone @AndyE3D
                              last edited by

                              @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.

                              AndyE3Dundefined 1 Reply Last reply Reply Quote 0
                              • AndyE3Dundefined
                                AndyE3D @leone
                                last edited by

                                @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
                                c4b6a487-49a8-4867-b1b1-182b26483871-image.png.

                                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?
                                abb73207-b8ff-45eb-8ff5-2cdf9cf37a15-image.png

                                leoneundefined 1 Reply Last reply Reply Quote 0
                                • leoneundefined
                                  leone @AndyE3D
                                  last edited by

                                  @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.

                                  dc42undefined 1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @leone
                                    last edited by dc42

                                    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:

                                    1. Modulation amplitude zero, sine offset zero.
                                    2. Modulation amplitude -20, sine offset zero,
                                    3. Modulation amplitude +20, sine offset zero.
                                    4. 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

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    leoneundefined 1 Reply Last reply Reply Quote 0
                                    • leoneundefined
                                      leone @dc42
                                      last edited by

                                      @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.

                                      mod0_off0.PNG
                                      modm20_off0.PNG
                                      modp20_off0.PNG
                                      mod0_off124.PNG

                                      dc42undefined 1 Reply Last reply Reply Quote 0
                                      • dc42undefined
                                        dc42 administrators @leone
                                        last edited by

                                        @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?

                                        Duet WiFi hardware designer and firmware engineer
                                        Please do not ask me for Duet support via PM or email, use the forum
                                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                                        leoneundefined 1 Reply Last reply Reply Quote 0
                                        • leoneundefined
                                          leone @dc42
                                          last edited by

                                          @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.

                                          Capture.PNG

                                          dc42undefined 1 Reply Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators @leone
                                            last edited by

                                            @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.

                                            Duet WiFi hardware designer and firmware engineer
                                            Please do not ask me for Duet support via PM or email, use the forum
                                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                                            leoneundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA