Trouble driving an external stepper driver with Duet 2 Wifi



  • Hello all, first-time poster here.

    First off, I am so happy with the Duet! It's a well-designed and thought out board, with a good user interface via DWC and documentation that is an order of magnitude better than most of what is out there. So thank you for making and supporting such an excellent product.

    I am trying to use a Duet 2 Wifi to control a cartesian printer, and running into an issue controlling an external stepper driver. Details about the setup as follows:

    Firmware Name: RepRapFirmware for Duet 2 WiFi/Ethernet
    Firmware Electronics: Duet WiFi 1.02 or later
    Firmware Version: 2.02(RTOS) (2018-12-24b1)
    WiFi Server Version: 1.23
    Web Interface Version: 1.22.6

    The printer itself is a Flashforge Creator Pro, which I am in the process of converting over to a clay-extruding printer. In practice, this means I removed the original plastic extruder heads and the original motherboard (mightyboard 1.4) from the FFCP, but left all the axis motion components untouched. I replaced the mightyboard with a Duet 2 wifi, and the plastic extruder heads with two new extruders, one smaller "screw" extruder that runs on 400mN.m stepper, and a larger "ram" extruder that runs on a 1200mN.m stepper attached to a worm drive reduction mechanism. The ram stepper is too large for the Duet's onboard drivers, so I am controlling that with a DM542S external stepper driver, which is in turn controlled by the "conn_lcd" connector (channel 10). I am not currently able to get that external driver to receive a proper input from the Duet 2 and send an output to the ram stepper. The PSU is 24VDC.

    I've attached my config.g file, a datasheet for the DM542S, and a couple photos of the setup to this post, and below are the voltage readings I am getting across various terminals when I try to manually run the motor with the "extrude/retract" buttons in DWC.

    Wiring between the Duet 2 conn_lcd connector & the DM542S
    (1) +3.3V --> ENA+
    (2) GND --> DIR- & PUL- (in parallel, I got two wires into a single crimp on the Duet connector end)
    (5) EN 10 --> ENA-
    (7) DIR 10 --> DIR+
    (9) STP 10 --> PUL+

    When I turn everything on, I measure on the external stepper driver:
    2.75 VDC across EN-/EN+
    2.7 VDC across DIR-/DIR+
    0.016 VDC across STP-/STP+

    When I send a movement command to the motor via DWC, I measure:
    2.75 VDC across EN-/EN+ (no change)
    2.7 VDC across DIR-/DIR+ (no change)
    0.054 VDC across STP-/STP+ (small but consistent rise in voltage. As best I can tell from a digital multimeter readout, this is either a square wave or a nice steady sinusoid, it ramps up and then back down very smoothly)

    Unsurprisingly, that small mV pulse to the STP terminals does not seem to trigger the external driver. All the output terminals remain static during movement commands. I don't believe anything in my config.g file should be explicitly causing the low signal voltage, but am not strongly confident about that.

    I am fairly sure that the wiring itself is okay, since the larger stepper motor is definitely getting passed some current (it heats up very slightly when turned on, and heats up more when it is commanded to move via DWC). I did crimp all the wires into a plastic connector (to interface with the conn_lcd port), so it's possible that I have some contact resistance or a bad connection on one or two of the wires? That way lies madness though - I figured I'd check here on the forum to see if I was doing something obviously boneheaded before I start really mistrusting all my physical connections and verifying them with wire-by-wire ohm readings.

    If there's any other information I can provide or tests/troubleshooting steps that would be useful, please don't hesitate to let me know and I will try them out & report back ASAP.

    Thank you!
    Eric

    config_inprogress.g

    DM542S.pdf

    Photo May 28, 6 42 37 PM.jpg Photo May 28, 6 43 18 PM.jpg



  • Save yourself a lot of screwing around and get one of these: https://www.duet3d.com/Expansion_Breakout

    I just used one with a Duet WiFi to drive integrated servomotors with direct connections to the differential outputs on the expansion board.



  • Thanks, I didn't realize that product existed! Just ordered one, we'll see how it goes.



  • @EricT If you're going to use the expansion board to drive external drivers replacing the X and Y motors, you have to remap the X and Y to the expansion board.
    These are the config file statement I used to drive external drivers:

    M584 X5 Y6 ; remaps the X and Y motor drives to the Duet expansion board, first two ports
    M569 P5 S1 R1 T4.0:5.0:6.0:11.0 ; sets the timing parameters for the X motor servo drive signals
    M569 P6 S1 R1 T4.0:5.0:6.0:11.0 ; sets the timing parameters for the Y motor servo drive signals
    M92: X31.25 Y31.25 ; sets steps/mm for motors using 16 tooth drive pulley and 1000 steps/rev
    M350 X1 Y1 ; sets Duet to output full steps (microstepping is handled by the servomotor drivers)

    The integrated servos I am driving handle the microstepping, in my case set to 1000 steps/rev to match the 1000 line encoder. I have 16 tooth drive pulleys, so steps/mm works out to 31.25 steps/mm. The Duet board spits out full steps and the drivers turn them into microsteps. In other words, to the Duet board, the external drivers look like motors that take 1000 steps to make one revolution.

    The M569 statements are important. You have to study the timing diagram for the drivers you're using and try to pick appropriate values. When I first hooked it up I had the pulse duration set to 2.5 us to match what the driver timing diagram showed. Unfortunately, that didn't work right and I got inconsistent motion. I bumped the step pulse duration to 4 us and it started working perfectly. I should probably try decreasing it a bit, but I'll never get close to maxing out the pulse rate so 4 us is fine.



  • Okay, bumping this issue again, I ordered & installed the expansion board, but am still unable to successfully drive the larger stepper motor in my setup via the external driver.

    When I try to run it with the extrude/retract button in DWC, I get the error:
    "Warning: motor phase A may be disconnected reported by driver(s) 4
    Warning: motor phase B may be disconnected reported by driver(s) 4"

    The only motor that is having problems is the "ram extruder", which is connected to E2 on the expansion board and being run via a DM542S external stepper driver. All other motors (X, Y, Z, and the "screw extruder" E1) are being run from the internal drivers on the Duet 2 wifi without any problems.

    In terms of troubleshooting steps, I've checked continuity between each of the the external driver's output terminals and the matching pin of the connector that goes into the stepper motor, no issues there. When I check voltage differences across the input terminals of the external driver (PUL+/-, DIR+/-, ENA+/-), I get a steady 3.4V for all of them, and none of them show a change from that when I command the motor run.

    Any input on what to troubleshoot next would be appreciated, I'm pretty much at the end of my knowledge here.

    My config.g file is as follows:

    ; Configuration file for Duet WiFi (firmware version 2.00)
    ; executed by the firmware on start-up
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.8 on Tue Feb 04 2020 22:23:02 GMT-0500 (Eastern Standard Time)

    ; General preferences
    G90 ; send absolute coordinates...
    M83 ; ...but relative extruder moves
    M550 P"Cerambot" ; set printer name

    ; Network
    M552 S1 ; enable network
    M586 P0 S1 ; enable HTTP
    M586 P1 S0 ; disable FTP
    M586 P2 S0 ; disable Telnet

    ; Drives
    M569 P0 S0 ; physical drive 0 (X) goes backwards
    M569 P1 S0 ; physical drive 1 (Y) goes backwards
    M569 P2 S1 ; physical drive 2 (Z) goes forwards
    M569 P3 S1 ; physical drive 3 (E1, screw extruder) goes forwards
    M569 P4 S0 T10:10:10:10 ; physical drive 3(E2, ram extruder) goes forwards, all pulse widths & signal intervals set to 10us
    M584 X0 Y1 Z2 E3:4 ; set drive mapping
    M350 X16 Y16 Z16 E16:16 I1 ; configure microstepping with interpolation
    M92 X320.00 Y320.00 Z320.00 E200.00:250.00 ; set steps per mm
    M566 X1200.00 Y1200.00 Z1200.00 E1000.00:2000.00 ; set maximum instantaneous speed changes (mm/min)
    M203 X18000.00 Y18000.00 Z18000.00 E2000.00:10000.00 ; set maximum speeds (mm/min)
    M201 X1000.00 Y1000.00 Z1000.00 E200.00:1000.00 ; set accelerations (mm/s^2)
    M906 X1000 Y1000 Z1000 E1000:1000 I30 ; set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 Z0 S1 ; set minimum Z

    ; Endstops
    M574 X2 Y2 Z2 S0 ; set active low endstops

    ; Heaters
    M140 H-1 ; disable heated bed

    ; Fans

    ; Tools
    M563 P0 D0 ; define tool 0 (test only, ram extruder)
    M563 P1 D1 ; define tool 1 (test only, screw extruder)

    M563 P2 D0:1 ; define tool 2 (both extruders)
    G10 P0 X0 Y0 Z0 ; set tool 2 axis offsets
    G10 P0 R0 S0 ; set initial tool 2 active and standby temperatures to 0C
    M568 P0 S1 ; enable mixing for tool 2
    M567 P0 E0.5:0.5 ; set mixing ratios for tool 2



  • @EricT
    The data sheet for your driver says the enable pins require 5-24 volts as does the step pins.
    Not sure what voltage the breakout board delivers, but could be that the driver just isn’t being enabled.



  • @OwenD said in Trouble driving an external stepper driver with Duet 2 Wifi:

    Not sure what voltage the breakout board delivers, but could be that the driver just isn’t being enabled.

    https://duet3d.dozuki.com/Wiki/Duet_Expansion_Breakout_Board#Section_Notes (tl;dr 3.6v differential)



  • @EricT for using 5v there are notes how to use it in the link @bearer gave.
    But DM542 doesnt need ENA to be connected at all, default is enabled.

    If you have an Arduino uno lying around, testing DM542 and stepper to be sure both work is easy with the help of the AccelStepper library.

    One problem which I had with DM542 was that the switches on positions were counterintuitive*). There is a small arrow pointing to the on position and the label ON on the switch to show where On is. I nearly killed the stepper by using 4A instead of 2A because I thought up is on. Better check it. With too much current the stepper doesnt rotate and gets hot.

    *) I have often problems to read those labels, especially on SMD parts. I had the idea to take a picture with the smartphone and magnify it. This works pretty well.



  • @EricT In the image your SW1, SW2 and SW3 seem to be in off position, so it seems to me you set 4.2A for the stepper. (same as happended to me...)

    If the stepper was in this high current too long and was too hot, the used neodym magnets inside loose their magnetism (above 80 °C) and the stepper would need to be replaced. My stepper was very warm, but survived.

    Side note: maybe you were lucky that the too low ENA voltage hindered the controller to be activated and destroying the stepper.



  • @EricT the SW4 to 8 set the microstepping, you have set 1600, please check it does fit with your config setting M350 and the M92 calculation. And the M350 looks strange, you set two microstepping values for E, but have only one stepper attached.

    I must confess I have an DM542T Stepperonline, slightly different label, so I'm sorry if I am wrong with the two last posts if e.g. your switches are other round. My switches are off in the direction up towards the description, on is down. (the google images I checked are all On = down)


  • administrators

    @EricT said in Trouble driving an external stepper driver with Duet 2 Wifi:

    When I try to run it with the extrude/retract button in DWC, I get the error:
    "Warning: motor phase A may be disconnected reported by driver(s) 4
    Warning: motor phase B may be disconnected reported by driver(s) 4"
    The only motor that is having problems is the "ram extruder", which is connected to E2 on the expansion board and being run via a DM542S external stepper driver. All other motors (X, Y, Z, and the "screw extruder" E1) are being run from the internal drivers on the Duet 2 wifi without any problems.

    Driver 4 is the internal driver labelled E1 on the Duet. It's not one of your external drivers. So this line:

    M569 P4 S0 T10:10:10:10 ; physical drive 3(E2, ram extruder) goes forwards, all pulse widths & signal intervals set to 10us

    is setting the step pulse width on the wrong driver. External drivers connected to the breakout board are numbered 5 to 9.

    On many external drivers, the input labelled ENA is actually a disable input, not an enable input. Use the R1 parameter in the M569 command for that driver to handle this.



  • Thank you for the responses and the help everyone! I've got all motors working now, and should be able to finish the rest of the machine from here without any issues.

    The primary two issues turned out to be the bad drive mapping (I was using P4 instead of P5) and the flipped ENA input. Once I changed those two things, the larger motor worked perfectly. Thank you for your help @dc42! (and for creating a good product in general, this thing has been a pleasure to work with)

    @JoergS5, thank you for pointing out the high stepper current. I had originally thought that my larger motor needed 4A, but your comment made me go back and double-check - turns out 2A was correct after all (and thanks to you I didn't even have to burn a motor to find that out).

    Incidentally, this setup actually does have two stepper motors for extrusion, that bit wasn't a mistake. It's a clay-extruding printer (Cerambot), with a larger motor pushing the clay out of a large syringe and through a feed tube to the printhead, and a smaller stepper at the printhead itself driving an archimedes screw to extrude the clay onto the build plate



  • @EricT Thank you for confirming that the ideas had a sense. I wish you success with your project!


Log in to reply