Ramps 1.4 with TMC2209 Stallguard? October 07, 2020 10:39AM |
Admin Registered: 10 years ago Posts: 3,096 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 07, 2020 12:58PM |
Registered: 5 years ago Posts: 265 |
// For TMC drivers #define X_SERIAL_TX_PIN 21 #define X_SERIAL_RX_PIN 21 #define Y_SERIAL_TX_PIN 21 #define Y_SERIAL_RX_PIN 21 #define Z_SERIAL_TX_PIN 21 #define Z_SERIAL_RX_PIN 21 #define E0_SERIAL_TX_PIN 20 #define E0_SERIAL_RX_PIN 20 #define Z2_SERIAL_TX_PIN 20 #define Z2_SERIAL_RX_PIN 20and change the _SLAVE_ADDRESS values according to the addresses you selected for the drivers (the following is my configuration):
#define X_SLAVE_ADDRESS 0 #define Y_SLAVE_ADDRESS 1 #define Z_SLAVE_ADDRESS 2 #define X2_SLAVE_ADDRESS 0 #define Y2_SLAVE_ADDRESS 0 #define Z2_SLAVE_ADDRESS 1 #define Z3_SLAVE_ADDRESS 0 #define Z4_SLAVE_ADDRESS 0 #define E0_SLAVE_ADDRESS 0 #define E1_SLAVE_ADDRESS 0 #define E2_SLAVE_ADDRESS 0 #define E3_SLAVE_ADDRESS 0 #define E4_SLAVE_ADDRESS 0 #define E5_SLAVE_ADDRESS 0 #define E6_SLAVE_ADDRESS 0 #define E7_SLAVE_ADDRESS 0I don't use StallGuard since I always see people have problems with it so I can't help you with that part.
Re: Ramps 1.4 with TMC2209 Stallguard? October 07, 2020 02:04PM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
MMcLure
To control 2209s with UART on a RAMPS you can use one pin to control up to four drivers. You need to select a pin that is interrupt-capable, for example D21 or D20 on the I2C connector. You'll need to make a "hydra" cable with one input and multiple outputs. On my setup I have one pin controlling X, Y and Z, and another controlling E0 and Z2 (connected to the E1 driver).
The driver has a set of two pins on the short side and three pins on the long side protruding above the board. The UART pin is the first pin on the long side (the one closest to the EN pin, what would be MS3 on an A4988). Connect your wiring harness to that pin on each driver. Remove the MS3 jumpers on all drivers, and use MS1 and MS2 to set the address of the driver. No jumper on either MS1 or MS2 is address 0, MS1 jumpered and no jumper on MS2 is 1, MS2 jumpered and no jumper on MS1 is 2, and both jumpers is 3. Each driver on the same pin needs a unique address.
At the end of your Configuration_adv.h, set the TX and RX pins for your drivers. For example:
// For TMC drivers #define X_SERIAL_TX_PIN 21 #define X_SERIAL_RX_PIN 21 #define Y_SERIAL_TX_PIN 21 #define Y_SERIAL_RX_PIN 21 #define Z_SERIAL_TX_PIN 21 #define Z_SERIAL_RX_PIN 21 #define E0_SERIAL_TX_PIN 20 #define E0_SERIAL_RX_PIN 20 #define Z2_SERIAL_TX_PIN 20 #define Z2_SERIAL_RX_PIN 20and change the _SLAVE_ADDRESS values according to the addresses you selected for the drivers (the following is my configuration):
#define X_SLAVE_ADDRESS 0 #define Y_SLAVE_ADDRESS 1 #define Z_SLAVE_ADDRESS 2 #define X2_SLAVE_ADDRESS 0 #define Y2_SLAVE_ADDRESS 0 #define Z2_SLAVE_ADDRESS 1 #define Z3_SLAVE_ADDRESS 0 #define Z4_SLAVE_ADDRESS 0 #define E0_SLAVE_ADDRESS 0 #define E1_SLAVE_ADDRESS 0 #define E2_SLAVE_ADDRESS 0 #define E3_SLAVE_ADDRESS 0 #define E4_SLAVE_ADDRESS 0 #define E5_SLAVE_ADDRESS 0 #define E6_SLAVE_ADDRESS 0 #define E7_SLAVE_ADDRESS 0I don't use StallGuard since I always see people have problems with it so I can't help you with that part.
Re: Ramps 1.4 with TMC2209 Stallguard? October 07, 2020 04:49PM |
Registered: 5 years ago Posts: 265 |
#if HAS_TRINAMIC_CONFIGand set your micro steps (and current) there. That's also where you can set a different current for sensorless homing.
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 03:52AM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
MMcLure
The way slave addresses work is that all drivers connected to the same pin need to have different slave addresses, but drivers on different pins can share a slave address. The combination of pin and slave address needs to be unique for each driver.
So I can use the same slave address for Y and Z2 because they are on different pins (21 and 22). The default configuration has all drivers sharing address 0 and using different pins, but I like to take advantage of the address feature to free pins for other uses (more important when you're using Re-ARM instead of ATMega2650 since Re-ARM doesn't have all of the pins provided by the ATMega).
If you are using a UART connection to your 2209s then the jumpers are used to configure the slave address, and micro steps are set via Configuration_adv.h. Look for the code section that starts with
#if HAS_TRINAMIC_CONFIGand set your micro steps (and current) there. That's also where you can set a different current for sensorless homing.
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 10:47AM |
Admin Registered: 10 years ago Posts: 3,096 |
Driver registers: X 0x00:00:00:00 Bad response! Y 0x00:00:00:00 Bad response! Testing X connection... Error: All LOW Testing Y connection... Error: All LOW
#define X_SLAVE_ADDRESS 1 #define Y_SLAVE_ADDRESS 2 #define Z_SLAVE_ADDRESS 0 #define X2_SLAVE_ADDRESS 0 #define Y2_SLAVE_ADDRESS 0 #define Z2_SLAVE_ADDRESS 0 #define Z3_SLAVE_ADDRESS 0 #define Z4_SLAVE_ADDRESS 0 #define E0_SLAVE_ADDRESS 0 #define E1_SLAVE_ADDRESS 0 #define E2_SLAVE_ADDRESS 0 #define E3_SLAVE_ADDRESS 0 #define E4_SLAVE_ADDRESS 0 #define E5_SLAVE_ADDRESS 0 #define E6_SLAVE_ADDRESS 0 #define E7_SLAVE_ADDRESS 0 // For TMC drivers #define X_SERIAL_TX_PIN 21 #define X_SERIAL_RX_PIN 21 #define Y_SERIAL_TX_PIN 21 #define Y_SERIAL_RX_PIN 21
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 01:57PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 03:14PM |
Admin Registered: 10 years ago Posts: 3,096 |
PIN: 0 Port: E0 RXD0 protected PIN: 1 Port: E1 TXD0 protected PIN: 2 Port: E4 Input = 1 TIMER3B PWM: 0 WGM: 1 COM3B: 1 CS: 3 TCCR3A: 1 TCCR3B: 3 TIMSK3: 0 PIN: 3 Port: E5 X_MIN_PIN protected . X_STOP_PIN protected PIN: 4 Port: G5 FIL_RUNOUT_PIN Input = 1 TIMER0B PWM: 128 WGM: 3 COM0B: 3 CS: 3 TCCR0A: 3 TCCR0B: 3 TIMSK0: 5 compare interrupt enabled overflow interrupt enabled . SERVO3_PIN Input = 1 TIMER0B PWM: 128 WGM: 3 COM0B: 3 CS: 3 TCCR0A: 3 TCCR0B: 3 TIMSK0: 5 compare interrupt enabled overflow interrupt enabled PIN: 5 Port: E3 SERVO2_PIN Input = 1 TIMER3A PWM: 0 WGM: 1 COM3A: 1 CS: 3 TCCR3A: 1 TCCR3B: 3 TIMSK3: 0 PIN: 6 Port: H3 SERVO1_PIN Input = 1 TIMER4A PWM: 0 WGM: 1 COM4A: 1 CS: 3 TCCR4A: 1 TCCR4B: 3 TIMSK4: 0 PIN: 7 Port: H4 Input = 0 TIMER4B PWM: 0 WGM: 1 COM4B: 1 CS: 3 TCCR4A: 1 TCCR4B: 3 TIMSK4: 0 PIN: 8 Port: H5 HEATER_BED_PIN protected . RAMPS_D8_PIN protected PIN: 9 Port: H6 FAN_PIN protected . RAMPS_D9_PIN protected PIN: 10 Port: B4 HEATER_0_PIN protected . RAMPS_D10_PIN protected PIN: 11 Port: B5 SERVO0_PIN Input = 1 TIMER1A PWM: 2000 WGM: 4 COM1A: 0 CS: 2 TCCR1A: 0 TCCR1B: 10 TIMSK1: 2 non-standard PWM mode compare interrupt enabled PIN: 12 Port: B6 Input = 1 TIMER1B PWM: 0 WGM: 4 COM1B: 0 CS: 2 TCCR1A: 0 TCCR1B: 10 TIMSK1: 2 non-standard PWM mode PIN: 13 Port: B7 LED_PIN Input = 0 TIMER0A PWM: 0 WGM: 3 COM0A: 3 CS: 3 TCCR0A: 3 TCCR0B: 3 TIMSK0: 5 overflow interrupt enabled . TIMER1C is also tied to this pin TIMER1C PWM: 0 WGM: 4 COM1C: 0 CS: 2 TCCR1A: 0 TCCR1B: 10 TIMSK1: 2 non-standard PWM mode PIN: 14 Port: J1 Y_MIN_PIN protected . Y_STOP_PIN protected PIN: 15 Port: J0 Input = 1 PIN: 16 Port: H1 LCD_PINS_RS Output = 1 PIN: 17 Port: H0 LCD_PINS_ENABLE Output = 0 PIN: 18 Port: D3 Z_MIN_PIN protected . Z_STOP_PIN protected PIN: 19 Port: D2 Input = 0 PIN: 20 Port: D1 X_SERIAL_TX_PIN Input = 1 . X_SERIAL_RX_PIN Input = 1 . Y_SERIAL_TX_PIN Input = 1 . Y_SERIAL_RX_PIN Input = 1 PIN: 21 Port: D0 Input = 1 PIN: 22 Port: A0 Input = 0 PIN: 23 Port: A1 LCD_PINS_D4 Output = 0 PIN: 24 Port: A2 E0_ENABLE_PIN protected PIN: 25 Port: A3 LCD_PINS_D5 Output = 1 PIN: 26 Port: A4 E0_STEP_PIN protected PIN: 27 Port: A5 LCD_PINS_D6 Output = 0 PIN: 28 Port: A6 E0_DIR_PIN protected PIN: 29 Port: A7 LCD_PINS_D7 Output = 0 PIN: 30 Port: C7 E1_ENABLE_PIN Output = 1 PIN: 31 Port: C6 BTN_EN1 Input = 1 PIN: 32 Port: C5 Input = 0 PIN: 33 Port: C4 BTN_EN2 Input = 1 PIN: 34 Port: C3 E1_DIR_PIN Output = 0 PIN: 35 Port: C2 BTN_ENC Input = 1 PIN: 36 Port: C1 E1_STEP_PIN Input = 0 PIN: 37 Port: C0 BEEPER_PIN Output = 0 PIN: 38 Port: D7 X_ENABLE_PIN protected PIN: 39 Port: G2 Input = 0 PIN: 40 Port: G1 E_MUX0_PIN Input = 0 PIN: 41 Port: G0 KILL_PIN Input = 1 PIN: 42 Port: L7 E_MUX1_PIN Input = 0 . Z_SERIAL_TX_PIN Input = 0 PIN: 43 Port: L6 Input = 1 PIN: 44 Port: L5 E_MUX2_PIN Input = 0 TIMER5C PWM: 0 WGM: 1 COM5C: 0 CS: 3 TCCR5A: 1 TCCR5B: 3 TIMSK5: 0 . E1_CS_PIN Input = 0 TIMER5C PWM: 0 WGM: 1 COM5C: 0 CS: 3 TCCR5A: 1 TCCR5B: 3 TIMSK5: 0 . E0_SERIAL_TX_PIN Input = 0 PIN: 45 Port: L4 Input = 1 TIMER5B PWM: 0 WGM: 1 COM5B: 1 CS: 3 TCCR5A: 1 TCCR5B: 3 TIMSK5: 0 PIN: 46 Port: L3 Z_STEP_PIN protected PIN: 47 Port: L2 Input = 1 PIN: 48 Port: L1 Z_DIR_PIN protected PIN: 49 Port: L0 SD_DETECT_PIN Input = 0 PIN: 50 Port: B3 AVR_MISO_PIN Input = 0 . MISO_PIN Input = 0 PIN: 51 Port: B2 AVR_MOSI_PIN Output = 1 . MOSI_PIN Output = 1 PIN: 52 Port: B1 AVR_SCK_PIN Output = 0 . SCK_PIN Output = 0 PIN: 53 Port: B0 AVR_SS_PIN Output = 1 . SDSS Output = 1 . SS_PIN Output = 1 PIN: 54 Port: F0 (A 0) X_STEP_PIN protected PIN: 55 Port: F1 (A 1) X_DIR_PIN protected PIN: 56 Port: F2 (A 2) Y_ENABLE_PIN protected PIN: 57 Port: F3 (A 3) Analog in = 575 Input = 1 PIN: 58 Port: F4 (A 4) Analog in = 619 Input = 1 PIN: 59 Port: F5 (A 5) FILWIDTH_PIN Analog in = 607 PIN: 60 Port: F6 (A 6) Y_STEP_PIN protected PIN: 61 Port: F7 (A 7) Y_DIR_PIN protected PIN: 62 Port: K0 (A 8) Z_ENABLE_PIN protected PIN: 63 Port: K1 (A 9) Analog in = 664 Input = 1 PIN: 64 Port: K2 (A10) Analog in = 747 Input = 1 PIN: 65 Port: K3 (A11) Z_SERIAL_RX_PIN Input = 0 PIN: 66 Port: K4 (A12) MAX6675_SS_PIN Input = 0 . E0_SERIAL_RX_PIN Input = 0 PIN: 67 Port: K5 (A13) TEMP_0_PIN protected PIN: 68 Port: K6 (A14) TEMP_BED_PIN protected PIN: 69 Port: K7 (A15) TEMP_1_PIN Analog in = 1023
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 03:37PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 03:38PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 03:46PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 04:02PM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
MMcLure
Someone on the Discord mentioned that they saw ALL LOW if they had enabled SOFTWARE_DRIVER_ENABLE. I doubt that's the problem, but it's worth a check.
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 07:10PM |
Admin Registered: 12 years ago Posts: 6,859 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 08, 2020 07:35PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 04:14AM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
Dust
Issue is software serial and interrupts
the RX pins needs to be a change interrupt capable pin on the mega
"Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69)."
use one of these pins not 20 or 21
"You need to select a pin that is interrupt-capable, for example D21 or D20 on the I2C connector."
These are interrupt pins, but not change interrupts pins, which is what software serial uses.
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 04:26AM |
Admin Registered: 12 years ago Posts: 6,859 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 12:11PM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
Dust
tmc2209 and marlin supports this 1 wire mode, you just have to use one of the required RX pins above as your 1 wire on a mega2560
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 04:29PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 04:33PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 05:13PM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
MMcLure
To enable full output from M122 you need to enable TMC_DEBUG. by the way.
Re: Ramps 1.4 with TMC2209 Stallguard? October 09, 2020 06:38PM |
Registered: 5 years ago Posts: 265 |
Re: Ramps 1.4 with TMC2209 Stallguard? October 10, 2020 06:08AM |
Admin Registered: 10 years ago Posts: 3,096 |
Quote
MMcLure
M501? You mean M502, right? M501 just loads the values from EEPROM to RAM, M502 is the one that reads the default values from the compiled firmware.
Re: Ramps 1.4 with TMC2209 Stallguard? March 04, 2023 10:59PM |
Registered: 6 months ago Posts: 2 |
Re: Ramps 1.4 with TMC2209 Stallguard? May 07, 2023 07:11AM |
Registered: 4 years ago Posts: 3 |
Re: Ramps 1.4 with TMC2209 Stallguard? May 07, 2023 08:21AM |
Admin Registered: 12 years ago Posts: 6,859 |
Re: Ramps 1.4 with TMC2209 Stallguard? May 07, 2023 10:48AM |
Registered: 4 years ago Posts: 3 |
Re: Ramps 1.4 with TMC2209 Stallguard? May 07, 2023 12:58PM |
Registered: 4 years ago Posts: 3 |