Welcome! Log In Create A New Profile

Advanced

TMC2208 on MKS Gen L V1 with 1.1.9 Marlin

Posted by mlefevre 
TMC2208 on MKS Gen L V1 with 1.1.9 Marlin
July 06, 2019 09:25PM
I'm trying to build Marlin 1.1.9 for an MKS GEN L V1 board with at least one TMC2208 stepper driver and I'm confused about using software serial with ENDSTOP_INTERRUPTS_FEATURE. This code in SanityCheck.h:

/**
 * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
 */
#if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
       defined(X_HARDWARE_SERIAL ) \
    || defined(X2_HARDWARE_SERIAL) \
    || defined(Y_HARDWARE_SERIAL ) \
    || defined(Y2_HARDWARE_SERIAL) \
    || defined(Z_HARDWARE_SERIAL ) \
    || defined(Z2_HARDWARE_SERIAL) \
    || defined(E0_HARDWARE_SERIAL) \
    || defined(E1_HARDWARE_SERIAL) \
    || defined(E2_HARDWARE_SERIAL) \
    || defined(E3_HARDWARE_SERIAL) \
    || defined(E4_HARDWARE_SERIAL) )
  #error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE."
#endif


seems to suggest that they cannot be used together. So I either have to disable ENDSTOP_INTERRUPTS_FEATURE or select hardware serial. On the MKS Gen L, it appears that all hardware serial pins are committed to other functions so that doesn't look like an option. So, if I comment out the #define for ENDSTOP_INTERRUPTS_FEATURE, I get some odd compilation errors:

Compiling .pioenvs\megaatmega2560\src\ubl_motion.cpp.o
Marlin\stepper_indirection.cpp:293:130: error: no matching function for call to 'TMC2208Stepper::TMC2208Stepper(int, int, bool)'
   #define _TMC2208_DEFINE_SOFTWARE(ST) TMC2208Stepper stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, ST##_SERIAL_RX_PIN > -1)
                                                                                                                                  ^
Marlin\stepper_indirection.cpp:300:7: note: in expansion of macro '_TMC2208_DEFINE_SOFTWARE'
       _TMC2208_DEFINE_SOFTWARE(X);
       ^
In file included from Marlin\stepper_indirection.h:62:0,
                 from Marlin\stepper_indirection.cpp:34:
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:16:3: note: candidate: TMC2208Stepper::TMC2208Stepper(Stream*, bool)
Compiling .pioenvs\megaatmega2560\src\ultralcd.cpp.o
   TMC2208Stepper(Stream * serial, bool has_rx=true);
   ^
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:16:3: note:   candidate expects 2 arguments, 3 provided
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:13:7: note: candidate: constexpr TMC2208Stepper::TMC2208Stepper(const TMC2208Stepper&)
 class TMC2208Stepper {
       ^
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:13:7: note:   candidate expects 1 argument, 3 provided
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:13:7: note: candidate: constexpr TMC2208Stepper::TMC2208Stepper(TMC2208Stepper&&)
.piolibdeps\megaatmega2560\TMC2208Stepper\src/TMC2208Stepper.h:13:7: note:   candidate expects 1 argument, 3 provided
CMompiling .pioenvs\megaatmega2560\src\utility.cpp.o
arlin\stepper_indirection.cpp: In function 'void tmc2208_serial_begin()':
Marlin\stepper_indirection.cpp:379:18: error: 'class TMC2208Stepper' has no member named 'beginSerial'
         stepperX.beginSerial(115200);

Others have done this successfully (TeachingTech on YouTube for example) but did not run into this problem. I'm using VSCode and platformio to build Marlin. The platformio.ini looks like this:
[platformio]
src_dir      = Marlin
build_dir    = .pioenvs
lib_dir      = .piolib
libdeps_dir  = .piolibdeps
default_envs = megaatmega2560

My pertinent files are attached.
What am I doing wrong? Am I correct that I cannot enable ENDSTOP_INTERRUPTS_FEATURE and use software serial at the same time?
Attachments:
open | download - Configuration.h (69.9 KB)
open | download - Configuration_adv.h (67.4 KB)
open | download - pins_RAMPS.h (15.3 KB)
m3l
Re: TMC2208 on MKS Gen L V1 with 1.1.9 Marlin
August 20, 2019 03:08PM
platformio.ini contains a dependency for v0.1.1 of TMC2208 library. You have to remove it from there and replace it with TMC2208Stepper@0.2.5
Sorry, only registered users may post in this forum.

Click here to login