Browse Source

GMARSH X6 board support (#14550)

pull/1/head
gmarsh 5 years ago
committed by Scott Lahteine
parent
commit
ab99a80793
  1. 24
      Marlin/src/HAL/HAL_LPC1768/main.cpp
  2. 1
      Marlin/src/core/boards.h
  3. 3
      Marlin/src/inc/Conditionals_post.h
  4. 2
      Marlin/src/inc/SanityCheck.h
  5. 26
      Marlin/src/pins/pins.h
  6. 160
      Marlin/src/pins/pins_GMARSH_X6_REV1.h

24
Marlin/src/HAL/HAL_LPC1768/main.cpp

@ -44,9 +44,7 @@ extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern "C" int isLPC1769();
extern "C" void disk_timerproc(void);
void SysTick_Callback() {
disk_timerproc();
}
void SysTick_Callback() { disk_timerproc(); }
void HAL_init(void) {
@ -99,6 +97,26 @@ void HAL_init(void) {
OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH);
#endif
#ifdef LPC1768_ENABLE_CLKOUT_12M
/**
* CLKOUTCFG register
* bit 8 (CLKOUT_EN) = enables CLKOUT signal. Disabled for now to prevent glitch when enabling GPIO.
* bits 7:4 (CLKOUTDIV) = set to 0 for divider setting of /1
* bits 3:0 (CLKOUTSEL) = set to 1 to select main crystal oscillator as CLKOUT source
*/
LPC_SC->CLKOUTCFG = (0<<8)|(0<<4)|(1<<0);
// set P1.27 pin to function 01 (CLKOUT)
PINSEL_CFG_Type PinCfg;
PinCfg.Portnum = 1;
PinCfg.Pinnum = 27;
PinCfg.Funcnum = 1; // function 01 (CLKOUT)
PinCfg.OpenDrain = 0; // not open drain
PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit
LPC_SC->CLKOUTCFG |= (1<<8);
#endif
USB_Init(); // USB Initialization
USB_Connect(FALSE); // USB clear connection
delay(1000); // Give OS time to notice

1
Marlin/src/core/boards.h

@ -200,6 +200,7 @@
#define BOARD_MKS_SGEN 2018 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
#define BOARD_MKS_SGEN_L 2019 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
#define BOARD_TH3D_EZBOARD 2020 // TH3D EZBoard v1.0
#define BOARD_GMARSH_X6_REV1 2021 // GMARSH X6 board, revision 1 prototype
//
// SAM3X8E ARM Cortex M3

3
Marlin/src/inc/Conditionals_post.h

@ -1660,8 +1660,9 @@
#endif
// Force SDCARD_SORT_ALPHA to be enabled for Graphical LCD on LPC1768
// on boards where SD card and LCD display share the same SPI bus
// because of a bug in the shared SPI implementation. (See #8122)
#if defined(TARGET_LPC1768) && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#if defined(TARGET_LPC1768) && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && (SCK_PIN == LCD_PINS_D4)
#define SDCARD_SORT_ALPHA // Keeps one directory level in RAM. Changing
// directory levels still glitches the screen,
// but the following LCD update cleans it up.

2
Marlin/src/inc/SanityCheck.h

@ -2015,7 +2015,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* TMC2208/2209 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
*/
#if HAS_TMC220x && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
#if HAS_TMC220x && !defined(TARGET_LPC1768) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
defined(X_HARDWARE_SERIAL ) \
|| defined(X2_HARDWARE_SERIAL) \
|| defined(Y_HARDWARE_SERIAL ) \

26
Marlin/src/pins/pins.h

@ -352,6 +352,8 @@
#include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768
#elif MB(TH3D_EZBOARD)
#include "pins_TH3D_EZBOARD.h" // LPC1768 env:LPC1768
#elif MB(GMARSH_X6_REV1)
#include "pins_GMARSH_X6_REV1.h" // LPC1768 env:LPC1768
//
// Other 32-bit Boards
@ -947,6 +949,12 @@
#ifndef X2_MS3_PIN
#define X2_MS3_PIN _EPIN(E_STEPPERS, MS3)
#endif
#ifndef X2_SERIAL_TX_PIN
#define X2_SERIAL_TX_PIN _EPIN(E_STEPPERS, SERIAL_TX)
#endif
#ifndef X2_SERIAL_RX_PIN
#define X2_SERIAL_RX_PIN _EPIN(E_STEPPERS, SERIAL_RX)
#endif
#define Y2_E_INDEX INCREMENT(E_STEPPERS)
#else
#define Y2_E_INDEX E_STEPPERS
@ -974,6 +982,12 @@
#ifndef Y2_MS3_PIN
#define Y2_MS3_PIN _EPIN(Y2_E_INDEX, MS3)
#endif
#ifndef Y2_SERIAL_TX_PIN
#define Y2_SERIAL_TX_PIN _EPIN(Y2_E_INDEX, SERIAL_TX)
#endif
#ifndef Y2_SERIAL_RX_PIN
#define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
#endif
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
#else
#define Z2_E_INDEX Y2_E_INDEX
@ -1001,6 +1015,12 @@
#ifndef Z2_MS3_PIN
#define Z2_MS3_PIN _EPIN(Z2_E_INDEX, MS3)
#endif
#ifndef Z2_SERIAL_TX_PIN
#define Z2_SERIAL_TX_PIN _EPIN(Z2_E_INDEX, SERIAL_TX)
#endif
#ifndef Z2_SERIAL_RX_PIN
#define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
#endif
#define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
#else
#define Z3_E_INDEX Z2_E_INDEX
@ -1027,4 +1047,10 @@
#ifndef Z3_MS3_PIN
#define Z3_MS3_PIN _EPIN(Z3_E_INDEX, MS3)
#endif
#ifndef Z3_SERIAL_TX_PIN
#define Z3_SERIAL_TX_PIN _EPIN(Z3_E_INDEX, SERIAL_TX)
#endif
#ifndef Z3_SERIAL_RX_PIN
#define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
#endif
#endif

160
Marlin/src/pins/pins_GMARSH_X6_REV1.h

@ -0,0 +1,160 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef TARGET_LPC1768
#error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
#endif
#define BOARD_NAME "GMARSH X6 REV1"
// Ignore temp readings during develpment.
//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
//
// Enable 12MHz clock output on P1.27 pin to sync TMC2208 chip clocks
//
#define LPC1768_ENABLE_CLKOUT_12M
//
// Servos
//
#define SERVO0_PIN P1_26 // PWM1[6]
#define SERVO1_PIN P1_18 // PWM1[1]
//
// Limit Switches
//
#define X_MIN_PIN P0_00
#define X_MAX_PIN P0_01
#define Y_MIN_PIN P0_10
#define Y_MAX_PIN P0_21
#define Z_MIN_PIN P2_13
#define Z_MAX_PIN P2_22
//
// Steppers
//
#define X_STEP_PIN P1_01
#define X_DIR_PIN P1_04
#define X_ENABLE_PIN P0_26
#define Y_STEP_PIN P1_10
#define Y_DIR_PIN P1_14
#define Y_ENABLE_PIN P1_08
#define Z_STEP_PIN P1_17
#define Z_DIR_PIN P4_29
#define Z_ENABLE_PIN P1_15
#define E0_STEP_PIN P0_05
#define E0_DIR_PIN P2_00
#define E0_ENABLE_PIN P4_28
#define E1_STEP_PIN P2_03
#define E1_DIR_PIN P2_04
#define E1_ENABLE_PIN P2_01
#define E2_STEP_PIN P2_07
#define E2_DIR_PIN P2_08
#define E2_ENABLE_PIN P2_05
//
// TMC2208 UART pins
//
#if HAS_DRIVER(TMC2208)
#define X_SERIAL_TX_PIN P1_00
#define X_SERIAL_RX_PIN P1_00
#define Y_SERIAL_TX_PIN P1_09
#define Y_SERIAL_RX_PIN P1_09
#define Z_SERIAL_TX_PIN P1_16
#define Z_SERIAL_RX_PIN P1_16
#define E0_SERIAL_TX_PIN P0_04
#define E0_SERIAL_RX_PIN P0_04
#define E1_SERIAL_TX_PIN P2_02
#define E1_SERIAL_RX_PIN P2_02
#define E2_SERIAL_TX_PIN P2_06
#define E2_SERIAL_RX_PIN P2_06
#else
#error "TMC2208 UART configuration is required for GMarsh X6."
#endif
//
// Temperature Sensors
// 3.3V max when defined as an analog input
//
#define TEMP_0_PIN 1 // AD0[0] on P0_23
#define TEMP_BED_PIN 0 // AD0[1] on P0_24
//
// Heaters / Fans
//
#define HEATER_BED_PIN P1_19 // Not a PWM pin, software PWM required
#define HEATER_0_PIN P3_26 // PWM1[3]
#define FAN_PIN P3_25 // Part cooling fan - connected to PWM1[2]
#define E0_AUTO_FAN_PIN P0_27 // Extruder cooling fan
//
// Misc. Functions
//
#define LED_PIN P1_31
//
// LCD
//
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
#define BEEPER_PIN P0_19
#define BTN_EN1 P1_23
#define BTN_EN2 P1_24
#define BTN_ENC P1_25
#define LCD_PINS_RS P0_20
#define LCD_PINS_ENABLE P0_21
#define LCD_PINS_D4 P2_11
#define LCD_PINS_D5 P0_22
#define LCD_PINS_D6 P1_29
#define LCD_PINS_D7 P1_28
#endif
//
// SD Support
//
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION LCD
#endif
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN P0_16
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SD_DETECT_PIN P0_27
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN ONBOARD_SD_CS_PIN
#endif
Loading…
Cancel
Save