V2 firmware endstop configuration

edited June 16 in Motor Control
I'm trying to con figure the x and y hardware end stops in V2 firmware. Z is BLtouch. These are my current settings in configuration.h v1.0.3:
// ################ Endstop configuration #####################

#define MULTI_ZENDSTOP_HOMING 0
#define ENDSTOP_PULLUP_X_MIN true
#define ENDSTOP_X_MIN_INVERTING true
#define MIN_HARDWARE_ENDSTOP_X true
#define ENDSTOP_PULLUP_Y_MIN true
#define ENDSTOP_Y_MIN_INVERTING true
#define MIN_HARDWARE_ENDSTOP_Y true
#define ENDSTOP_PULLUP_Z_MIN true
#define ENDSTOP_Z_MIN_INVERTING false
#define MIN_HARDWARE_ENDSTOP_Z true
#define ENDSTOP_PULLUP_Z2_MINMAX true
#define ENDSTOP_Z2_MINMAX_INVERTING false
#define MINMAX_HARDWARE_ENDSTOP_Z2 false
#define ENDSTOP_PULLUP_X_MAX true
#define ENDSTOP_X_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_X false
#define ENDSTOP_PULLUP_Y_MAX true
#define ENDSTOP_Y_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_Y false
#define ENDSTOP_PULLUP_Z_MAX true
#define ENDSTOP_Z_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_Z false
#define ENDSTOP_PULLUP_X2_MIN true
#define ENDSTOP_PULLUP_Y2_MIN true
#define ENDSTOP_PULLUP_Z2_MINMAX true
#define ENDSTOP_PULLUP_X2_MAX true
#define ENDSTOP_PULLUP_Y2_MAX true
#define ENDSTOP_X2_MIN_INVERTING false
#define ENDSTOP_Y2_MIN_INVERTING false
#define ENDSTOP_X2_MAX_INVERTING false
#define ENDSTOP_Y2_MAX_INVERTING false
#define MIN_HARDWARE_ENDSTOP_X2 false
#define MIN_HARDWARE_ENDSTOP_Y2 false
#define MAX_HARDWARE_ENDSTOP_X2 false
#define MAX_HARDWARE_ENDSTOP_Y2 false
#define X2_MIN_PIN -1
#define X2_MAX_PIN -1
#define Y2_MIN_PIN -1
#define Y2_MAX_PIN -1
#define Z2_MINMAX_PIN -1



#define max_software_endstop_r true

#define min_software_endstop_x false
#define min_software_endstop_y false
#define min_software_endstop_z false
#define max_software_endstop_x true
#define max_software_endstop_y true
#define max_software_endstop_z true
#define DOOR_PIN -1
#define DOOR_PULLUP 1
#define DOOR_INVERTING 1
#define ENDSTOP_X_BACK_MOVE 5
#define ENDSTOP_Y_BACK_MOVE 5
#define ENDSTOP_Z_BACK_MOVE 2
#define ENDSTOP_X_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_Y_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_Z_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_X_BACK_ON_HOME 1
#define ENDSTOP_Y_BACK_ON_HOME 1
#define ENDSTOP_Z_BACK_ON_HOME 0
#define ALWAYS_CHECK_ENDSTOPS 1
#define MOVE_X_WHEN_HOMED 0
#define MOVE_Y_WHEN_HOMED 0
#define MOVE_Z_WHEN_HOMED 0

there doesn't seem to be any configuration in V2 in configuration.h but in configuration_io.h there are these settings:
// Define our endstops solutions
// You need to define all min and max endstops for all
// axes except E even if you have none!

ENDSTOP_SWITCH_HW(endstopMotorXMax, IOEndstopXMax, -1, true)
ENDSTOP_SWITCH_HW(endstopMotorYMax, IOEndstopYMax, -1, true)
ENDSTOP_SWITCH_HW(endstopMotorZMax, IOEndstopZMax, -1, true)
ENDSTOP_NONE(endstopXMin)
ENDSTOP_NONE(endstopYMin)
ENDSTOP_NONE(endstopZMin)
ENDSTOP_NONE(endstopXMax)
ENDSTOP_NONE(endstopYMax)
ENDSTOP_MERGE3(endstopZMax, endstopMotorXMax, endstopMotorYMax, endstopMotorZMax, Z_AXIS, true)
ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

