How to drive a stepper motor via UART with your Arduino Mega using a TMC5072-EVAL

Today we show how to connect TRINAMIC’s TMC5072-EVAL via Single Wire UART to an Arduino Mega for basic operation. The wiring is limited to the basic functionality to communicate via Single Wire UART.

Preperation

To use the 5V version of the Arduino MEGA you have to resolder Resistor from position R3 to R8. This enables 5V logic level for the TMC5072. The sense resistor by default is soldered to the right position. Please desolder and resolder to the left position.

Figure 1: Extract from TMC5072-EVAL schematic

 

Figure 2: TMC5072-EVAL with pins marked for logic supply voltage

Wiring

The wiring is very simple. You will need X jumper wires. To make the wiring easier you can connect the wire directly to the Eselsbrücke. As a reference you can use the TMC5072Eval_v10_01_Schematic.pdf. Here you 1nd the signals that are on each pin. The con1guration is documented in the comment section of the Arduino code.

Figure 3: Pinheader of TMC5072-EVAL

Arduino Code

The Arduino Code below is based on the TMC-API package. The program initializes the TMC5072 and executes a simple move to position cycle. The sequence will rotate two 200 full stepper motors 10 revolutions to the one and 10 revolutions to the other direction depending on the wiring of the stepper motor. Please refer to the TMC5072 datasheet or the TMCL-IDE as a reference for the different registers.

TMC5072-EVAL_UART.ino

TMC5072_register.h

CRC.h

CRC.cpp

TypeDefs.h

Download

The TMC5072-EVAL_UART zip file contains the Arduino project.

Related Pages

TMC5072-EVAL

TMC5072-LA

TRINAMIC Technology Access Package

www.trinamic.com

8 Comments

  • Wolfgang Kurz

    Can this solution also be transportet to a TMCM-1110 StepRocker Modul.
    Regards
    Wolfgang

  • Mario Nolten

    Hi Wolfgang,

    the stepRocker uses a different protocol than the TMC5072. With the UART interface on the TMC5072 you are writing values directly to its registers – same as via SPI – while the stepRocker uses TMCL as protocol.

    An example on how to implement a TMCL master in C++ can be found on our website:
    https://www.trinamic.com/fileadmin/assets/Support/Software/TMCLTestVC__.zip

    Best regards,
    Mario

  • windy.han

    when we connect the TMC5062-EVAL V1.1 to PC,after install the TMC50xx-EVAL-Setup.exe APP, alwasy return a mistake “Unexpected item with id:24 detected” and can not connect hardware. If you can give some advise?

  • Daniel Frenkel

    Is is better us use UART instead of SPI? It seems that SPI is a faster interface. If I want to use all of the features of the TMC5072 for two motors, such as stallGuard, will SPI be better?

  • Mario Nolten

    Hi Daniel,

    in general we recommend to use the SPI interface. Since the communication is faster. The UART interface is a very nice alternative in case you have limited pin count on the MCU. UART only needs 2 pins while SPI needs 4 pins.

    Best regards,
    Mario

  • Daniel Frenkel

    Thank you so much! Would it be possible for you to help me convert this tutorial into SPI? Since it is a better method to use

  • Mario Nolten

    Hi Daniel,

    you can basically use the SPI implementation from the Arduino Example using the TMC5130 and replace the data (register settings) by the data used in this example.

    If you need further technical assistance, it would be best to contact our support for this. Please visit http://www.trinamic.com and click on the blue message icon at the bottom right corner of any page for this.

    Best regards,
    Mario

Leave a Reply

Your email address will not be published. Required fields are marked *