3

I am building a DIY 3D printer, and my hw requirements are X, Y1, Y2, Z, and E0 steppers. All of them are supposed to be A4988. One hotend heater, no heatbed (by now). My board is an Arduino Mega 2560, and I am trying to use the latest Marlin available (i.e. 2.1.2.2). The issue is that I can't get any movement on the Y2 motor. I have been crawling around, and what I think I should have is as follows:

in Configuration.h,

#define MOTHERBOARD BOARD_RAMPS_14_EFF 
#define EXTRUDERS 1
#define Y2_DRIVER_TYPE A4988    //uncommented

in Configuration_adv.h

//#define Y_DUAL_STEPPER_DRIVERS
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
  #define INVERT_Y2_VS_Y_DIR true   // Set 'true' if Y motors should rotate in opposite directions
  //#define Y_DUAL_ENDSTOPS
  #if ENABLED(Y_DUAL_ENDSTOPS)
    #define Y2_USE_ENDSTOP _YMAX_
    #define Y_DUAL_ENDSTOPS_ADJUSTMENT  0
  #endif
#endif

Note: the #define Y_DUAL_STEPPER_DRIVERS statement has to be left commented otherwise a compilation error is raised. This is the situation. Of course, I have tested the cables/motors, and all of them are working. Other posts on different blogs drove me to tweak the pins_RAMPS.h file, but I realized it was a waste of time. Can you give me a hint? Otherwise, I will be forced to build an add-on nanocard hosting a couple of twin A4988 drivers, but the room on the RAMPS shield is so little. And I don't dare to drive two motors with a single A4988, I never tried but I know that A4988 are difficult guys.

0scar
  • 37,708
  • 12
  • 68
  • 156
RCecinati
  • 31
  • 1

1 Answers1

2

I've reverted to version 2.1.2.2 to be compatible to the version used in the question. The analysis is based on this version.


Diving into the code

When looking into the (2.1.2.2) sources you'll see that there is no mention of Y_DUAL_STEPPER_DRIVERS other than in the Changes.h file.

enter image description here

Snippet:

...
#elif defined(Y_DUAL_STEPPER_DRIVERS)
  #error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
...

This file checks for compatibility of configuration settings against the current "to be compiled" version of Marlin based on your sources. On compilation you get the above mesage when using that Y_DUAL_STEPPER_DRIVERS define statement. The snippet from your question of your Configuration_adv.h is therefore incorrect, you are using a different config file (or you are using an older config file from a previous Marlin version) than should be used for this version of Marlin; hence you have to keep //#define Y_DUAL_STEPPER_DRIVERS in comments!

Getting to the issue!

Definition of an additional stepper in e.g. Y (this will be called Y2 from now on) is configured through the Configuration.h file:

Change by uncommenting this line

//#define Y2_DRIVER_TYPE A4988

to

#define Y2_DRIVER_TYPE A4988

This configuration setting will define that you have multiple (i.e. two) Y stepper motors on separate stepper drivers by setting HAS_Y2_STEPPER to 1 (equivalent to TRUE) in Conditionals_LCD.h:

#ifdef Y2_DRIVER_TYPE
#define HAS_Y2_STEPPER 1

This definition is very suspicious as HAS_Y2_STEPPER isn't used anywhere in the code... This is actually a bug in Marlin 2.1.2.2! This should have read:

#ifdef Y2_DRIVER_TYPE
#define HAS_DUAL_Y_STEPPERS 1

We continue, with this Marlin version to find the check for the existance of the definitin of the Y2 pins, from SanityCheck.h we read:

/**
 * Multiple Stepper Drivers Per Axis
 */
...
#if HAS_DUAL_Y_STEPPERS && !GOOD_AXIS_PINS(Y2)
  #error "If Y2_DRIVER_TYPE is defined, then Y2 ENABLE/STEP/DIR pins are also needed."
#endif
...

Since HAS_DUAL_Y_STEPPERS has never been set in the 2.1.2.2 sources, your build does not check if the pins for this Y2 stepper are defined in your pins_RAMPS.h file and hence does not compile.

How to get it compiled

Fix the 2.1.2.2 bugs as suggested above (replace HAS_Y2_STEPPER for HAS_DUAL_Y_STEPPERS in Conditionals_LCD.h) and set the Y2 stepper pins (see other solution below: using the latest bugfix branch). Do note that HAS_Y2_STEPPER is the constant name that is used throughout the latest version of Marlin. You'll see that this will compile fine:

enter image description here

Anoter solution, and the preferred one, is to go to the latest branch of Marlin, i.e. Bugfix 2.1.x (where these problems are fixed) and define the Y2 pins in the pins_RAMPS.h file:

Change:

#ifndef E1_STEP_PIN
  #define E1_STEP_PIN                         36
#endif
#ifndef E1_DIR_PIN
  #define E1_DIR_PIN                          34
#endif
#ifndef E1_ENABLE_PIN
  #define E1_ENABLE_PIN                       30
#endif
#ifndef E1_CS_PIN
  #define E1_CS_PIN                      AUX2_07
#endif

to

#ifndef Y2_STEP_PIN
  #define Y2_STEP_PIN                         36
#endif
#ifndef Y2_DIR_PIN
  #define Y2_DIR_PIN                          34
#endif
#ifndef Y2_ENABLE_PIN
  #define Y2_ENABLE_PIN                       30
#endif
#ifndef Y2_CS_PIN
  #define Y2_CS_PIN                      AUX2_07
#endif

Miscellaneous

Other posts on different blogs drove me to tweak the pins_RAMPS.h file, but I realized it was a waste of time.

No, this is not a waste of time, this is necessary as can be seen above. As you are changing the use of the board (standard: X, Y, Z, E0 and E1) to the dual Y solution (X, Y, Z, E0 and Y2) you need to assign the pins from the standard E1 to the Y2, this process cannot be skipped.

I will be forced to build an add-on nanocard hosting a couple of twin A4988 drivers, but the room on the RAMPS shield is so little.

No, this is not necessary.

0scar
  • 37,708
  • 12
  • 68
  • 156