Help with TMC2208 1.1.x Bugifx and Pins
July 07, 2019 01:41PM
Having a hard time getting the TMC2208 drivers to work with UART on Marlin 1.1.x Bugfix.

The registers come up with all 0's. I'm re-using the pins -
  #define X_SERIAL_TX_PIN    2  // was 40 Used by FAN_PIN
  #define X_SERIAL_RX_PIN    63
  #define Y_SERIAL_TX_PIN    15  //  was 59, now 15 (Y_MAX_PIN)
  #define Y_SERIAL_RX_PIN    59  // 64 Used by E0_AUTO_FAN_PIN
  #define Z_SERIAL_TX_PIN    20  // 42 Used by E0 CS Pin, not interrupt
  #define Z_SERIAL_RX_PIN    42  // 65 Used by E1_AUTO_FAN_PIN
  #define E0_SERIAL_TX_PIN   21  // 44 Used by E1_CS_PIN
  #define E0_SERIAL_RX_PIN   44  // 66 Used by FANMUX1_PIN
  #define E1_SERIAL_TX_PIN   50  // 58 not interrupt
  #define E1_SERIAL_RX_PIN   58

The pins used for TX must be interrupt capable.. How do I know which pins are interrupt capable? I found an old post somewhere with a list and used those pins listed above.
I am already using the default pins for other things.

I have
  • the latest TMC2208 library from Github.
  • Used the example sketches for the TMC2208, they work
  • Selected pins that are interrupt capable (needs confirmation)
  • Grabbed the latest version of 1.1.x bugfix Marlin from Github

