Jump to content

How to hookup TMC2240 driver


Thomas IJsseldijk

Recommended Posts

Hi,

I recently received the TMC2240 drivers I ordered. I attempted to connect and control them with a Pi Pico, but unfortunately, I was unsuccessful. I'm unsure if I've connected everything correctly. Here's the hookup configuration I used:

  • VM -> 24V from the power supply
  • VIO -> 3v3 from Pico
  • GND -> both power supply and Pico GND
  • Dir -> GND
  • EN -> GPIO set to LOW (GND)
  • STEP -> GPIO with 1ms ON 1ms OFF pulse (verified with a scope)
  • MOTORPINS -> NEMA 17 motor

Is there anything I might be doing wrong? I couldn't find any useful documentation from BTT.

Kind regards, Thomas

Link to comment
Share on other sites

hi @kaktus.

i did indeed found the repo. the manual in there is not really focused on useing the drive with anything other than a BTT mainboard. the plan for my project is to make a standalone stepperdrive module powered with a rp2040 and tmc2240. I would like to use it with just the step and dir pin although im planning to add support for SPI in the future.

 

Link to comment
Share on other sites

Is it possible to use Trinamic drivers in standalone mode.

Klipper has done a good job of preparing documentation for the user.
It is possible that something in it will point you in the right direction.


Basic control information is always included in the manufacturer's datasheet.

Page 124 of the datasheet includes a diagram from Typical Application Circuits

Read the Principles of Operation chapter, it is not long and the information there will certainly be useful. 😉

 

At the moment I cannot help you any more because I am learning everything myself. Write here about your progress. 😊

Link to comment
Share on other sites

On 12/22/2023 at 7:55 PM, Thomas IJsseldijk said:

Hi,

...

  • Dir -> GND
  • EN -> GPIO set to LOW (GND)

...

Kind regards, Thomas

Quote

Step and Direction Interface
The motor is controlled using a step and a direction input. Active edges on the STEP input can be rising edges or
both rising and falling edges as controlled by mode bit (dedge). Using both edges cuts the toggle rate of the STEP
signal in half, which is useful for control over slow interfaces such as optically isolated couplers. On each active edge,
the state sampled from the DIR input determines whether to step forward or back. Each step can be a fullstep or a
microstep, in which there are 2, 4, 8, 16, 32, 64, 128, or 256 microsteps per fullstep. A step impulse with a low state on
DIR increases the microstep counter and a high state decreases the counter by an amount controlled by the microstep
resolution. An internal table translates the counter value into the sine and cosine values which control the motor current
for microstepping.

So it can take a high or low state. Here we are talking about the voltage levels of the control logic.

 

Quote

Control Interfaces
The TMC2240 supports both, an SPI interface and a UART-based single-wire interface with CRC checking. Selection
of the actual interface combination is done through the UART_EN pin, which can be hardwired to GND or VCC_IO
depending on the desired interface selection.
The SPI interface is a bit-serial interface synchronous to a bus clock. For every bit sent from the bus controller to the
bus peripheral, another bit is sent simultaneously from the peripheral back to the controller. Communication between an
SPI controller (e.g., an MCU) and the peripheral always consists of sending one 40-bit command word and receiving one
40-bit status word.
The single-wire interface allows a bidirectional single-wire interfacing. It can be driven by any standard UART. No baud
rate configuration is required

 

page 15 of the data sheet:

Pin name: UART_EN

obraz.png.0237dd48d05d3a97987219f09e4971bb.png

 

Quote

Interface selection pin.
When tied low, the SPI interface is enabled.
When tied high, the UART interface is enabled.
Integrated pull-down resistor.

@Thomas IJsseldijk

You can also leave this pin unconnected because it has an internal pull-down resistor. This means that it is driven by a low state. However, this is only good for testing. I would not leave this pin unconnected in a "working production circuit".

I have not reviewed the entire data sheet.
But I expect that at the beginning of the operation it will be necessary to load the configuration into the controller. It is also possible that some settings will take default values. But is this going to be suitable for you ❔

Quote

Step/Direction Interface
The STEP and DIR inputs provide a simple, standard interface compatible with many existing motion controllers. The
MicroPlyer step pulse interpolator brings the smooth motor operation of high-resolution microstepping to applications
originally designed for coarser stepping.

In any case, you must read the entire contents of the data sheet. Then you will reach your goal.

Do you have a ready-made module or are you building the PCB yourself ❔

 

Cheers. 😉

obraz.png

Link to comment
Share on other sites

@kaktus

 

8 hours ago, kaktus said:

Do you have a ready-made module or are you building the PCB yourself ❔

i have the tmc2240 module from bigtreetech (thats why i asked for help on this forum).

so in my experience with other tmc type stepper drivers it should be a matter of power and enable/step/dir to make it work. 

i tested the same setup i have now by replacing the tmc2240 for a tmc2209 module which worked fine.

so i drew the conclusion that it should have to do something with the driver. 

8 hours ago, kaktus said:

So it can take a high or low state. Here we are talking about the voltage levels of the control logic.

i know.

8 hours ago, kaktus said:

But I expect that at the beginning of the operation it will be necessary to load the configuration into the controller. It is also possible that some settings will take default values.

it could be possible that the driver only work when configured with UART or SPI although it feels higly unlikely (i could be wrong though)

i hope ill find a solution

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...