Anyone figured out how to get Trinamic's TMC5160 drivers working with LinuxCNC?

More
16 Feb 2025 17:25 #321755 by amanker
One question. 5160 connected to rpi spi for its configuration only. Which will done one startup. So even if its not in real time. Since configuration only needed one time on startup. Does it matter that communication is slow as you said?
I am not a developer so I am asking.

Please Log in or Create an account to join the conversation.

More
17 Feb 2025 18:17 #321850 by 3404gerber
You are right, it wouldn't be a problem for configuration only. But I'm using the module to use the TMC5160 without step/dir signals, so I need a fast communication.

I received my RPi5 this week-end and had to change some parts of my code to make it work. Also, with the RPi4, I could control the CS pin "outside" the SPI routine, and use how many pins I wanted to. With the RPi5, this does not appear to be possible. So I will need to make some more changes in the code. I will probably keep the freedom of CS pin choice for RPi4 and use the dedicated CS pins per channel on RPi5.

Please Log in or Create an account to join the conversation.

More
19 Feb 2025 17:02 #322004 by amanker
Are you planning to add support for daisy chaining of drivers?

Please Log in or Create an account to join the conversation.

More
19 Feb 2025 17:49 #322008 by 3404gerber
Yes. On the video I posted all the 4 drivers are daisy chained. My plan is to allow to declare chains when loading the module, so you can have 2 chains of 2 daisy chained drivers, for example, or 3 "chains" of 1 driver, or what ever you want as long as you stay below the max allowed drivers (6 for now, but easy to change in the code). That's true for RPi 4, where the CS pin is managed as a GPIO pin. For the RPi 5, the max number of chains will be the max number of CS pin of the selected SPI channel (2 for SPI0, 3 for SPI1).

Please Log in or Create an account to join the conversation.

More
25 Feb 2025 21:29 #322634 by 3404gerber
Hi,

I have uploaded a first development version of my module on github.

It has not been deeply tested and will probably have some bugs. But it connects to drivers on RPi4 and RPi5 and moves motors. I wrote a very short how-to, but feel free to ask questions about how to use it.
The following user(s) said Thank You: meister

Please Log in or Create an account to join the conversation.

More
04 Mar 2025 18:18 #323167 by 3404gerber
Hi all,

I worked on the sensorless homing this week-end and it seems to work, at least on a single axis. I uploaded this video where you can see it in action. The code is a mess so I didn't upload it on github yet, and will first try it on a gantry system before publishing it. I also tried to connect a ABN magnetic encoder (AS5047P) directly on the TMC5160; I can read the encoder position through the X_ENC register and use it as feedback for LinuxCNC, as expected.

I'm not sure what next step will be; probably clean up the code a little and publish a "main" branch. I'd also like to try a Pi Zero 2 version without a GUI, actually without X-Server at all if that's possible, to see if this could be an option for OpenPNP users as a cheap yet powerfull motion controller.
The following user(s) said Thank You: meister

Please Log in or Create an account to join the conversation.

More
17 Jul 2025 10:16 #331939 by Yan_moto

I'm using those drivers currently. They are quite a beasty. It is possible to use them in standalone mode, but  i would advice against it if your motor is relatively low current (below 5A). I burnt one motor this way as setup of IRUN (with CFG pins) is half range up to full power - this is probably linear scale so 5 -10 A.

Best option is to have additional SPI capable device (arduino, rasperry pi, even 8081 probably would do) just to configure the driver(s).
Connect DIR/Step (and maybe DIAGs) to parallel/mesa card. 

Quite important to supply all 3 power inputs (took me some time to get figure this out)
- main board HV (0-60) 
- stepstick adapter VIO for logic (5V)
- stepstick adapter VM/ 24V (it can be lower - i'm  using 19.5V/4A now). As mentioned this input is exposed as VM on stepstick adapter - it should be used to  supply colling FAN but is also used to supply TMC internal voltage regulator and then some internal circuitry !!! 
As a observation it looks like this input require some power too like few amps (my 24V/1.6A died when suppling 3 drivers- was good with one).
 
Next step is just to tune parameters and you are set.


 

I did manage to get these boards to work in the mode I needed through SPI programming.
NEMA23 - 48v 3A
I measured the current on the 24V branch - 20-30mA when the engine was running.
Programming via SPI from STM32 has its own tricks, but it was actually very interesting!
 

Please Log in or Create an account to join the conversation.

More
24 Jul 2025 17:49 - 24 Jul 2025 17:55 #332275 by Yan_moto
I connected two TMC5160 drivers and a NEMA17 motor (from another driver) to the 24V power supply. The video shows the current with the motor running, and the second part of the video shows the motor holding current when stopped.
Each of the TMC5160 drivers drives a motor at 3A.


Last edit: 24 Jul 2025 17:55 by Yan_moto.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.563 seconds
Powered by Kunena Forum