[Grbl_Esp32 Issue#377] 4 TMC5160 drivers SPI daisy chain with auto squaring and sensorless homing?

未分类 bolang 4个月前 (10-14) 48次浏览

Issue #377 | 状态: 已关闭 | 作者: bennedebakker | 创建时间: 2020-04-12


Hi,

First of all, thank you for the amazing work you guys have been doing for this project! I am in the process of designing a simple PCB for 4 TMC5160 drivers in daisy chain mode. (Something very similar to https://github.com/bdring/4AxisSPI_CNC).

I would like it to have the following functions:

– 1 stepper motor on the X-AXIS, 2 stepper motors on the Y-AXIS and 1 stepper motor on the Z-AXIS
– sensorless homing (if possible)
– auto squaring of the gantry, hence two stepper motors on the Y-AXIS
– configuration of the drivers through SPI via daisy chain

So far I understand that I will have to use 1 CS pin for all the drivers and a separate STEP pin for the second Y-AXIS motor. To get auto squaring to work, I would need to connect two limit switches (1 for each Y-AXIS motor), to the same YLIMITPIN, correct? machine.h would then look something like this:

#define MACHINENAME "TESTCNC"

#define USE_TRINAMIC
#define TRINAMICDAISYCHAIN

#define USETRINAMICENABLE

#define USEGANGEDAXES // allow two motors on an axis

#define XDRIVERTMC5160
#define X_RSENSE 0.075f
#define XSTEPPIN GPIONUM12
#define XDIRECTIONPIN GPIONUM26
#define X_TRINAMIC
#define XCSPIN GPIONUM17

#define YDRIVERTMC5160
#define Y_RSENSE 0.075f
#define YSTEPPIN GPIONUM14
#define Y2STEPPIN GPIONUM21 // ganged motor
#define YDIRECTIONPIN GPIONUM25
#define Y_TRINAMIC
#define YCSPIN XCSPIN
#define YAXISSQUARING

#define ZDRIVERTMC5160
#define Z_RSENSE 0.075f
#define ZSTEPPIN GPIONUM27
#define ZDIRECTIONPIN GPIONUM33
#define Z_TRINAMIC
#define ZCSPIN XCSPIN

#define XLIMITPIN GPIONUM2
#define YLIMITPIN GPIONUM4
#define ZLIMITPIN GPIONUM15

So the second Y-AXIS motor is defined by Y2STEPPIN. For the SPI setup, it looks like you need to put the drivers in the right order, i.e. X, Y then Z when using daisy chain mode. How do you set up a second Y-AXIS motor with the same settings as the first one, where does it fit in the daisy chain? Do you have to wire it after the first Y, so X-Y-Y2-Z, or at the end, as if it was the A-AXIS X-Y-Z-Y2? Is there automatically an extra set of bits send when you enable USEGANGEDAXIS and Y2STEPPIN, so (4) sets of 40 bits?

One last question: Is sensorless homing already supported by GRBL_Esp32, i.e. connect diag1 or diag0 to the limit switch pins?

Thank you for any help.

Benne


评论 (4)

#1 – bdring 于 2020-04-12

FWIW: I have a large batch of those boards coming soon. Already shipped via DHL, but they are slow these days.

Ganged axes with Trinamic drivers is not implemented yet. I will add that this week. The order of the drivers is currently specified like this. I’ll need to make this dynamic to allow ganged axes to be inserted. Most likely a typical order will be like X-Y-Y2-Z.

C++
#ifndef TRINAMICDAISYCHAIN
#define XDRIVERSPI_INDEX -1
#define YDRIVERSPI_INDEX -1
#define ZDRIVERSPI_INDEX -1
#define ADRIVERSPI_INDEX -1
#define BDRIVERSPI_INDEX -1
#define CDRIVERSPI_INDEX -1
#else
#define XDRIVERSPI_INDEX 1
#define YDRIVERSPI_INDEX 2
#define ZDRIVERSPI_INDEX 3
#define ADRIVERSPI_INDEX 4
#define BDRIVERSPI_INDEX 5
#define CDRIVERSPI_INDEX 6

My board is designed for 4 completely independent axes, so it would also need a Y2DIRECTIONPIN. That gives the controller more flexibility, but you would not need to do that on your controller.

Generic Sensorless homing is not supported in the master branch, but has been demonstrated on other branched like the

#2 – bennedebakker 于 2020-04-12

Oh awesome, thank you for the quick reply Bart! I will definitely check it out on Tindie once it’s available. It looks like the board will support everything I need when ganged axes with trinamic drivers is added, so probably no need to design my own.

So the $$ settings for the X or Y axis would then simply be copied to the second driver when ganged axes is enabled right? I don’t think there is ever a need for separate settings for the two drivers of 1 axis.


#3 – bdring 于 2020-04-12

There can only be one set of values for resolution, acceleration, etc per lettered axis.


#4 – bdring 于 2020-04-12

I made the changes and pushed the code to the devt branch. That will be merged to the master branch soon.

It all worked fine. I am glad this came up so I could knock it out before the boards arrived.


原始Issue: https://github.com/bdring/Grbl_Esp32/issues/377

喜欢 (0)