Here is my M43 output
Send: M43
Recv: PIN:   0   Port: E0        RXD                         protected
Recv: PIN:   1   Port: E1        TXD                         protected
Recv: PIN:   2   Port: E4                    Input  = 0    TIMER3B   PWM:     0    WGM: 0    COM3B: 0    CS: 2    TCCR3A: 0    TCCR3B: 2    TIMSK3: 2   non-standard PWM mode
Recv: PIN:   3   Port: E5        X_MIN_PIN                   protected
Recv: PIN:   4   Port: G5        E0_AUTO_FAN_PIN             protected
Recv: .                          FIL_RUNOUT_PIN              protected
Recv: .                          SERVO3_PIN                  protected
Recv: PIN:   5   Port: E3        FAN1_PIN                    protected
Recv: .                          SERVO2_PIN                  protected
Recv: PIN:   6   Port: H3        FAN_PIN                     protected
Recv: .                          SERVO1_PIN                  protected
Recv: PIN:   7   Port: H4                    Input  = 0    TIMER4B   PWM:     0    WGM: 1    COM4B: 0    CS: 3    TCCR4A: 1    TCCR4B: 3    TIMSK4: 0
Recv: PIN:   8   Port: H5        HEATER_BED_PIN              protected
Recv: .                          RAMPS_D8_PIN                protected
Recv: PIN:   9   Port: H6        HEATER_1_PIN     ected
Recv: .                          RAMPS_D9_PIN                protected
Recv: PIN:  10   Port: B4        HEATER_0_PIN                protected
Recv: .                          RAMPS_D10_PIN               protected
Recv: PIN:  11   Port: B5        SERVO0_PIN                  Output = 1    TIMER1A   PWM:  2000    WGM: 4    COM1A: 0    CS: 2    TCCR1A: 0    TCCR1B: 10    TIMSK1: 2   non-standard PWM mode   compare interrupt enabled
Recv: PIN:  12   Port: B6        PS_ON_PIN                   protected
Recv: PIN:  13   Port: B7        LED_PIN                     Input  = 0    TIMER0A   PWM:     0    WGM: 3    COM0A: 0    CS: 3    TCCR0A: 3    TCCR0B: 3    TIMSK0: 5   overflow interrupt enabled
Recv:  .                  TIMER1C is also tied to this pin                  TIMER1C   PWM:     0    WGM: 4    COM1C: 0    CS: 2    TCCR1A: 0    TCCR1B: 10    TIM  non-standard PWM mode
Recv: PIN:  14   Port: J1        Y_MIN_PIN                   protected
Recv: PIN:  15   Port: J0                    Input  = 0
Recv: PIN:  16   Port: H1        LCD_PINS_RS                 Output = 0
Recv: PIN:  17   Port: H0        LCD_PINS_ENABLE             Output = 0
Recv: PIN:  18   Port: D3        Z_MIN_PIN                   protected
Recv: PIN:  19   Port: D2        Z_MIN_PROBE_PIN             protected
Recv: PIN:  20   Port: D1                    Input  = 1
Recv: PIN:  21   Port: D0                    Input  = 1
Recv: PIN:  22   Port: A0                    Input  = 0
Recv: PIN:  23   Port: A1        LCD_PINS_D4     Output = 1
Recv: PIN:  24   Port: A2        E0_ENABLE_PIN               protected
Recv: PIN:  25   Port: A3        LCD_PINS_D5                 Input  = 1
Recv: PIN:  26   Port: A4        E0_STEP_PIN                 protected
Recv: PIN:  27   Port: A5        LCD_PINS_D6                 Input  = 0
Recv: PIN:  28   Port: A6        E0_DIR_PIN                  protected
Recv: PIN:  29   Port: A7        LCD_PINS_D7                 Input  = 0
Recv: PIN:  30   Port: C7        E1_ENABLE_PIN               protected
Recv: PIN:  31   Port: C6        BTN_EN1                     Input  = 1
Recv: PIN:  32   Port: C5                    Input  = 0
Recv: PIN:  33   Port: C4        BTN_EN2                     Input  = 1
Recv: PIN:  34   Port: C3        E1_DIR_PIN                  protected
Recv: PIN:  35   Port: C2        BTN_ENC                     Input  = 1
Recv: PIN:  36   Port: C1        E1_STEP_PIN                 protected
Recv: PIN:  37   Port: C0        BEEPER_PIN            Output = 0
Recv: PIN:  38   Port: D7        X_ENABLE_PIN               protected
Recv: PIN:  39   Port: G2                    Input  = 0
Recv: PIN:  40   Port: G1        E_MUX0_PIN                  protected
Recv: .                          Z_CS_PIN                    protected
Recv: .                          X_SERIAL_TX_PIN             protected
Recv: PIN:  41   Port: G0        KILL_PIN                    Input  = 1
Recv: PIN:  42   Port: L7        E_MUX1_PIN                  protected
Recv: .                          E0_CS_PIN                   protected
Recv: .                          Z_SERIAL_TX_PIN             protected
Recv: PIN:  43   Port: L6        E1_AUTO_FAN_PIN             protected
Recv: PIN:  44   Port: L5        E_MUX2_PIN                  protected
Recv: .                          E1_CS_PIN                   protected
Recv: .                          E0_SERIAL_TX_PIN            protected
Recv: PIN:  45   Port: L4                    Input  = 0    TIMER5B   M:     0    WGM: 1    COM5B: 0    CS: 3    TCCR5A: 1    TCCR5B: 3    TIMSK5: 0
Recv: PIN:  46   Port: L3        Z_STEP_PIN                  protected
Recv: PIN:  47   Port: L2                    Input  = 0
Recv: PIN:  48   Port: L1        Z_DIR_PIN                   protected
Recv: PIN:  49   Port: L0        SD_DETECT_PIN               protected
Recv: .                          Y_CS_PIN                    protected
Recv: PIN:  50   Port: B3        AVR_MISOPIN                Input  = 0
Recv: .                          MISO_PIN                    Input  = 0
Recv: PIN:  51   Port: B2        AVR_MOSI_PIN                Output = 1
Recv: .                          MOSI_PIN                    Output = 1
Recv: PIN:  52   Port: B1        AVR_SCK_PIN                 Output = 0
Recv: .                          SCK_PIN                     Output = 0
Recv: PIN:  53   Port: B0        AVR_SS_PIN                  protected
Recv: .                          SDSS                        protected
Recv: .                          SS_PIN                      protected
Recv: .                          X_CS_PIN                    protected
Recv: PIN:  54   Port: F0 (A 0)  X_STEP_PIN                  protected
Recv: PIN:  55   Port: F1 (A 1)  X_DIR_PIN                   protected
Recv: PIN:  56   Port: F2 (A 2)  Y_ENABLE_PIN                protected
Recv: PIN:  57   Port: F3 (A 3)  E1_SERIAL_RX_PIN            Input  = 1
Recv: PIN:  58   Port: F4 (A 4)  E1_SERIAL_TX_PIN            Output =
Recv: PIN:  59   Port: F5 (A 5)  FILWIDTH_PIN                Analog in =  1023
Recv: .                          Y_SERIAL_TX_PIN             Output = 1
Recv: PIN:  60   Port: F6 (A 6)  Y_STEP_PIN                  protected
Recv: PIN:  61   Port: F7 (A 7)  Y_DIR_PIN                   protected
Recv: PIN:  62   Port: K0 (A 8)  Z_ENABLE_PIN                protected
Recv: PIN:  63   Port: K1 (A 9)  X_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  64   Port: K2 (A10)  Y_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  65   Port: K3 (A11)  Z_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  66   Port: K4 (A12)  MAX6675_SS                  Input  = 1
Recv: .                          E0_SERIAL_RX_PIN            Input  = 1
Recv: PIN:  67   Port: K5 (A13)  TEMP_0_PIN                  protected
Recv: PIN:  68   Port: K6 (A14)  TEMP_BED_PIN                protected
Recv: PIN:  69   Port: K7 (A15)  TEMP_1_PIN                  protected