// Servo for z-probe
IO_OUTPUT(Servo1Pin, 4)
SERVO_ANALOG(ZProbeServo, 0, Servo1Pin, 500, 2500, 1473)
// Set to nullptr for no zprobe or &endstopName for a switch
#undef ZPROBE_ADDRESS
#define ZPROBE_ADDRESS &endstopZProbe

These settings do not seem to register when the end stop is triggered. I'm not sure how to edit these settings to get the desired results. The end stops are normally open wired to xmin, ymin, zmin pins. zmax pin is for filament runout sensor. Would I change the lines to:
ENDSTOP_SWITCH_HW(endstopMotorXMin, IOEndstopXMin, -1, true) 
ENDSTOP_SWITCH_HW(endstopMotorYMin, IOEndstopYMin, -1, true) 
ENDSTOP_SWITCH_HW(endstopMotorZMin, IOEndstopZMin, -1, true) 
ENDSTOP_NONE(endstopXMin)
ENDSTOP_NONE(endstopYMin)
ENDSTOP_NONE(endstopZMin)
ENDSTOP_NONE(endstopXMax) 
ENDSTOP_NONE(endstopyMax) 
// ENDSTOP_MERGE3(endstopZMax, endstopMotorXMax, endstopMotorYMax, endstopMotorZMax, Z_AXIS, true)
ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, true)

// Servo for z-probe
IO_OUTPUT(Servo1Pin, 4)
SERVO_ANALOG(ZProbeServo, 0, Servo1Pin, 500, 2500, 1473)
// Set to nullptr for no zprobe or &endstopName for a switch
#undef ZPROBE_ADDRESS
#define ZPROBE_ADDRESS &endstopZProbe

This is on a MKS Rumba32 board, single xyz drives, single nozzle, dual extruder, BLtouch, cartesian printer.


«1

Comments

  • Oh and this too...The end stops are normally open, wired to xmin, ymin, BLTouch to zmin. zmax pin is for filament runout sensor.

    // Define your endstops inputs

    IO_INPUT_INVERTED(IOEndstopXMax, ORIG_X_MAX_PIN) > IO_INPUT_INVERTED(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED(IOEndstopYMax, ORIG_Y_MAX_PIN) > IO_INPUT_INVERTED(IOEndstopYMin, ORIG_Y_MIN_PIN) 
    IO_INPUT_INVERTED(IOEndstopZMax, ORIG_Z_MAX_PIN) > IO_INPUT(IOEndstopZMin, ORIG_Z_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN) > IO_INPUT_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN) > IO_INPUT_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN) 
  • For my bltouch I used:
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)
    ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

    For mechanical end stops you should always enable pullup like
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)

    Switch inverted if signal is wrong oriented.
    IO_INPUT_INVERTED_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)
    ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
    ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
    ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
    ENDSTOP_NONE(endstopZMax)
    ENDSTOP_NONE(endstopXMax)
    ENDSTOP_NONE(endstopYMax)

    would make more sense on a cartesian printer. Your example was from a delta which requires a different logic.
  • edited June 17
    I must be doing something wrong, I'm new to this. I edited the configuration_io.h file to this 
    // Define your endstops inputs

    // IO_INPUT_INVERTED(IOEndstopXMax, ORIG_X_MAX_PIN)
    // IO_INPUT_INVERTED(IOEndstopYMax, ORIG_Y_MAX_PIN)
    // IO_INPUT_INVERTED(IOEndstopZMax, ORIG_Z_MAX_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)
    ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

    // Define our endstops solutions
    // You need to define all min and max endstops for all
    // axes except E even if you have none!

    ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
    ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
    ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
    // ENDSTOP_NONE(endstopXMin)
    // ENDSTOP_NONE(endstopYMin)
    // ENDSTOP_NONE(endstopZMin)
    ENDSTOP_NONE(endstopZMax)
    ENDSTOP_NONE(endstopXMax)
    ENDSTOP_NONE(endstopYMax)
    // ENDSTOP_MERGE3(endstopZMax, endstopMotorXMax, endstopMotorYMax, endstopMotorZMax, Z_AXIS, true)
    // ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

    and the compile failed:

    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/PrinterTypes/PrinterTypeCartesian.cpp:19:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/PrinterTypes/Printer.cpp:19:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    *** [.pio/build/RUMBA32/src/PrinterTypes/PrinterTypeDelta.cpp.o] Error 1
    *** [.pio/build/RUMBA32/src/PrinterTypes/Printer.cpp.o] Error 1
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/PrinterTypes/PrinterTypeCoreXYZ.cpp:19:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    *** [.pio/build/RUMBA32/src/PrinterTypes/PrinterTypeCoreXYZ.cpp.o] Error 1
    *** [.pio/build/RUMBA32/src/PrinterTypes/PrinterTypeCartesian.cpp.o] Error 1
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/Configuration.cpp:29:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    *** [.pio/build/RUMBA32/src/Configuration.cpp.o] Error 1
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/SdFat/FatLib/FatFile.cpp:25:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/PrinterTypes/PrinterTypeDualXAxis.cpp:36:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    *** [.pio/build/RUMBA32/src/PrinterTypes/PrinterTypeDualXAxis.cpp.o] Error 1
    *** [.pio/build/RUMBA32/src/SdFat/FatLib/FatFile.cpp.o] Error 1
    In file included from src/io/redefine.h:69,
                     from src/Configuration.h:189,
                     from src/Repetier.h:208,
                     from src/SdFat/FatLib/FatFileLFN.cpp:25:
    src/Configuration_io.h:96:61: error: stray '\302' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:96:62: error: stray '\240' in program
       96 | ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:97:61: error: stray '\302' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                             ^
    src/Configuration_io.h:97:62: error: stray '\240' in program
       97 | ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false) 
          |                                                              ^
    src/Configuration_io.h:98:61: error: stray '\302' in program
       98 | ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false) 
          |                                                             ^
    compilation terminated due to -fmax-errors=5.
    *** [.pio/build/RUMBA32/src/SdFat/FatLib/FatFileLFN.cpp.o] Error 1
  • error: stray '\302' in program 
    is a problem with text encoding. Are you using visual studio code with utf-8 encoding?
    The problem is that some spaces normally at start/end got copied with different encoding so it is now wrong encoded. Try to delete all spaces at start and and and see if the errors reduce. Googling the error message also gives you many hints on this special problem.
  • edited June 18
    this compiles with no errors, I haven't had the chance to upload it to the printer. Will endstops actually work if all axes min and max are defined as ENDSTOP_NONE?
    // Define your endstops are defined as 

    // IO_INPUT_INVERTED(IOEndstopXMax, ORIG_X_MAX_PIN)
    // IO_INPUT_INVERTED(IOEndstopYMax, ORIG_Y_MAX_PIN)
    // IO_INPUT_INVERTED(IOEndstopZMax, ORIG_Z_MAX_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)

    // Define our endstops solutions
    // You need to define all min and max endstops for all
    // axes except E even if you have none!

    ENDSTOP_SWITCH_HW(endstopMotorXMin, IOEndstopXMin, X_AXIS, false)
    ENDSTOP_SWITCH_HW(endstopMotorYMin, IOEndstopYMin, Y_AXIS, false)
    //ENDSTOP_SWITCH_HW(endstopMotorZMin, IOEndstopZMin, Z_AXIS, false)
    ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)
    ENDSTOP_NONE(endstopXMin)
    ENDSTOP_NONE(endstopYMin)
    ENDSTOP_NONE(endstopZMin)
    ENDSTOP_NONE(endstopXMax)
    ENDSTOP_NONE(endstopYMax)
    ENDSTOP_NONE(endstopZMax)
    // ENDSTOP_MERGE3(endstopZMax, endstopMotorXMax, endstopMotorYMax, endstopMotorZMax, Z_AXIS, true)

  • > Will endstops actually work if all axes min and max are defined as ENDSTOP_NONE?
    No. 

    You have no motor endstops so you must replace endstopMotorXMin by endstopXMin and also remove the matching ENDSTOP_NONE and remove the motor endstops from the motor drivers.
  • edited June 18
    this compiles now:
    IO_INPUT_INVERTED_PULLUP(IOEndstopXMin, ORIG_X_MIN_PIN)
    IO_INPUT_INVERTED_PULLUP(IOEndstopYMin, ORIG_Y_MIN_PIN)
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)

    ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false)
    ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false)
    ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

    ENDSTOP_NONE(endstopZMin)
    ENDSTOP_NONE(endstopXMax)
    ENDSTOP_NONE(endstopYMax)
    ENDSTOP_NONE(endstopZMax)

    but the Z axis does not move when homing, just makes a lot of noise.

    STEPPER_TMC5160_SW_SPI(ZMotor, IOZ1Step, IOZ1Dir, IOZ1Enable, MOSI_PIN, MISO_PIN, SCK_PIN, ORIG_Z_CS_PIN, 0.11, 1, 64, 900, true, 100, 0, 12500000, endstopNone, endstopNone)

    IO_OUTPUT(IOZ1Step, ORIG_Z_STEP_PIN)
    IO_OUTPUT(IOZ1Dir, ORIG_Z_DIR_PIN) > this setting z does not move
    IO_OUTPUT_INVERTED(IOZ1Dir, ORIG_Z_DIR_PIN) >moves in wrong direction
    IO_OUTPUT_INVERTED(IOZ1Enable, ORIG_Z_ENABLE_PIN)
  • I forgot to mention the BLTouch does not deploy it's probe. It's a clone BLTouch. 
  • another question I have 2 filament detectors that I would like to get set up. Here is the line of code I would like to add to configuration_io.h
    FILAMENT_DETECTOR(FilamentDetector, ORIG_Z_MAX_PIN, ToolExtruder1) where is/where do I define FilamentDetector?
  • For zprobe did you also define servo correctly? See delta/Deltatower RUMBA32 for example on how to configure the z probe bltouch/3dtouch correctly. Just adjust pins.

    Filament detector is added at the end. See Cartesian/Felix Pro 1 as example which also has two detectors. But these are for rotary encoder so adjust to switch variant accordingly.
  • Z axis is moving too fast if you hear it loosing steps. Reduce acceleration to 100 and max speed to 5. Then see if it works and increase if you want to see where your limit is.
  • Thank you!
    My BLTouch code is identical to the Deltatower RUMBA32 example with some changes to offsets and so on in configuratio.h and configuratio_io.h. My hardware setup is the servo goes to cpu pin PD15 defined as PWM2_PIN in rumba32.h. The signal pins go to ORIG_Z_MIN_PIN. I don't see any references to Servo1Pin other than in the code block following // Servo for z-probe in configuration_io.h. How do I tell what pin Servo1Pin is referencing?

    For the Filament sensors I did grab the code from the Cartesian/Felix Pro 1 example and changed the pin assignment. I have 2 filament sensors, 1 for each extruder, both detectors are wired to ORIG_Z_MAX_PIN. My question still stands, where do I define FilamentDetector1 from the Cartesian/Felix Pro 1 example? If I use the code as is the compile fails, this from vscode:
     FilamentDetector<<error-type>> FilamentDetector1
    and this compilation error:
    src/io/io_tools.h:52:37: error: type/value mismatch at argument 1 in template parameter list for 'template<class inputPin> class FilamentDetector'
       52 |     extern FilamentDetector<inputPin> name;
          |                                     ^
    src/Configuration_io.h:179:1: note: in expansion of macro 'FILAMENT_DETECTOR'
      179 | FILAMENT_DETECTOR(FilamentDetector1, ORIG_Z_MAX_PIN, ToolExtruder1)
          | ^~~~~~~~~~~~~~~~~
    src/io/io_tools.h:52:37: note:   expected a type, got '58'
       52 |     extern FilamentDetector<inputPin> name;
          |                                     ^
    src/Configuration_io.h:179:1: note: in expansion of macro 'FILAMENT_DETECTOR'
      179 | FILAMENT_DETECTOR(FilamentDetector1, ORIG_Z_MAX_PIN, ToolExtruder1)
  • I lowered the speed and acceleration of the Z axis, now it makes a much higher pitched whine.
    #define MAX_ACCELERATION_UNITS_PER_SQ_SECOND_X 1000
    #define MAX_ACCELERATION_UNITS_PER_SQ_SECOND_Y 1000
    #define MAX_ACCELERATION_UNITS_PER_SQ_SECOND_Z 100
    #define XAXIS_STEPS_PER_MM 80.46
    #define YAXIS_STEPS_PER_MM 80.12
    #define ZAXIS_STEPS_PER_MM 3194.75
    #define MAX_FEEDRATE_X 200
    #define MAX_FEEDRATE_Y 200
    #define MAX_FEEDRATE_Z 5

    STEPPER_TMC5160_SW_SPI(ZMotor, IOZ1Step, IOZ1Dir, IOZ1Enable, MOSI_PIN, MISO_PIN, SCK_PIN, ORIG_Z_CS_PIN, 0.075, 1, 32, 900, true, 100, 8, 12500000, endstopNone, endstopNone)
  • Sure z axis has #define ZAXIS_STEPS_PER_MM 3194.75 steps per mm? With 2mm/rotation pitch 3200 would be normal but if microsteps did not get set it would be way off. Try with lower speed as well and check values in eeprom if they are the same.

    For serve there are 2 places in Configuration.h you need to change as well
    #define NUM_SERVOS 1

    and

    #define SERVO_LIST \
    { &ZProbeServo }

    should help here telling you have a servo. Docs miss that part:-(

    For filament detector:
    FILAMENT_DETECTOR(FilamentDetector1, ORIG_Z_MAX_PIN, ToolExtruder1)

    ORIG_Z_MAX_PIN is wrong. You need a IO_INPUT... class that defines Z_MAX_PIn as input here!
  • edited June 20
    Microsteps are set to 32, ZAXIS_STEPS_PER_MM 3194.75 This is from repetier 1.0.3, mks Rumba, DRV8825, microsteps 32. This also works with Marlin 2 with the current MKS Rumba32/5160 setup.

    These are already in configuation.h
    #define NUM_SERVOS 1
    #define SERVO_LIST \
    { &ZProbeServo }

    For filament detector I would need to define Z_MAX_PIn in io_input.h? 
    #ifndef IO_INPUT
    #define IO_INPUT(name, pin)
    Can you give me an example? Would this work:
    #define IO_INPUT(FilamentDetector1, ORIG_Z_MAX_PIN)
    #define IO_INPUT(FilamentDetector2, ORIG_Z_MAX_PIN)

    I won't be able to test until tomorrow but Thank You again!
  • #define IO_INPUT_PULLUP(IOFilamentDetector1, ORIG_Z_MAX_PIN)
    FILAMENT_DETECTOR(FilamentDetector1, IOFilamentDetector1, ToolExtruder1)

    If signal is wrong way around use IO_INPUT_INVERTED_PULLUP

  • edited June 21
    I'm not sure where I should add the definition,  io_input.h?
    #ifndef IO_INPUT_PULLUP
    #define IO_INPUT_PULLUP(name, pin) > #define IO_INPUT_PULLUP(IOFilamentDetector1, ORIG_Z_MAX_PIN) ?

    this goes to configuration_io.h
    FILAMENT_DETECTOR(FilamentDetector1, IOFilamentDetector1, ToolExtruder1)
  • oops. Define is of course wrong:
    IO_INPUT_PULLUP(IOFilamentDetector1, ORIG_Z_MAX_PIN)
    FILAMENT_DETECTOR(FilamentDetector1, IOFilamentDetector1, ToolExtruder1)

    is correct. All goes in contiguration_io.h
    You only change configuration.h and configuration_io.h anything else means you are programming the firmware to do something it can not do normally.
  • Thank you for the explanation. The code compiled with no errors. I will test this evening. 

  • edited June 22
    I changed the BLTouch clone to real BLTouch, changed IO_OUTPUT(Servo1Pin, 4) to IO_OUTPUT(Servo1Pin, PWM2_PIN) because PWM2_PIN is what BLTouch servo is wired to.
    Z axis now moves. There are some strange things happening with the probe, if I run M119 with all the enstops triggered and the zprobe retracted and this set: IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN) I get this 
    Send: N18 M119*19
    Recv: ok 18 
    Recv: endstops hit: x_min:H y_min:H Z-probe state:L
    when I think it should be Z-probe state:H
    but the Zaxis homes and crashes into the nozzle...the zprobe never deploys.

    if I invert the pullup on the zprobe:
    IO_INPUT_INVERTED_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)
    Send: N18 M119*19
    Recv: ok 18 
    Recv: endstops hit: x_min:H y_min:H Z-probe state:H 
    this is what I expected however the zaxis does not move and the zprobe does not deploy.
    After further examination inverting the pullup only changes the state from low to high regardless of whether the probe is stowed or not.

    This is getting closer to being functional but still stuck on getting the BLTouch to respond. The BLTouch does cycle through its' startup routine every time I turn on the printer, the BLTouch drops the probe 2x and stows but then never responds to any commands after that. No response to M340 P0 S500, M340 P0 S600. Maybe those commands aren't valid in this firmware. What commands deploy and stow the probe in this firmware so I can test?

    this is the code I've got for the BLTouch
    configuration_io.h:
    IO_INPUT_PULLUP(IOEndstopZProbe, ORIG_Z_MIN_PIN)
    ENDSTOP_SWITCH_HW(endstopZProbe, IOEndstopZProbe, ZPROBE_AXIS, false)

    // Servo for z-probe
    IO_OUTPUT(Servo1Pin, PWM2_PIN)
    SERVO_ANALOG(ZProbeServo, 0, Servo1Pin, 500, 2500, 1473)
    // Set to nullptr for no zprobe or &endstopName for a switch
    #undef ZPROBE_ADDRESS
    #define ZPROBE_ADDRESS &endstopZProbe

    Configuration.h:
    #define Z_PROBE_TYPE Z_PROBE_TYPE_BLTOUCH
    #define Z_PROBE_HEIGHT 3 // Distance bed-nozzle when trigger switches
    #define Z_PROBE_BED_DISTANCE 10 // Optimal starting distance
    #define Z_PROBE_SPEED 5 // Speed fo z testing
    #define Z_PROBE_X_OFFSET -28 // x offset relative to extruder 0,0 offset
    #define Z_PROBE_Y_OFFSET -6 // y offset relative to extruder 0,0 offset
    #define Z_PROBE_COATING 0 // Coating thickness if not detected by probe
    #define Z_PROBE_DELAY 0 // Extra delay before starting again. Only needed on electronic probes keeping state for a while
    #define Z_PROBE_REPETITIONS 2 // How often should we probe, 1 is minimum
    #define Z_PROBE_USE_MEDIAN 1 // 0 = use average, 1 = use middle value after ordering z
    #define Z_PROBE_SWITCHING_DISTANCE 2 // Minimum distance required to safely untrigger probe - used for faster repeated measurement
    #define Z_PROBE_BORDER 2 // Safety border to ensure position is allowed
    #define Z_PROBE_START_SCRIPT ""
    #define Z_PROBE_FINISHED_SCRIPT ""
    #define Z_PROBE_RUN_AFTER_EVERY_PROBE ""
    // Define ZProbe by referencing a endstop defined
    CONFIG_VARIABLE_EQ(EndstopDriver, *ZProbe, ZPROBE_ADDRESS)

  • PWM2_PIN is no pin number so hope you have defined it correctly before. But that might explain why it does not deploy. You can test deploy with M340 Sxxx and send deploy (S647)/undeploy  (S1473)timing.  See https://www.antclabs.com/bltouch-v3
    The self test always happens when probe gets powered. That way you know it would work if it gets the signal.
    M119 is not useful with bltouch/3dtouch. The high signal only last 10-100ms so it is normally low. Only in error state it is constantly high.
  • src > boards > stm32f4 > boards > rumba32.h #define PWM2_PIN PD15 // TIM4_CH4 This is the pin on the board that the BLTouch servo is wired to. What would be/determine the pin number for this pin?
  • Ok, that looks correct from the picture. Does the pin move with M340 run manually? Can you test if the pin gets signals? Also if it does not work test with the pin I used in delta rumba32 example. There I know it worked. 

    Are you using hwardware pwm for some pins? It is important not to use a pin with interrupt in use internally like servo timer. Looking into the docs I saw there is no list in hardware pwm telling which ones are allowed. Need to correct that.
  • the bltouch does not respond to any m340 commands. In the rumba32 delta example
    IO_OUTPUT(Servo1Pin, 4)
    you reference pin number 4, where is that set or defined? 
  • Repetier said:
     Looking into the docs 
    What docs are you referring to? https://docfirmwarev2.repetier.com/?
  • its defined in variants.h

    #define PA3   3  //D3
    #define PA4   4  //D4
    #define PA5   5  //D5
    #define PA6   6  //D6
    #define PA7   7  //D7

    etc.





  • edited June 23
    Thank you!...where? I don't see a variants.h under .pio, .vscode, boards, include, lib, or src.

  • edited June 23
    never mind I found it. I don't see a pin 4 in variants.h, that is the pin defined in the delta rumba32 bltouch example: IO_OUTPUT(Servo1Pin, 4) I did see pin# for pd15 #define PD15 63 //D63 so I edited to IO_OUTPUT(Servo1Pin, 63) still no bltouch
  • pi
     I don't see a pin 4 in variants.h, that is the pin defined in the delta rumba32 bltouch example: IO_OUTPUT(Servo1Pin, 4)
    see
    C:\Users\yourusername\.platformio\packages\framework-arduinoststm32\variants\RUMBA32_F446VE

    pin4 is PA4 as i wrote above


Sign In or Register to comment.