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

    Smart Steppers & CONN_LCD

    Scheduled Pinned Locked Moved
    General Discussion
    3
    13
    826
    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.
    • dc42undefined
      dc42 administrators
      last edited by

      You can only connect 2 external stepper drivers (including Enable pins if you want) to CONN_LCD (and 5 to the expansion board).

      Caution, the SmartStepper has a design flaw that gives it a very long (and unknown) step-to-direction hold time. The symptom is layer shifts. To avoid this, I recommend you use half a 74HC74 chip to latch the DIR signal on the rising edge of Step before feeding it to the SmartStepper.

      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
      • maxbotsundefined
        maxbots
        last edited by

        Thanks for the reply, David.

        Do you by chance know if the Mechaduino has the same problem?

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

          @maxbots said in Smart Steppers & CONN_LCD:

          Thanks for the reply, David.

          Do you by chance know if the Mechaduino has the same problem?

          The Mechaduino also doesn't latch DIR on the rising edge of Step. However, it uses interrupts to detect both step pulses and the direction signal; so if they have got the interrupt priorities right, they will process the direction signal first and get the right result.

          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
          • maxbotsundefined
            maxbots
            last edited by

            Thank you!

            Trampasundefined 1 Reply Last reply Reply Quote 0
            • Trampasundefined
              Trampas @maxbots
              last edited by

              @maxbots
              The Smart Steppers use interrupts to process the direction change pin as well, but uses a timer/counter to handle the step pin. This results in the following timing requirements.

              0_1565955604478_ddaa65d8-5221-4645-bf5d-ea0ad38f77da-image.png

              The issue with direction change is that it takes time to process the interrupt, aka interrupt latency. I have measured this to take less than 200ns, see table above. This is with the direction change interrupt having the highest priority such that it will even interrupt other interrupts.

              Trampas

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

                @trampas said in Smart Steppers & CONN_LCD:

                The issue with direction change is that it takes time to process the interrupt, aka interrupt latency. I have measured this to take less than 200ns, see table above. This is with the direction change interrupt having the highest priority such that it will even interrupt other interrupts.

                That's good news. Does the SmartStepper firmware ever disable interrupts, and if so, for how long?

                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

                Trampasundefined 1 Reply Last reply Reply Quote 0
                • Trampasundefined
                  Trampas @dc42
                  last edited by

                  @dc42
                  The firmware does disable interrupts but only disables the one interrupt needed. For example if a mutex is needed between a timer interrupt handler then the only interrupt that is disabled is the timer interrupt, not global interrupts. Additionally the interrupt priorities are set with the direction interrupt being the highest priority, such that it can interrupt other lower priority interrupt handlers.

                  Thus asking how long the firmware disables interrupts is a loaded question as it depends on which interrupt is disabled. For the direction pin it is the highest priority and has the lowest interrupt latency and does not get disabled, this is how I can meet the above timing requirements.

                  With all this said the real world does come into play, and when wiring up the smart steppers most customers run wires between controller and smart steppers. These wires end up adding some capacitance to the step and direction pins. This capacitance slows the rise and falling edges of the step and direction pins based on the pin drive strength and load impedance.

                  The length for wires and the drive strength of the step and direction pin factors into the timing of the direction and step pins and is often the limiting factor.

                  I also find that a lot of people think running system at high microsteps is a good thing. Specifically with a lot of stepper drivers higher microsteps rates can create smoother moves, but does not increase accuracy. With the smart steppers the closed loop controller provides the smooth motion, and hence the microstep rate needs to be set to match machine accuracy requirement, usually no more than 16x microstepping and if machine is designed well it would have no microstepping, that is the machine would not count on microstepping for increased accuracy.

                  Running the step rate faster than machine accuracy required provides no advantages for the smart stepper.

                  I also find that many motion controllers try to change the step and direction pin at the same time, using one assembly instruction. For example they will set the GPIO port for the direction change and step using one instruction trying to increase speed. This can violate the timing requirements of even hardware based stepper driver chips, worse still is the line capacitance on the step and direction pins will dominate which pin changes first. This can create layer shifting issues as you have stated, even without the smart steppers.

                  A good motion controller will have some setup and hold time between direction change and step, a great motion controller will have this parameter settable.

                  Of course controllers like Duet are not designed for using external stepper driver boards. Hence often to use hardware for stuff it is not designed for requires some changes to the hardware or firmware, which is why open source projects like the Duet is great.

                  Trampas

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

                    @trampas said in Smart Steppers & CONN_LCD:

                    The firmware does disable interrupts but only disables the one interrupt needed. For example if a mutex is needed between a timer interrupt handler then the only interrupt that is disabled is the timer interrupt, not global interrupts. Additionally the interrupt priorities are set with the direction interrupt being the highest priority, such that it can interrupt other lower priority interrupt handlers.

                    What I should have asked is: does the firmware ever disable interrupts globally, by calling cpu_irq_disable (or cpu_irq_save), or __disable_irq, or any similar function?

                    @trampas said in Smart Steppers & CONN_LCD:

                    I also find that many motion controllers try to change the step and direction pin at the same time, using one assembly instruction. For example they will set the GPIO port for the direction change and step using one instruction trying to increase speed. This can violate the timing requirements of even hardware based stepper driver chips, worse still is the line capacitance on the step and direction pins will dominate which pin changes first. This can create layer shifting issues as you have stated, even without the smart steppers.

                    RRF doesn't do that. What is does is to generate the rising edge of all the step pulses required simultaneously. Then it computes the times that the next step pulses are due. If the next step pulses are in the reverse direction, it changes the direction signal at that point, taking care to satisfy the configured step-to-direction hold time if it has been configured. Then it generates the falling edge of the step pulse.

                    @trampas said in Smart Steppers & CONN_LCD:

                    Of course controllers like Duet are not designed for using external stepper driver boards. Hence often to use hardware for stuff it is not designed for requires some changes to the hardware or firmware, which is why open source projects like the Duet is great.

                    Yes it is! You can configure the step pulse width, step pulse interval, direction-to-step setup time and step-to direction hold time separately. But the user needs to know what values to configure, and the setup/hold times are relative to the rising edge of the step pulse.

                    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

                    Trampasundefined 1 Reply Last reply Reply Quote 0
                    • Trampasundefined
                      Trampas
                      last edited by

                      @dc42 said in Smart Steppers & CONN_LCD:
                      Yes it is! You can configure the step pulse width, step pulse interval, direction-to-step setup time and step-to direction hold time separately. But the user needs to know what values to configure, and the setup/hold times are relative to the rising edge of the step pulse.

                      That is awesome, the last I checked a few years back the Duet firmware was pulsing the enable pin for communication with the Trinamic drivers and thus the firmware had to be changed to make it work with the smart steppers. It is good to know this has been fixed.

                      Trampas

                      1 Reply Last reply Reply Quote 0
                      • Trampasundefined
                        Trampas @dc42
                        last edited by

                        @dc42
                        What I should have asked is: does the firmware ever disable interrupts globally, by calling cpu_irq_disable (or cpu_irq_save), or __disable_irq, or any similar function?

                        The global interrupts are not disabled in my code. There are certain actions that can cause a stall the processor, ie during flash writes, however these only happen when user initiates them by changing settings and not during normal use.

                        Trampas

                        1 Reply Last reply Reply Quote 0
                        • maxbotsundefined
                          maxbots
                          last edited by

                          @dc42 Based on @Trampas comments here, would you say that this should address the concerns you raised with the Smart Stepper?

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

                            @maxbots said in Smart Steppers & CONN_LCD:

                            @dc42 Based on @Trampas comments here, would you say that this should address the concerns you raised with the Smart Stepper?

                            It all sounds good. I had a feeling that someone else had run into direction hold problems using a Smart Stepper, but I may be mistaken - perhaps it was a different device.

                            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