How do I find/confirm which pins are interrupt capable?
Anyone know what I am doing wrong?
Re: Help with TMC2208 1.1.x Bugifx and Pins
July 09, 2019 10:30PM
Bump....
Re: Help with TMC2208 1.1.x Bugifx and Pins
July 09, 2019 11:14PM
no mention of what controller your using!

Ill presume a mega2560 based board

see [www.arduino.cc]

Mega2560 external interrupt pins 2, 3, 18, 19, 20, 21

There are also a bunch of pin change interrupts (these are usable for software serial)

ATMEGA2560 Pin Change Interrupts
  Pin     PORT PCINT 
  A8(62)   PK0  16
  A9(63)   PK1  17
 A10(64)   PK2  18
 A11(65)   PK3  19
 A12(66)   PK4  20
 A13(67)   PK5  21
 A14(68)   PK6  22
 A15(69)   PK7  23 
 10        PB4   4
 11        PB5   5
 12        PB6   6
 13        PB7   7
 14        PJ1  10
 15        PJ0   9
 0         PE0   8 - this one is a little odd. *
 SS(53)     PB0   0
 SCK(52)    PB1   1
 MOSI(51)   PB2   2
 MISO(50)   PB3   3

There are more if your not using ramps type system, the arduino mega2560 board doesn't break out all pins.

Information is from [www.arduino.cc]

Edited 7 time(s). Last edit at 07/10/2019 12:06AM by Dust.
Re: Help with TMC2208 1.1.x Bugifx and Pins
July 10, 2019 12:28PM
Thank you for the reply!

Ah I tried to get everything in the first post.
Yes, Mega2560 and RAMPS 1.6

I will edit the OP...Hmmm don't see a place to edit the OP.

Also, the pins I selected (some of them being unused MAX end stop pins) seems like they should work? Or are endstop pins not good for reassigning?

For the record, I DID get data in the TMC2208 registers in the M211 output when using the default pins (AUX 2 I think) but those pins are used for other things on my setup like E1 or Fan pins, so can't use those reliably.

Edited 1 time(s). Last edit at 07/10/2019 12:30PM by Eddiie.
Re: Help with TMC2208 1.1.x Bugifx and Pins
July 10, 2019 07:08PM
Some boards have external pull up resistors on the endstop pins...
Cant see any pullups on the circuit diagram [github.com]
Re: Help with TMC2208 1.1.x Bugifx and Pins
July 11, 2019 02:28AM
I moved things off AUX2 on to other pins and went back to using the default AUX2 pins for the UART on TMC2208 drivers..
M122 reports data in the registers most of the time but there are some times M122 shows them at all 0. Sometimes just a random one will show all 0's

Driver registers:	X = 0xC0:0C:00:00
	Y = 0xC0:0C:00:00
	Z = 0x00:00:00:00
	E0 = 0xC0:08:00:00
	E1 = 0xC0:08:00:00

Driver registers:	X = 0xC0:0C:00:00
	Y = 0xC0:0C:00:00
	Z = 0xC0:0C:00:00
	E0 = 0x00:00:00:00
	E1 = 0xC0:08:00:00


For E1, using pins 16 and 17. I get data but my Reprap Full Graphics Display goes blank so will have to use some other pins.
I move E1 UART to pins 57/58 but always get 0's back. These pins should work, the guy that wrote the instructable uses them, too - [www.instructables.com]

Any idea where I can stick these last TX/RX pins?

Determining the pins used by the Reprap full graphic display is not an easy thing to do. Thought pins 16/17 were open..

Could I use 39 and 41? looks like 39 may not be used, and pin 41 is the kill pin?

