Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMC2130 - consistently not working #10329

Closed
ghost opened this issue Apr 6, 2018 · 31 comments
Closed

TMC2130 - consistently not working #10329

ghost opened this issue Apr 6, 2018 · 31 comments

Comments

@ghost
Copy link

ghost commented Apr 6, 2018

Hi, I'm having a lot of trouble getting my TMC 2130 drivers to work. I have spend more than a week troubleshooting, only making slight progress.

I'm using genuine 2130's from Watterott, connected to a MKS Gen L. I've reversed all 4 CFG pins, so I can put jumper cables on them. Marlin 2.0.x - Bugfix is my goto Firmware, but I'm also testing on 1.1.x
I had an epiphany, when I realised the AUX 3 pins are reversed on the Gen L, compared to the Gen V1.4. Moving the jumpers around didn't fix my issue, but it did change the output on M122, from saying Stealthchop was 'false' to 'true'.
Across the 2 different versions of Marlin, I'm getting different problems. On 2.0.x I get no overheat error, but Driver Register says 'X = 0x00:00:00:00', and StealthChop will say 'true' if enabled in the firmware.
On 1.1.x, I get the overheat error, Driver Register says: 'X = 0xFF:FF:FF:FF', and StealthChop will always say 'false', even if it's turned on in software.
I've tried changing the pins from the default ones in Toms tutorial, to 4 different on Servo 2(D4, D5, D6 and D11), with the only change being in 2.0.x which is not getting Overheat error anymore. No change in 1.1.x-bugfix

I have heard that some have problems getting StealthChop to run properly (skipping steps, mostly), so I'm open to SpreadCycle. SPI is not a must either, but I'm finding it easier to find info on setting it up with it, than without it..

Configuration:

MKS Gen L
TMC 2130 (only testing X)
12v
Marlin 2.0.x-bugfix + 1.1.x

X pins:

#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38
#define X_CS_PIN            5

Have_TMC:

#define HAVE_TMC2130

#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)

  // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY
    #define X_IS_TMC2130

SPI:

    #define TMC_USE_SW_SPI
  //#define TMC_SW_MOSI       -1
  //#define TMC_SW_MISO       -1
  //#define TMC_SW_SCK        -1

Motor Driver Status:

  #define MONITOR_DRIVER_STATUS

  #if ENABLED(MONITOR_DRIVER_STATUS)
    #define CURRENT_STEP_DOWN     50  // [mA]
    #define REPORT_CURRENT_CHANGE
    #define STOP_ON_ERROR
  #endif

Stepper Driver Settings:

#define R_SENSE           0.11   // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER    0.3  // Scales down the holding current from run current
#define INTERPOLATE       true  // Interpolate X/Y/Z_MICROSTEPS to 256

#define X_CURRENT          800  // rms current in mA. Multiply by 1.41 for peak current.
#define X_MICROSTEPS      16  // 0..256

Material:

1.1.x:
1 1 x - pin 6

2.0.x-bugfix:
2 0 x - pin 5

Reversed pins:
mks gen reversed

Wiring:
toms3d wiring

Pictures of my exact setup:
mks_gen_l
tmc2130_watterott

1.1.x configuration.h + configuration_adv.h:
Marlin-1.1x - 2130.zip

2.0.x-bugfix configuration.h + configuration_adv.h:
Marlin-bugfix-2.0.x - 2130.zip

@teemuatlut
Copy link
Member

teemuatlut commented Apr 6, 2018

You're using SW SPI with default pins but you've wired for HW SPI.
It also looks like you've wired the CS to D6 but you say you've configured D5.

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@teemuatlut
What's the difference between HW and SW SPI? What do I need to change for it to work using SW SPI? I'm still kinda new to this.

The picture doesn't line up with the text above, I just noticed. While testing, physical pins and firmware definitely lined up.

@teemuatlut
Copy link
Member

HW SPI: Much faster but collides with the RRD LCD.
SW SPI: Added to make it easier to use an LCD and the TMC drivers at the same time. But also quite a bit slower. Especially on AVR.

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@teemuatlut
As I don't use a LCD (OctoPrint), HW would probably work the best for me, then. How would I go about setting up HW SPI from where I am now?

@teemuatlut
Copy link
Member

teemuatlut commented Apr 6, 2018

Disable TMC_USE_SW_SPI.
Make the connections according to the table here. In the picture it looks like your MISO/MOSI lines are switched.

@LichtiMC
Copy link
Contributor

LichtiMC commented Apr 6, 2018

I think my short question quite well fits in here, because MrMbss1 will need this too:

Having wired my LCD SD-Card-Reader to the sw_spi Pins as it's using sw-spi by default -> Working fine!

Wired TMC2130 drivers to hw_spi. Now when compiling I get:

Marlin\src\HAL\HAL_DUE\../../inc/../HAL/HAL_DUE/SanityCheck_Due.h:33:6: error:
#error "DUE software SPI is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."

Do you know how to fix?

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@teemuatlut
Disabled TMC_USE_SW_SPI, and rewired according to the wiki.
MISO and MIOS were switched, as you said.

Still getting overheating error:
2088415b4d35575e5063f4cfab502c2f

