Skip to content

MKS Sgen L v1.0 Pin definition #62

Open

Description

@liteon92

I have make a pin definition for MKS SGEN l V1.0, working fine but i don't how put new files on gihub
Two files
mks_sgenl_10_map.h

/*
mks_sgenl_1.0_map.h - driver code for LPC176x processor, pin mappings compatible with MKS SGENL V1.0

Part of grblHAL

Copyright (c) 2020-2024 Terje Io

grblHAL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

grblHAL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with grblHAL. If not, see http://www.gnu.org/licenses/.
*/

// NOTE:
// P0.27, P0.28 are dedicated I2C pins without pull up/down.
// P0.29, P0.30 must have same direction as used for USB operation.

#if N_ABC_MOTORS > 2
#error "Axis configuration is not supported!"
#endif

#define BOARD_NAME "MKS SGENL V1.0"

#if TRINAMIC_ENABLE
#define HAS_BOARD_INIT
#endif

void board_init(void);

#undef I2C_ENABLE
#define I2C_ENABLE 2

void board_init (void);

// Define step pulse output pins.

#define X_STEP_PN 2
#define X_STEP_PORT port(X_STEP_PN)
#define X_STEP_PIN 2
#define Y_STEP_PN 0
#define Y_STEP_PORT port(Y_STEP_PN)
#define Y_STEP_PIN 19
#define Z_STEP_PN 0
#define Z_STEP_PORT port(Z_STEP_PN)
#define Z_STEP_PIN 22
#define STEP_OUTMODE GPIO_BITBAND

// Define step direction output pins.
#define X_DIRECTION_PN 2
#define X_DIRECTION_PORT port(X_DIRECTION_PN)
#define X_DIRECTION_PIN 3
#define Y_DIRECTION_PN 0
#define Y_DIRECTION_PORT port(Y_DIRECTION_PN)
#define Y_DIRECTION_PIN 20
#define Z_DIRECTION_PN 2
#define Z_DIRECTION_PORT port(Z_DIRECTION_PN)
#define Z_DIRECTION_PIN 11
#define DIRECTION_OUTMODE GPIO_BITBAND

// Define stepper driver enable/disable output pin(s).
#define X_ENABLE_PN 2
#define X_ENABLE_PORT port(X_ENABLE_PN)
#define X_ENABLE_PIN 1
#define Y_ENABLE_PN 2
#define Y_ENABLE_PORT port(Y_ENABLE_PN)
#define Y_ENABLE_PIN 8
#define Z_ENABLE_PN 0
#define Z_ENABLE_PORT port(Z_ENABLE_PN)
#define Z_ENABLE_PIN 21

// Define homing/hard limit switch input pins.
// NOTE: All limit bits (needs to be on same port)
#define X_LIMIT_PN 1
#define X_LIMIT_PORT port(X_LIMIT_PN)
#define X_LIMIT_PIN 29
#define Y_LIMIT_PN 1
#define Y_LIMIT_PORT port(Y_LIMIT_PN)
#define Y_LIMIT_PIN 27
#define Z_LIMIT_PN 1
#define Z_LIMIT_PORT port(Z_LIMIT_PN)
#define Z_LIMIT_PIN 25
#define M3_LIMIT_PN 1
#define M3_LIMIT_PORT port(M3_LIMIT_PN)
#define M3_LIMIT_PIN 28
#define M4_LIMIT_PN 1
#define M4_LIMIT_PORT port(M4_LIMIT_PN)
#define M4_LIMIT_PIN 26

// Define max homing/hard limit switch input pins.
#if LIMIT_MAX_ENABLE
//#define X_LIMIT_PN_MAX 0
//#define X_LIMIT_PORT_MAX port(X_LIMIT_PN_MAX)
//#define X_LIMIT_PIN_MAX 8
//#define Y_LIMIT_PN_MAX 0
//#define Y_LIMIT_PORT_MAX port(Y_LIMIT_PN_MAX)
//#define Y_LIMIT_PIN_MAX 7
//#define Z_LIMIT_PN_MAX 1
//#define Z_LIMIT_PORT_MAX port(Z_LIMIT_PN_MAX)
//#define Z_LIMIT_PIN_MAX 24
#endif

#define LIMITS_POLL_PORT port(1) // NOTE: Port 1 is not interrupt capable, use polling instead!
#define LIMIT_INMODE GPIO_BITBAND

// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS > 0
#define M3_AVAILABLE
#define M3_STEP_PN 2
#define M3_STEP_PORT port(M3_STEP_PN)
#define M3_STEP_PIN 13
#define M3_DIRECTION_PN 0
#define M3_DIRECTION_PORT port(M3_DIRECTION_PN)
#define M3_DIRECTION_PIN 11
#define M3_ENABLE_PN 2
#define M3_ENABLE_PORT port(M3_ENABLE_PN)
#define M3_ENABLE_PIN 12
#endif

// Define ganged axis or B axis step pulse and step direction output pins.
#if N_ABC_MOTORS == 2
#define M4_AVAILABLE
#define M4_STEP_PN 0
#define M4_STEP_PORT port(M4_STEP_PN)
#define M4_STEP_PIN 1
#define M4_DIRECTION_PN 0
#define M4_DIRECTION_PORT port(M4_DIRECTION_PN)
#define M4_DIRECTION_PIN 0
#define M4_ENABLE_PN 0
#define M4_ENABLE_PORT port(M4_ENABLE_PN)
#define M4_ENABLE_PIN 10
#endif

// Define auxiliary output pins
#define AUXOUTPUT0_PN 2 // Spindle PWM
#define AUXOUTPUT0_PORT port(AUXOUTPUT0_PN)
#define AUXOUTPUT0_PIN 0
#define AUXOUTPUT1_PN 1 // Spindle direction
#define AUXOUTPUT1_PORT port(AUXOUTPUT1_PN)
#define AUXOUTPUT1_PIN 23
#define AUXOUTPUT2_PN 2 // Spindle enable
#define AUXOUTPUT2_PORT port(AUXOUTPUT2_PN)
#define AUXOUTPUT2_PIN 4
#define AUXOUTPUT3_PN 2 // Coolant flood, E2 MOSFET
#define AUXOUTPUT3_PORT port(AUXOUTPUT3_PN)
#define AUXOUTPUT3_PIN 6
#define AUXOUTPUT4_PN 2 // Coolant mist, E1 MOSFET
#define AUXOUTPUT4_PORT port(AUXOUTPUT4_PN)
#define AUXOUTPUT4_PIN 7

// Define driver spindle pins
#if DRIVER_SPINDLE_ENABLE & SPINDLE_ENA
#define SPINDLE_ENABLE_PORT AUXOUTPUT2_PORT
#define SPINDLE_ENABLE_PIN AUXOUTPUT2_PIN
#endif
#if DRIVER_SPINDLE_ENABLE & SPINDLE_PWM
#ifdef SPINDLE_PWM_PIN_2_5
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P2.4)
#else
#define SPINDLE_PWM_CHANNEL PWM1_CH1 // BED MOSFET (P2.5)
#endif
#define SPINDLE_PWM_USE_PRIMARY_PIN false
#define SPINDLE_PWM_USE_SECONDARY_PIN true
#define SPINDLE_PWM_PORT AUXOUTPUT0_PORT
#define SPINDLE_PWM_PIN AUXOUTPUT0_PIN
#endif
#if DRIVER_SPINDLE_ENABLE & SPINDLE_DIR
#define SPINDLE_DIRECTION_PORT AUXOUTPUT1_PORT
#define SPINDLE_DIRECTION_PIN AUXOUTPUT1_PIN
#endif

// Define flood and mist coolant enable output pins.
#if COOLANT_ENABLE & COOLANT_FLOOD
#define COOLANT_FLOOD_PORT AUXOUTPUT3_PORT
#define COOLANT_FLOOD_PIN AUXOUTPUT3_PIN
#endif
#if COOLANT_ENABLE & COOLANT_MIST
#define COOLANT_MIST_PORT AUXOUTPUT4_PORT
#define COOLANT_MIST_PIN AUXOUTPUT4_PIN
#endif

#define AUXINPUT0_PORT port(1)
#define AUXINPUT0_PIN 31
#define AUXINPUT1_PORT port(0) // E1 MOSFET (P2.7)
#define AUXINPUT1_PIN 2
#define AUXINPUT2_PORT port(1)
#define AUXINPUT2_PIN 24
#define AUXINPUT3_PORT port(0) // Reset/EStop
#define AUXINPUT3_PIN 25
#define AUXINPUT4_PORT port(0) // Feed hold
#define AUXINPUT4_PIN 24
#define AUXINPUT5_PORT port(0) // Cycle start
#define AUXINPUT5_PIN 23

// Define user-control controls (cycle start, reset, feed hold) input pins.
#if CONTROL_ENABLE & CONTROL_HALT
#define RESET_PORT AUXINPUT3_PORT
#define RESET_PIN AUXINPUT3_PIN
#endif
#if CONTROL_ENABLE & CONTROL_FEED_HOLD
#define FEED_HOLD_PORT AUXINPUT4_PORT
#define FEED_HOLD_PIN AUXINPUT4_PIN
#endif
#if CONTROL_ENABLE & CONTROL_CYCLE_START
#define CYCLE_START_PORT AUXINPUT5_PORT
#define CYCLE_START_PIN AUXINPUT5_PIN
#endif

#if PROBE_ENABLE
#define PROBE_PORT AUXINPUT2_PORT
#define PROBE_PIN AUXINPUT2_PIN
#endif

#if MPG_ENABLE == 1
#define MPG_MODE_PORT AUXINPUT1_PORT
#define MPG_MODE_PIN AUXINPUT1_PIN
#elif I2C_STROBE_ENABLE
#define I2C_STROBE_PORT AUXINPUT1_PORT
#define I2C_STROBE_PIN AUXINPUT1_PIN
#endif

#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PORT AUXINPUT0_PORT
#define SAFETY_DOOR_PIN AUXINPUT0_PIN
#elif MOTOR_FAULT_ENABLE
#define MOTOR_FAULT_PORT AUXINPUT0_PORT
#define MOTOR_FAULT_PIN AUXINPUT0_PIN
#endif

#define SD_SPI_PORT 1
#define SD_CS_PN 0
#define SD_CS_PORT port(SD_CS_PN)
#define SD_CS_PIN 6

//#define TMC_STEALTHCHOP 0 // CoolStep
#define MOTOR_UARTX_PN 1
#define MOTOR_UARTX_PORT port(MOTOR_UARTX_PN)
#define MOTOR_UARTX_PIN 4
#define MOTOR_UARTY_PN 1
#define MOTOR_UARTY_PORT port(MOTOR_UARTY_PN)
#define MOTOR_UARTY_PIN 9
#define MOTOR_UARTZ_PN 1
#define MOTOR_UARTZ_PORT port(MOTOR_UARTZ_PN)
#define MOTOR_UARTZ_PIN 14
#ifdef M3_AVAILABLE
#define MOTOR_UARTM3_PN 1
#define MOTOR_UARTM3_PORT port(MOTOR_UARTM3_PN)
#define MOTOR_UARTM3_PIN 16
#endif
#ifdef M4_AVAILABLE
#define MOTOR_UARTM4_PN 4
#define MOTOR_UARTM4_PORT port(MOTOR_UARTM4_PN)
#define MOTOR_UARTM4_PIN 29
#endif

//#define MCP44XX_I2C_ADDR 0b0101100

/**/

mks_sgen_l.c

#include "driver.h"

#if defined(BOARD_MKS_SGENL_10)

extern void tmc_uart_init (void);

void board_init (void)
{
tmc_uart_init();
}

#endif

Activity

  1. added a commit that references this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions