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

    Dead time between G1 commands over USB

    Scheduled Pinned Locked Moved Unsolved
    Duet Hardware and wiring
    4
    7
    235
    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.
    • jcsb1994undefined
      jcsb1994
      last edited by Phaedrux

      Hi everyone,
      I didn't find an answer to this question in the docs, but I was wondering if there is a little time where a stepper doesnt move between 2 G1 move commands.

      I am trying to move my motors for specific distances within a very precise amount of time, ex: 2cm in 1.5 sec, and then I do back and forths with my motor (sending repeatedly the same G1 command but inverting the direction, ex: G1 X10, G1 X-10 infinitely).

      I realise that I always get about a 3% error margin (the motor moves 3% too slow) . *I did correct for the acceleration of my motor and for the wasted dispacement during the accel and decel periods (and increased the feedrate accordingly), based on my max acceleration setup with the M201 command.

      I was wondering if I get this 3% slower move because of an automatic dead time between commands, maybe a couple milliseconds to process a command? Otherwise, would anyone have an idea of what could be causing this lag?

      Thanks a lot!

      1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        How are the commands being sent?

        Z-Bot CoreXY Build | Thingiverse Profile

        jcsb1994undefined 1 Reply Last reply Reply Quote 0
        • jcsb1994undefined
          jcsb1994 @Phaedrux
          last edited by

          @Phaedrux They are sent with a command line script in c++ that generates strings and send them to the duet3d via a serial com port. I tried sending a bunch of commands at once but there still was a 3% lag.

          Something interesting though is I tried using the command M114 (get motor pos) and I needed to wait a few milliseconds before reading my data buffer from my com port, otherwise the response from the Duet3D was not received yet. Looks like data exchange between the pc and the duet is very slow, but I dont know where the delay is coming from.. Either the Duet or the PC.

          1 Reply Last reply Reply Quote 0
          • Phaedruxundefined
            Phaedrux Moderator
            last edited by

            @dc42 would have to explain in depth, but yes there will be some fundamental differences between reading commands from the internal SD card during a print and executing sequential gcodes over USB.

            Z-Bot CoreXY Build | Thingiverse Profile

            jcsb1994undefined 1 Reply Last reply Reply Quote 0
            • jcsb1994undefined
              jcsb1994 @Phaedrux
              last edited by

              @Phaedrux Good to know! And the difference makes it faster to execute from sd card or usb?

              T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
              • T3P3Tonyundefined
                T3P3Tony administrators @jcsb1994
                last edited by T3P3Tony

                @jcsb1994 The Firmware has a buffer that it fills - if you are only sending one command at a time then that would eman a delay while the move was processed. A good test would be to compare the test with the commands written to a file on the SD card vs streamed over USB and see what you see.

                It is not that SD is faster specifically in this situation - both are theoretically fast enough if you are doing 10mm straight line moves on a "normal" printer - its the ability for the firmware to processes the moves and string them together.

                www.duet3d.com

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

                  @jcsb1994 said in Dead time between G1 commands over USB:

                  I am trying to move my motors for specific distances within a very precise amount of time, ex: 2cm in 1.5 sec, and then I do back and forths with my motor (sending repeatedly the same G1 command but inverting the direction, ex: G1 X10, G1 X-10 infinitely).

                  If you send those commands as a block, then there should be no gaps between then, just the acceleration and deceleration at the start and end of each move.

                  Please provide the calculations you have done that lead to think that the movement is 3% too slow.

                  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
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA