repetier / Repetier-Firmware

Firmware for Arduino based RepRap 3D printer.
815 stars 734 forks source link

TMC2130 on EXT1 (for Dual Z-Axis) will not compile #772

Open tekknix opened 6 years ago

tekknix commented 6 years ago

Hi,

i'm using RADDS on a original Arduino Due with 5 TMC2130 Steppers from Watterot (the original ones für 3,3-5v) connected on X,Y,Z, E1 and E0. E1 is for the Second Motor of my Z-Axis.

I'm not able to compile 1.01dev or 1.02 with Trinamic-Support.

CS-Pin's are assigned:

#define TMC2130_X_CS_PIN 27 
#define TMC2130_Y_CS_PIN 29 
#define TMC2130_Z_CS_PIN 31 
#define TMC2130_EXT0_CS_PIN 35 
#define TMC2130_EXT1_CS_PIN 33

Additional Z-Two-Stepper - Feature is also activated:

#define FEATURE_TWO_ZSTEPPER 1
#define Z2_STEP_PIN   ORIG_E1_STEP_PIN
#define Z2_DIR_PIN    ORIG_E1_DIR_PIN
#define Z2_ENABLE_PIN ORIG_E1_ENABLE_PIN

The main-Problem is inside printer.cpp cause there popups the errors due to missing declaration of EXT1_XXXX_Pins!

It's this declaration:

#if TMC2130_ON_EXT1 > 0
    Printer::tmc_driver_e1 = new TMC2130Stepper(EXT1_ENABLE_PIN, EXT1_DIR_PIN, EXT1_STEP_PIN, TMC2130_EXT1_CS_PIN);
    configTMC2130(Printer::tmc_driver_e1, TMC2130_STEALTHCHOP_EXT1, TMC2130_STALLGUARD_EXT1,
    TMC2130_PWM_AMPL_EXT1, TMC2130_PWM_GRAD_EXT1, TMC2130_PWM_AUTOSCALE_EXT1, TMC2130_PWM_FREQ_EXT1);
#endif

I'm not sure what's wrong. Cause this is the output:

sketch\Printer.cpp: In static member function 'static void Printer::setup()':

Printer.cpp:1162: error: 'EXT1_ENABLE_PIN' was not declared in this scope

     Printer::tmc_driver_e1 = new TMC2130Stepper(EXT1_ENABLE_PIN, EXT1_DIR_PIN, EXT1_STEP_PIN, TMC2130_EXT1_CS_PIN);

                                                 ^

Printer.cpp:1162: error: 'EXT1_DIR_PIN' was not declared in this scope

     Printer::tmc_driver_e1 = new TMC2130Stepper(EXT1_ENABLE_PIN, EXT1_DIR_PIN, EXT1_STEP_PIN, TMC2130_EXT1_CS_PIN);

                                                                  ^

Printer.cpp:1162: error: 'EXT1_STEP_PIN' was not declared in this scope

     Printer::tmc_driver_e1 = new TMC2130Stepper(EXT1_ENABLE_PIN, EXT1_DIR_PIN, EXT1_STEP_PIN, TMC2130_EXT1_CS_PIN);

                                                                                ^

exit status 1
'EXT1_ENABLE_PIN' was not declared in this scope

Can someone please bring up some light into it? The same Setup is running with MK4duo without any problems beneath the Fact that i do not like the implementation of GCodes inside MM4Duo. Marlin 2.x i'm not able to compile it anyway but that is a different story.

Some guess' will be welcome!

Cheers MoS-tekknix

tekknix commented 6 years ago

Okay, after writing it down, it falls down the steps.

Change this:

#if TMC2130_ON_EXT1 > 0
    Printer::tmc_driver_e1 = new TMC2130Stepper(EXT1_ENABLE_PIN, EXT1_DIR_PIN, EXT1_STEP_PIN, TMC2130_EXT1_CS_PIN);
    configTMC2130(Printer::tmc_driver_e1, TMC2130_STEALTHCHOP_EXT1, TMC2130_STALLGUARD_EXT1,
    TMC2130_PWM_AMPL_EXT1, TMC2130_PWM_GRAD_EXT1, TMC2130_PWM_AUTOSCALE_EXT1, TMC2130_PWM_FREQ_EXT1);
#endif

to this:

#if TMC2130_ON_EXT1 > 0
    Printer::tmc_driver_e1 = new TMC2130Stepper(Z2_ENABLE_PIN, Z2_DIR_PIN, Z2_STEP_PIN, TMC2130_EXT1_CS_PIN);
    configTMC2130(Printer::tmc_driver_e1, TMC2130_STEALTHCHOP_EXT1, TMC2130_STALLGUARD_EXT1,
    TMC2130_PWM_AMPL_EXT1, TMC2130_PWM_GRAD_EXT1, TMC2130_PWM_AUTOSCALE_EXT1, TMC2130_PWM_FREQ_EXT1);
#endif

makes the trick. It's correct cause before it will be defined as Z2 instead of EXT1 here:

#define FEATURE_TWO_ZSTEPPER 1
#define Z2_STEP_PIN   ORIG_E1_STEP_PIN
#define Z2_DIR_PIN    ORIG_E1_DIR_PIN
#define Z2_ENABLE_PIN ORIG_E1_ENABLE_PIN

Anyhow, this should not be done manually in the code it should be done correctly by the Configurator instead.

Therefore there are missing some declarations for "Two-Stepper" and that will be the same for "Three- and Four-Stepper" too.

Regards MoS-tekknix