element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Motors and Drives
  • Technologies
  • More
Motors and Drives
Blog Trinamic Stepper Motor Controller TMC2300 - C++ Custom Firmware Pt 2: Wire Up and Comms Analysis
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Motors and Drives to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 16 Feb 2020 10:47 AM Date Created
  • Views 1296 views
  • Likes 5 likes
  • Comments 2 comments
  • trinamic
  • tmc2300
  • stepper
  • tmc2300-eval-kit
Related
Recommended

Trinamic Stepper Motor Controller TMC2300 - C++ Custom Firmware Pt 2: Wire Up and Comms Analysis

Jan Cumps
Jan Cumps
16 Feb 2020

I'm road testing Trinamic TMC2300 EVAL KIT (2-PH Stepper Motor). It's their latest design that targets battery powered devices.

In this post: part 2 of a custom program to control the driver over UART.

image

This series of posts is an attempt to use the TMC2300 in a real design. I'm using a Hercules microcontroller in stead of the Landungsbrücke to control a motor. Firmware is in C++

 

 

Wiring from Hercules to Eselsbrücke

When using the TMC2300 in UART mode, the MODE pin has to be pulled to GND.

I'm also pulling STEP and DIR to GND, because I'll only use Trinamic's TMCL commands to drive the motor.

Both address pins are tied to GND, setting the address to 0.

 

VIN/~STBY and EN are connected to a GPIO pin. We'll controle those form the Hercules microcontroller.

The RX and TX pins are wired to the Hercules SCI peripheral.

STEPPER is connected to VIO. It's used together with MODE to set the IC to UART or Step/Dir operation.

image

The Hercules is a 3V3 device, so I've wired VIO to 3.3 V. This takes care that the I/O of the board doesn't exceed 3.3 V.

In summary, this table shows the wiring between the microcontroller and the Eselsbrücke:

 

image

 

Driving the GPIO and UART Signals

I've chosen to use classes to control GPIO and UART.

For the GPIOs, I reused the port of the MBED DigitalOut class that I did earlier.

 

#include "platform/DigitalOut.h"

DigitalOut vin(GIOA4);
DigitalOut en(GIOA7);

void CPPMain::main() {
  gioInit();
  vin = 0;
  en = 0;
  // ...
}

 

The UART communication was developed in the previous post.

 

#include "trinamic/HerculesTMCLDatagram.h"

HerculesTMCLDatagram datagram(1U);

void CPPMain::main() {
  // ...
  sciInit();
  HerculesSciInit initStruct;
  initStruct._sci = scilinREG;

  datagram.init(&initStruct);

  // ...
}

 

The datagram and UART based classes have gone through a big change though. I've attached the reworked Code Composer Studio to the end of this post.

I'm going to use the low level TMC2300 datagrams instead of the functional TMCL datagrams. There's already an example of TMCL datagram operation running on the Landungsbrücke.: the firmware from Trinamic on GitHub.

I've ported the CRC calculation from Trinamic's sources. The C example in the datasheet didn't return the correct value.

The example is now in a good enough state to send valid datagrams to the TMC2300 over UART. Time to first capture some evaluation kit communications that can serve as examples.

 

Analyse Evaluation Kit Example UART DataGram Dialogs

 

I've captured a series of exchanges with a protocol analyser connected to the UART.

The capture starts when turning on the TMC2300 by setting VIO and EN high.

 

You can ignore the Rx signals in the captures below.

Because the 1-line UART used and the capabilities of my analyser, I can't show what's sent and what's received on different lines.

But because we know what a datagram is supposed to look like, we can interpret what's coming from the Landungsbrücke and what from the TMC2300.

 

First conversation:

 

Write from Landungsbrücke

image

 

This is a write of the value 0 to register 0x01

image

 

Second conversation:

 

Query from Landungsbrücke that seems to not receive an answer

image

then a Write from Landungsbrücke

image

This is a request to read register 0x06.

Then a write of value 0 to register 0x03

image

 

Third conversation:

 

This is the first one where I see an answer from the TMC2300:

 

image

First a request to read from register 0x06.

Then an answer from TMC2300, 32 bit data 0x40 0x00 0x00 0x62

image

 

Fourth conversation:

 

A write conversation again

image

 

Here, the 32 bit value 0x00 0x07 0x03 0x01 is written to register 0x10

image

Registers Used:

 

image

image

image

image

image

 

 

Now that I understand this communication, I should be able to mimic this conversation on the Hercules. That's for the next blog.

The current version of the project is attached here.

 

related blog
UART Interface
Evaluation Kit and IDE Functionality, basic functionality
C++ Custom Firmware Pt 1: Datagram Classes
C++ Custom Firmware Pt 2: Wire Up, Test and Comms Analysis
C++ Custom Firmware Pt 3: Try to Replicate Evaluation Kit Conversation
Trinamic TMC2300 EVAL KIT (2-PH Stepper Motor) - Review
Attachments:
TMS570LS04_trinamic_tmc2300_cpp_20200216.zip
  • Sign in to reply

Top Comments

  • clem57
    clem57 over 5 years ago +1
    A nice way to learn the operations. Thanks Jan Cumps for informative blog. Looking for the Hercules expanded part of the operation.
  • DAB
    DAB over 5 years ago +1
    Good post Jan. DAB
  • DAB
    DAB over 5 years ago

    Good post Jan.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 5 years ago

    A nice way to learn the operations. Thanks Jan Cumps for informative blog. Looking for the Hercules expanded part of the operation.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube