I am trying to drive two stepper motors NEMA23 with two DM542 microstep driver (one for each) and a Teensy 4.1 as controller: http://tinel.com/uploads/DM542.pdf

Please find datasheet of DM542 here: https://kitaez-cnc.com/f/dm542.pdf

I am able to drive both motors if I am using an Arduino Mega2560 as controller without issue. However when I switch to a Teensy 4.1 after changing some parameters in my software for compatibility between Arduino and Teensy, I thought to be able to drive my stepper motors. However with the Teensy the motors starts to run and then stops randomly.

Output of Arduino is +5V instead of +3.3V for Teensy, so I am using a LLC (transistor based), to convert +3.3V to +5V to feed input of DM542 which need (+5V to +24V as input).

My DM542 is connected in cathode mode. The only difference between the two configuration (the one with Arduino and the one with Teensy) is that my STEP signal is inverted and that I am using a LLC to convert my step signal +3.3V to +5V.

This image will explain better:

enter image description here

My questions/remarks:

  • output of LLC (HV1) has a pull up resistor 10 kohm and in the datasheet of DM542, if you drive with a +5V signal you must not have any resistance in the PUL(STEP) line and on the other lines (DIR and EN). Can it be my issue ? I put a resistor in parallel to decrease the value of the pull-up, it's working better but my motors still stop randomly before ending their respective cycles.

  • DM542 is currently in cathode mode, should I plug it in anode mode ? What is the better ?

  • output of my LLC (BOB-12009) is not +5V, why ? Should I use another LLC ?

  • the signal sent to DM542 is inverted because LLC transistor (BSS138) is closed when Teensy send no signal to LV1 and is open when Teensy send +3.3V signal to LV1. Can it be an issue to have the signal inverted if DM542 is connected in cathode mode ?

  • can it be a software issue ? My code is running without error and the libraries I am using are compatible between arduino and teensy.

Thank you a lot for your help, I am really stuck and I don't understand what I am doing wrong here...

enter image description here

  • 1
    \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – SamGibson
    Apr 24, 2021 at 13:01
  • 1
    \$\begingroup\$ Your blue block diagram shows STEP, DIR and EN connections to the motor. I think that's a copy and paste error. \$\endgroup\$
    – Transistor
    Apr 25, 2021 at 7:22

2 Answers 2


You really don't want to use that type of logic level converter. Fine for I2C, but not much else. Note - these do not invert and only actively pull low. The DM542 datasheet gives you a hint on how to drive it. I'd suggest some BSS138 mosfets would be suitable. Basically 0V to the drain, port pin -> 10 Ohm resistor-> mosfet gate. Source to - of input to DM542. This WILL invert the signal, but due to the circuit a LOGIC 1 on the teensy will turn on the opto. Home free.

  • 1
    \$\begingroup\$ So if I use my DM542 driver in common annode mode means STEP-/DIR-/ENA- connected to my controller (Teensy), I don't necessary need a LLC even if my controller output is +3.3V ? I just need to connect to STEP-/ENA-/DIR- NMOS transistors as it's described into §9 "Typical connection" of DM542 datasheet ? I only need a LLC if I connect my controller to positive inputs of DM542 driver ? Thanks \$\endgroup\$
    – Armand
    Apr 22, 2021 at 12:08
  • 1
    \$\begingroup\$ I think someone needs to draw a schematic to clarify the situation. Your use of LLC is confusing as it is a general term. You can't connect the GPIO of the teensy directly to STEP- as the circuit requires 5V on the STEP+. The teensy would not like this. You require extra circuitry like I described- ie three BSS138 mosfets and three 10Ohm resistors. This is one form of a LLC (logic level converter) of which there are many. \$\endgroup\$
    – Kartman
    Apr 22, 2021 at 12:17
  • 1
    \$\begingroup\$ I just added a small schematic into my issue description. STEP-/DIR-/EN- are already connected to 3 different BSS138 N-CH MOSFET. I just draw the logic on the STEP- but it's the same for EN- and DIR-. \$\endgroup\$
    – Armand
    Apr 22, 2021 at 12:34
  • 1
    \$\begingroup\$ That is not what I described. \$\endgroup\$
    – Kartman
    Apr 22, 2021 at 12:43


How to use MCU (Teens4, STM32, Rpi4B, Rpi Pico) and DM542 microstep driver to control NEMA 17 / NEMA 24 stepper motors?


Short Answer

  1. There are many possible causes of trouble. I opened the DM542 module coveer and found three optocouplers EL817c and current limiting resistors 270Ω. One cause is on the input side of the DM542. The three EL817C each needs 5mA to 20mA to enable/trigger. The 20mA current can be from a common cathode source driver, or common anode sink driver.

dm542 optocoupler driver

  1. Now I am going to wire up HCT125 to DM542


/ to continue, ...

Long Answer (TLDR)

/ to continue, ...


(1) Teensy 4.0 (ARM Cortex-M7 600MHz, NXP iMXRT1062, Teensyduino 64-bit memory, branch prediction) - SparkFun US$20

(2) DM542 Fully Digital Stepper Driver User's Manual v1.0 - LeadShine Tech

(3) CNC 9-30V DC 128A Stepper Motor Controller, Microstep - AliExpress US$14

(4) Fake microstepping in A4899 stepper-drivers - @GnuReligion, EESE, Asked 2021apr14

(5) What could be the reasons for a stepper motor stuttering with an A4988 driver?, EESE 2021apr05

(6) YouTube video of A4988 driving stepper motor in 16th microstep

(7) HCT125 - Quad Level-Shifter (3V to 5V particularly good for Teensy 3 to NeoPixel) - AdaFruit US$1.50

(8) HCT125 Quadruple bus buffer gates with three state outputs - TI 2003jul

(9) HCT125 Rpi Wiring Example - AdaFruit 2014sep12

(10) DM542 Digital Microstepping Motor Driver User’s Manual - SysMotor

(11) TBX0108 8-channel Bi-directional Logic Level Converter - AdaFruit $8

(12) TXB0104 has weak outputs to drive 23LC1024 - AdaFruit

(13) What is microstepping? - Zak Khan, Motion Control Tips, 2016dec30

(14) How do stepper drives and motors get smooth motion and consistent torque at low speed? Zak Khan 2016dec08

(15) What is microstepping? - njr

/ to continue ,...



Appendix A - DM542 Microstepper Configuration Settings

Appendix B - DM542 HCT125 3V3 to 5V0 Common Cathode Wiring

Appendix C - DM542 Setting up and Troubleshooting Check List

Appendix A - Microstepper Configuration Settings

config 1

Appendix B - Wiring Diagram for HCT125 Common Cathode Configuration

common cathode wiring

Appendix C - DM542 Setting up and Troubleshooting Check List


/ to continue, ...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.