Current pins_RAMPS.h

#define X_SERIAL_TX_PIN    40
  #define X_SERIAL_RX_PIN    63
  #define Y_SERIAL_TX_PIN    59
  #define Y_SERIAL_RX_PIN    64  
  #define Z_SERIAL_TX_PIN    42  
  #define Z_SERIAL_RX_PIN    65
  #define E0_SERIAL_TX_PIN   44
  #define E0_SERIAL_RX_PIN   66
  #define E1_SERIAL_TX_PIN   16  // was 58
  #define E1_SERIAL_RX_PIN   17  // was 57
  #define E2_SERIAL_TX_PIN   -1
  #define E2_SERIAL_RX_PIN   -1
  #define E3_SERIAL_TX_PIN   -1
  #define E3_SERIAL_RX_PIN   -1
  #define E4_SERIAL_TX_PIN   -1
  #define E4_SERIAL_RX_PIN   -1



Here is my latest M43

Send: M43
Recv: PIN:   0   Port: E0        RXD                         protected
Recv: .                          E_MUX0_PIN                  protected
Recv: PIN:   1   Port: E1        TXD                         protected
Recv: PIN:   2   Port: E4                    Input  = 0    TIMER3B   PWM:     0    WGM: 0    COM3B: 0    CS: 2    TCCR3A: 0    TCCR3B: 2    TIMSK3: 2   non-standard PWM mode
Recv: PIN:   3   Port: E5        X_MIN_PIN                   protected
Recv: PIN:   4   Port: G5        FANN                     protected
Recv: PIN:   5   Port: E3        E0_AUTO_FAN_PIN             protected
Recv: PIN:   6   Port: H3        FAN1_PIN                    protected
Recv: PIN:   7   Port: H4                    Input  = 0    TIMER4B   PWM:     0    WGM: 1    COM4B: 0    CS: 3    TCCR4A: 1    TCCR4B: 3    TIMSK4: 0
Recv: PIN:   8   Port: H5        HEATER_BED_PIN              protected
Recv: .                          RAMPS_D8_PIN                protected
Recv: PIN:   9   Port: H6        HEATER_1_PIN                protected
Recv: .                          RAMPS_D9_PIN                protected
Recv: PIN:  10   Port: B4        HEATER_0_PIN                protected
Recv: .                          RAMPS_D10_PIN               protected
Recv: PIN:  11   Port: B5        SERVO0_PIN                  Output = 0    TIMER1A   PWM:  2000    WGM: 4    COM1A: 0    CS: 2    TCCR1A: 0    TCCR1B: 10    TIMSK1: 2   non-standard PWM mode   compare interrupt enabled
Recv: PIN:  12   Port: B6                    Input  = 0    TIMER1B   PWM:     0    WGM: 4    COM1B: 0    CS: 2    TCCR1A: 0    TCCR1B: 10    TIMSK1: 2   non-standard PWM mode
Recv: PIN:  13   Port: B7        LED_PIN                     Input  = 0    TIMER0A   PWM:     0    WGM: 3    COM0A: 0    CS: 3    TCCR0A: 3    TCCR0B: 3    TIMSK0: 5   overflow interrupt enabled
Recv:  .                  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
Recv: PIN:  14   Port: J1        Y_MIN_PIN                   protected
Recv: PIN:  15   Port: J0                    Input  = 0
Recv: PIN:  16   Port: H1        LCD_PINS_RS                 Output = 1
Recv: PIN:  17   Port: H0        LCD_PINS_ENABLE             Output = 1
Recv: PIN:  18   Port: D3        Z_MIN_PIN                   protected
Recv: PIN:  19   Port: D2        Z_MIN_PROBE_PIN             protected
Recv: PIN:  20   Port: D1                    Input  = 1
Recv: PIN:  21   Port: D0                    Input  = 1
Recv: PIN:  22   Port: A0                    Input  = 0
Recv: PIN:  23   Port: A1        LCD_PINS_D4                 Output = 1
Recv: PIN:  24   Port: A2        E0_ENABLE_PIN               protected
Recv: PIN:  25   Port: A3        LCD_PINS_D5                 Input  = 1
Recv: PIN:  26   Port: A4        E0_STEP_PIN                 protected
Recv: PIN:  27   Port: A5        LCD_PINS_D6                 Input  = 0
Recv: PIN:  28   Port: A6        E0_DIR_PIN                  protected
Recv: PIN:  29   Port: A7        LCD_PINS_D7                 Input  = 0
Recv: PIN:  30   Port: C7        E1_ENABLE_PIN               protected
Recv: PIN:  31   Port: C6        BTN_EN1                     Input  = 1
Recv: PIN:  32   Port: C5                    Input  = 0
Recv: PIN:  33   Port: C4        BTN_EN2                     Input  = 0
Recv: PIN:  34   Port: C3        E1_DIR_PIN                  protected
Recv: PIN:  35   Port: C2        BTN_ENC                     Input  = 1
Recv: PIN:  36   Port: C1        E1_STEP_PIN                 protected
Recv: PIN:  37   Port: C0        BEEPER_PIN                  Output = 0
Recv: PIN:  38   Port: D7        X_ENABLE_PIN                protected
Recv: PIN:  39   Port: G2                    Input  = 0
Recv: PIN:  40   Port: G1        Z_CS_PIN                    protected
Recv: .                          X_SERIAL_TX_PIN             protected
Recv: PIN:  41   Port: G0        KILL_PIN            Input  = 1
Recv: PIN:  42   Port: L7        E0_CS_PIN                   protected
Recv: .                          Z_SERIAL_TX_PIN             protected
Recv: PIN:  43   Port: L6        E1_AUTO_FAN_PIN             protected
Recv: PIN:  44   Port: L5        E1_CS_PIN                   protected
Recv: .                          E0_SERIAL_TX_PIN            protected
Recv: PIN:  45   Port: L4                    Input  = 0    TIMER5B   PWM:     0    WGM: 1    COM5B: 0    CS: 3    TCCR5A: 1    TCCR5B: 3    TIMSK5: 0
Recv: PIN:  46   Port: L3        Z_STEP_PIN                  protected
Recv: PIN:  47   Port: L2                    Input  = 0
Recv: PIN:  48   Port: L1        Z_DIR_PIN                   protected
Recv: PIN:  49   Port: L0       _DETECT_PIN               protected
Recv: .                          Y_CS_PIN                    protected
Recv: PIN:  50   Port: B3        AVR_MISO_PIN                Input  = 0
Recv: .                          MISO_PIN                    Input  = 0
Recv: PIN:  51   Port: B2        AVR_MOSI_PIN                Output = 1
Recv: .                          MOSI_PIN                    Output = 1
Recv: PIN:  52   Port: B1        AVR_SCK_PIN                 Output = 0
Recv: .                          SCK_PIN                     Output = 0
Recv: PIN:  53   Port: B0        AVR_SS_PIN                  protected
Recv: .                          SDSS                  protected
Recv: .                          SS_PIN                      protected
Recv: .                          X_CS_PIN                    protected
Recv: PIN:  54   Port: F0 (A 0)  X_STEP_PIN                  protected
Recv: PIN:  55   Port: F1 (A 1)  X_DIR_PIN                   protected
Recv: PIN:  56   Port: F2 (A 2)  Y_ENABLE_PIN                protected
Recv: PIN:  57   Port: F3 (A 3)     Analog in =   478   Input  = 0
Recv: PIN:  58   Port: F4 (A 4)     Analog in =   395   Input  = 0
Recv: PIN:  59   Port: F5 (A 5)  Y_SERIAL_TX_PIN             Output = 1
Recv: PIN:  60   Port: F6 (A 6)  Y_STEP_PIN                  protected
Recv: PIN:  61   Port: F7 (A 7)  Y_DIR_PIN                   protected
Recv: PIN:  62   Port: K0 (A 8)  Z_ENABLE_PIN                protected
Recv: PIN:  63   Port: K1 (A 9)  X_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  64   Port: K2 (A10)  Y_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  65   Port: K3 (A11)  Z_SERIAL_RX_PIN             Input  = 1
Recv: PIN:  66   Port: K4 (A12)  MAX6675_SS             Input  = 1
Recv: .                          E0_SERIAL_RX_PIN            Input  = 1
Recv: PIN:  67   Port: K5 (A13)  TEMP_0_PIN                  protected
Recv: PIN:  68   Port: K6 (A14)  TEMP_BED_PIN                protected
Recv: PIN:  69   Port: K7 (A15)  TEMP_1_PIN                  protected
Recv: ok

45 and 47 look ok??

Edited 2 time(s). Last edit at 07/11/2019 03:23AM by Eddiie.
Sorry, only registered users may post in this forum.

Click here to login