physical setup:
30074688_10204427522243457_606873830_o

@LichtiMC
Copy link
Contributor

LichtiMC commented Apr 6, 2018

As long as Driver registers: show something like X = 0xFF:FF:FF:FF or X = 0x00:00:00:00 there is a wiring problem, as of my experience.

@kAdonis
Copy link
Contributor

kAdonis commented Apr 6, 2018

It looks like you wired X_CS to pin 6 not pin 5

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@kAdonis
X_CS Is definitely wired to pin D5, now. I changed the pin setup between pictures in the original post
30122840_10204427563604491_307814260_o

@LichtiMC
I'm currently double and triple checking the wiring, but I can't see anything wrong with it, so far..

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@LichtiMC @teemuatlut

Just double/triple checked cabling, and it's fine.

This is exactly how my jumpers look:
image

@kAdonis
Copy link
Contributor

kAdonis commented Apr 6, 2018

do you have 12V connected?

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@kAdonis
12V is connected. I turn on the PSU before plugging in the USB. LEDs on board turns on, when only connected to PSU

@LichtiMC
Copy link
Contributor

LichtiMC commented Apr 6, 2018

You could try using the standard cs pin D53.

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@LichtiMC
One step ahead of you. Currently reflashing firmware with that pin config

@ghost
Copy link
Author

ghost commented Apr 6, 2018

Finally got it working!
I cannot believe how silent these things are. God damn

Changing the pins to the config from the wiki, combined with the X_CS pin going on default(53), made it work. Using X_CS pin 4, 5, 6 og 11 did not work. I'm fearing for Z and E0, as they're going on 2 of those pins.
image

@ghost
Copy link
Author

ghost commented Apr 6, 2018

@teemuatlut
As suspected, Z and E0 is giving me trouble on pins D4 and D5
image

Are there any other pins I can try out?

@thinkyhead
Copy link
Member

Are there any other pins I can try out?

You can enable PINS_DEBUGGING and then M43 will show you a list of pins, including which are still unused.

@bofus10
Copy link

bofus10 commented Jun 21, 2018

I dont know if you solve it, but I just found out, trying and trying... that if you use pins 49 and 53, make sure to not have the SD CARD ON, since those pins are for SD Card support.

@MikeLud
Copy link
Contributor

MikeLud commented Jun 22, 2018

I have the same board and followed the wiring below and I am not having any issues with TMC2130's.

MKS_Gen-L_TMC2130_SPI_Sensor-less_Homing_Wiring_Diagram (1).pdf

@thinkyhead
Copy link
Member

thinkyhead commented Jun 22, 2018

@MikeLud — I assume with using the same CS line for X, Y, and Z means that they always get identical configurations — that basically whatever is set for Z ends up applying to all (since Z is the last one set).

@MikeLud
Copy link
Contributor

MikeLud commented Jun 22, 2018

@thinkyhead
No each TMC2130 has its own CS, I made the below changes as noted in the wiring diagran

  1. By default, Marlin uses pins D53 and D49 for X_CS and Y_CS. However, this conflicts with the control lines of the RepRap Discount LCD/SD Card Reader; therefore, pins D59 and D63 are remapped in the pins_RAMPS.h file to be X_CS and Y_CS respectively.

@thinkyhead
Copy link
Member

If that's a standard fix, we should apply that change in pins_MKS_GEN_L.h

  //
  // Heaters / Fans
  //
  // Power outputs EFBF or EFBE
  #define MOSFET_D_PIN 7

+ #ifndef X_CS_PIN
+   #define X_CS_PIN 59
+ #endif
+
+ #ifndef Y_CS_PIN
+   #define Y_CS_PIN 63
+ #endif

  #include "pins_RAMPS.h"

@MikeLud
Copy link
Contributor

MikeLud commented Jun 22, 2018

@thinkyhead

If you do add you might want to have in the comments the below wiring link

https://www.thingiverse.com/asset:66604

@DBa2016
Copy link

DBa2016 commented Aug 16, 2018

Is there any wiring diagram for MKS GEN 1.4 with TMC2130 (...with corresponding Marlin settings)?

@thinkyhead
Copy link
Member

Is there any wiring diagram for MKS GEN 1.4 with TMC2130

None that I know of. But you can use (virtually) any free digital pins as your CS lines for the Trinamic drivers. You can see which pins are unused by enabling PINS_DEBUGGING and issuing the M43 command.

@jprochazka
Copy link

@MikeLud
Copy link
Contributor

MikeLud commented Jan 22, 2019

In the diagram see note 3
3. For dual extruders, duplicate setup for E0 as E1, but connect E1_CS to D44 in AUX-2.

@jprochazka
Copy link

I feel stupid....
Thanks @MikeLud

@jonasuea
Copy link

Tenho a mesma placa e segui a fiação abaixo e não estou tendo problemas com o TMC2130.

MKS_Gen-L_TMC2130_SPI_Sensor-less_Homing_Wiring_Diagram (1) .pdf

I have a MKS GEN L 1.0 with TMC2130 drivers and I could never use it because I didn't know the configuration, but I will use this one, thank you very much!

@github-actions
Copy link

github-actions bot commented Jun 2, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants