MKS SBASE V1.3 Dual Endstop Question [SOLVED]

I am trying to setup an MKS SBASE V1.3 board to use dual endstops. I’ve flashed Marlin 2.0 to the board. I have edited the Configuration.h and Configuration_adv.h to enable the DRV8825 drivers @1.2A and edited the dual endstop code to reassign X+ and Y+ endstops.

When I try to compile the .bin I get the following output. I assume because the E0 and E1 extruder is now mapped to the dual X or Y motor driver is why I am getting this error.

How would I map a dummy extruder?

Do I need to map the E0 and E1 to X and Y in the Configuration_adv.h when I have jumper wires slaving the two channels?

Do need to remap pins in the Pins_MKS_SBASE.h file?

How do I find the pin outs/numbers on the MKS SBASE V1.3 to edit the pins_MKS_SBASE.h file?

 

https://www.v1engineering.com/auto-square-dual-endstops/

How it is done in the firmware

Marlin currently has to have at least one extruder defined, this extruder causes us an issue has we need the driver it is assigned to. All boards have and E0 driver (some call it something different), and dual firmware capable boards also have an E1 driver, beyond that most boards have breakout pins for more external drivers. The first extruder gets assigned to driver E0. To make this all work I change pin assignments for E0 to one of the external break pins change the current E1 pins to the E0 driver, and create an E2 set and assign them the pins of the E1 driver.

I hope that makes sense, I move E0 pin assingments out of the way and shuffle E1 and E2 down one slot.

All of this happens in the Pins/Pins_XXXX.h files. XXXX=whatever board you are using.

 

Thanks in advance

 

Processing LPC1768 (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/master.zip; board: nxp_lpc1768; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc-arduino-lpc176x/nxp_lpc1768.html
PLATFORM: NXP Arduino LPC176x > NXP LPC1768
HARDWARE: LPC1768 100MHz 31.80KB RAM (464KB Flash)

DEBUG: CURRENT(cmsis-dap) ON-BOARD(cmsis-dap) EXTERNAL(blackmagic, jlink)
Converting Marlin.ino
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(off) COMPATIBILITY(strict)
Collected 4 compatible libraries
Scanning dependencies…
Dependency Graph
|-- <Servo> 1.0.0
|-- <LiquidCrystal> 1.0.0
|-- <U8glib-HAL> 0.4
|-- <TMCStepper> 0.3.0 #8ac8a73

Unable to find destination disk. File must be copied manually.

Compiling .pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\DebugMonitor_LPC1768.cpp.o
Compiling .pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL.cpp.o
Compiling .pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL_spi.cpp.o
Compiling .pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL_timers.cpp.o

In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:32:0,
from Marlin\src\HAL\HAL_LPC1768\HAL.cpp:23:
Marlin\src\HAL\HAL_LPC1768…/…/inc/…/pins/pins.h:873:8: error: #error “No E stepper plug left for Y2!”
#error “No E stepper plug left for Y2!”
^~~~~

In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:32:0,
from Marlin\src\HAL\HAL_LPC1768\HAL_timers.cpp:31:
Marlin\src\HAL\HAL_LPC1768…/…/inc/…/pins/pins.h:873:8: error: #error “No E stepper plug left for Y2!”
#error “No E stepper plug left for Y2!”
^~~~~
In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:32:0,
from Marlin\src\HAL\HAL_LPC1768\HAL_spi.cpp:51:
Marlin\src\HAL\HAL_LPC1768…/…/inc/…/pins/pins.h:873:8: error: #error “No E stepper plug left for Y2!”
#error “No E stepper plug left for Y2!”
^~~~~
In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:41:0,
from Marlin\src\HAL\HAL_LPC1768\HAL_timers.cpp:31:
Marlin\src\HAL\HAL_LPC1768…/…/inc/SanityCheck.h:410:4: error: #error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
#error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
^~~~~
In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:41:0,
from Marlin\src\HAL\HAL_LPC1768\HAL.cpp:23:
Marlin\src\HAL\HAL_LPC1768…/…/inc/SanityCheck.h:410:4: error: #error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
#error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
^~~~~
In file included from Marlin\src\HAL\HAL_LPC1768…/…/inc/MarlinConfig.h:41:0,
from Marlin\src\HAL\HAL_LPC1768\HAL_spi.cpp:51:
Marlin\src\HAL\HAL_LPC1768…/…/inc/SanityCheck.h:410:4: error: #error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
#error “Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug).”
^~~~~
*** [.pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL.cpp.o] Error 1
*** [.pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL_timers.cpp.o] Error 1
*** [.pioenvs\LPC1768\src\src\HAL\HAL_LPC1768\HAL_spi.cpp.o] Error 1

[SUMMARY]
Environment megaatmega2560 [SKIP]
Environment megaatmega1280 [SKIP]
Environment at90usb1286_cdc [SKIP]
Environment at90usb1286_dfu [SKIP]
Environment DUE [SKIP]
Environment DUE_USB [SKIP]
Environment DUE_debug [SKIP]
Environment LPC1769 [SKIP]
Environment melzi [SKIP]
Environment melzi_optiboot [SKIP]
Environment rambo [SKIP]
Environment sanguino_atmega644p [SKIP]
Environment sanguino_atmega1284p [SKIP]
Environment STM32F1 [SKIP]
Environment STM32F4 [SKIP]
Environment ARMED [SKIP]
Environment teensy35 [SKIP]
Environment malyanm200 [SKIP]
Environment esp32 [SKIP]
Environment fysetc_f6_13 [SKIP]
[ERROR] Took 15.80 seconds
Environment LPC1768 [ERROR]
[ERROR] Took 15.80 seconds

 

1 Like

I ran a diff on the regular MPCNC Marlin firmware and dual endstop MPCNC Marlin firmware and found the following files need to be changed to support dual endstops.

Configuration.h

Configuration_adv.h

src/module/stepper.cpp

src/pins/pins_MKS_SBASE.h

 

I’ve updated the files for dual endstops but need to know where I can find the pin mapping or pin out for the MKS SBASE v1.3 board. I’ve search and found various pictures of the board but do not see anything which gives me the pins.

That is a lot of info. I don’t have time to read it all but I did see you ask about your Pinout. I think this is the pinout for the v1.3.

 

Does the MKS GEN and the MKS SBASE have the same pin-outs?

I found this website but I do not see the detailed pin-outs like the diagram for the MKS GEN.

I found this website but I do not see the detailed pin-outs like the diagram for the MKS GEN.

[attachment file=87814]

I found this pic which is a little bit clearer to read[attachment file=87821]

I found this pic which is a little bit clearer to read[attachment file=87824]

Not quite sure why it’s double posting when I upload a pic but you can delete the dupe posts.

Finally, I have the dual X and dual Y working…now on to the dual endstops.

I had to remap the E0 and E1 to X2 and Y2 and remap E0 to the TH1, TH2 and TH3 pins (which is not used) in the pins_MKS_SBASE.h

Finished the modifications to the MKS_SBASE v1.3 board using Marlin 2.0 firmware for Dual X Motors, Dual Y Motors, and Dual Endstops.

The firmware.bin is included for the MKS_SBASE v1.3. Copy to the SD card and delete the FIRMWARE.CUR file on the SD card. Insert the SD card and power up the board.

 

If you want to compile your own firmware in Atom using PlatformIO: (Don’t recommend Arduino IDE 1.9 beta because a trojan/virus may have been found in the zip file in the serial-discovery.exe)

Download the MPCNC Marlin 2.0 firmware and extract the zip file.

Extract the attached zip file and copy the extracted files to the following directories

Marlin-bugfix-2.0.x\platformio.ini

Marlin-bugfix-2.0.x\Marlin\Configuration.h

Marlin-bugfix-2.0.x\Marlin\Configuration_adv.h

Marlin-bugfix-2.0.x\Marlin\src\pins\pins_MKS_SBASE.h

 

Depending upon which endstop you use, you may have to change the (X and Y)_MIN_ENDSTOP_INVERTING and (X and Y)_MAX_ENDSTOP_INVERTING from TRUE to FALSE in the Configuration.h

If you bought the 2 wire endstops it may be different than the 3 wire endstops I bought. The endstops I have are listed below. I have not tested this setup with 2 wire endstops.

Another thing, the MKS_SBASE v1.3 allows the DRV8825 channels to be jumped together to basically clone an axis. Do not use a jumper wire to make dual X or Y axis’. All duplication of the axis’ are done in the firmware settings. No need for jumper wires.

I updated the configs to slow down X and Y homing feedrate. My CNC was lossing steps while trying to home

Change following lines to suit your CNC size and motor direction:

#define X_BED_SIZE 559
#define Y_BED_SIZE 432

#define INVERT_X2_VS_X_DIR false // Set ‘true’ if X motors should rotate in opposite directions

#define INVERT_Y2_VS_Y_DIR false // Set ‘true’ if Y motors should rotate in opposite directions

 

 

Copy the files to the following directories and overwrite the old files.

Marlin-bugfix-2.0.x\platformio.ini

Marlin-bugfix-2.0.x\Marlin\Configuration.h

Marlin-bugfix-2.0.x\Marlin\Configuration_adv.h

Marlin-bugfix-2.0.x\Marlin\src\pins\pins_MKS_SBASE.h

What about the config.txt that is on the sd card?

I want to try this out on my MKS SBASE but am not so good with how to load firmware/configure, etc.

I took the zip and pulled the bin and loaded to the SD card and it appears the firmware is loaded.

I am just unclear of what other settings I need to change, etc. E.g. Stepper voltage, direction

I downloaded Atom/PlatformIO - copied the files like you said.

 

I am getting this error after hitting the checkmark icon.

I’ve updated my config because the stepper drivers where getting hot just sitting there so I decreased the milliamps from 1200 to 1100 and the drivers seem to be ok. Attached are the new files.

  1. Install Atom Text Editor (You do not need to install Clang)

  2. Install platformio-IDE (See this video on YouTube- https://www.youtube.com/watch?v=gMPdsBumWCQ )

  3. Download the MPCNC Marlin-bugfix-2.0 from the V1Engineering Marlin Repository and extract the zip. Don’t use any other firmware than the MPCNC Marlin-bugfix-2.0.

  4. Download the MKS_SBASE v1.3 Dual Endstops zip file attached to this forum post and extract the zip

  5. Copy platformio.ini to the ~\Marlin-bugfix-2.0.x\ directory (Ensure the old files are overwritten)

  6. Copy Configuration.h and Configuration_adv.h to the ~\Marlin-bugfix-2.0.x\Marlin directory (Ensure the old files are overwritten)

  7. Copy pins_MKS_SBASE.h to the Marlin-bugfix-2.0.x\Marlin\src\pins directory (Ensure the old files are overwritten)

  8. Open ATOM Text Editor

  9. Click FILE \ OPEN FOLDER (at the top menu) and select the ~\Marlin-bugfix-2.0.x folder (Where you extracted the zip in step 3)

  10. Click the Check Mark on the left menu to compile the FIRMWARE.BIN

  11. Plug an SD card into your computer and copy the firmware.bin to the SD card

  12. Delete the FIRMWARE.CUR file on the SD card

  13. Plug the SD card into the MKS Sbase v1.3 board and power it on with either a USB cable or a 12v power supply. The FIRMWARE.BIN will be flashed and renamed to FIRMWARE.CUR

  14. If you endstops do not trigger then try changing the following settings in Configuration.h to false

// Mechanical endstop with COM to ground and NC to Signal uses “false” here (most common setup).
#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Y_MAX_ENDSTOP_INVERTING true// set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe.

  1. Or just copy the included compiled FIRMWARE.BIN to your SD card and repeat step 11 thru 13.

MKS_SBASE_v1.3_Dual_Endstops.zip (122 KB)

This firmware does not use a config file like Smoothieware

I’ve updated my firmware.bin with lower milliamps on the drivers and motors (from 1200 mA to 1100 mA) to prevent overheating. Everything should be set if you used my files or loaded the pre-compiled firmware.bin