Quellcode durchsuchen

GMARSH X6 board support (#14550)

gmarsh vor 6 Jahren
Ursprung
Commit
ab99a80793

+ 21
- 3
Marlin/src/HAL/HAL_LPC1768/main.cpp Datei anzeigen

@@ -44,9 +44,7 @@ extern uint32_t MSC_SD_Init(uint8_t pdrv);
44 44
 extern "C" int isLPC1769();
45 45
 extern "C" void disk_timerproc(void);
46 46
 
47
-void SysTick_Callback() {
48
-  disk_timerproc();
49
-}
47
+void SysTick_Callback() { disk_timerproc(); }
50 48
 
51 49
 void HAL_init(void) {
52 50
 
@@ -99,6 +97,26 @@ void HAL_init(void) {
99 97
     OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH);
100 98
   #endif
101 99
 
100
+  #ifdef LPC1768_ENABLE_CLKOUT_12M
101
+   /**
102
+    * CLKOUTCFG register
103
+    * bit 8 (CLKOUT_EN) = enables CLKOUT signal. Disabled for now to prevent glitch when enabling GPIO.
104
+    * bits 7:4 (CLKOUTDIV) = set to 0 for divider setting of /1
105
+    * bits 3:0 (CLKOUTSEL) = set to 1 to select main crystal oscillator as CLKOUT source
106
+    */
107
+    LPC_SC->CLKOUTCFG = (0<<8)|(0<<4)|(1<<0);
108
+    // set P1.27 pin to function 01 (CLKOUT)
109
+    PINSEL_CFG_Type PinCfg;
110
+    PinCfg.Portnum = 1;
111
+    PinCfg.Pinnum = 27;
112
+    PinCfg.Funcnum = 1;    // function 01 (CLKOUT)
113
+    PinCfg.OpenDrain = 0;  // not open drain
114
+    PinCfg.Pinmode = 2;    // no pull-up/pull-down
115
+    PINSEL_ConfigPin(&PinCfg);
116
+    // now set CLKOUT_EN bit
117
+    LPC_SC->CLKOUTCFG |= (1<<8);
118
+  #endif
119
+
102 120
   USB_Init();                               // USB Initialization
103 121
   USB_Connect(FALSE);                       // USB clear connection
104 122
   delay(1000);                              // Give OS time to notice

+ 1
- 0
Marlin/src/core/boards.h Datei anzeigen

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

+ 2
- 1
Marlin/src/inc/Conditionals_post.h Datei anzeigen

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

+ 1
- 1
Marlin/src/inc/SanityCheck.h Datei anzeigen

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

+ 26
- 0
Marlin/src/pins/pins.h Datei anzeigen

@@ -352,6 +352,8 @@
352 352
   #include "pins_BIGTREE_SKR_V1.3.h"    // LPC1768                                    env:LPC1768
353 353
 #elif MB(TH3D_EZBOARD)
354 354
   #include "pins_TH3D_EZBOARD.h"        // LPC1768                                    env:LPC1768
355
+#elif MB(GMARSH_X6_REV1)
356
+  #include "pins_GMARSH_X6_REV1.h"      // LPC1768                                    env:LPC1768
355 357
 
356 358
 //
357 359
 // Other 32-bit Boards
@@ -947,6 +949,12 @@
947 949
   #ifndef X2_MS3_PIN
948 950
     #define X2_MS3_PIN    _EPIN(E_STEPPERS, MS3)
949 951
   #endif
952
+  #ifndef X2_SERIAL_TX_PIN
953
+    #define X2_SERIAL_TX_PIN    _EPIN(E_STEPPERS, SERIAL_TX)
954
+  #endif
955
+  #ifndef X2_SERIAL_RX_PIN
956
+    #define X2_SERIAL_RX_PIN    _EPIN(E_STEPPERS, SERIAL_RX)
957
+  #endif
950 958
   #define Y2_E_INDEX INCREMENT(E_STEPPERS)
951 959
 #else
952 960
   #define Y2_E_INDEX E_STEPPERS
@@ -974,6 +982,12 @@
974 982
   #ifndef Y2_MS3_PIN
975 983
     #define Y2_MS3_PIN    _EPIN(Y2_E_INDEX, MS3)
976 984
   #endif
985
+  #ifndef Y2_SERIAL_TX_PIN
986
+    #define Y2_SERIAL_TX_PIN    _EPIN(Y2_E_INDEX, SERIAL_TX)
987
+  #endif
988
+  #ifndef Y2_SERIAL_RX_PIN
989
+    #define Y2_SERIAL_RX_PIN    _EPIN(Y2_E_INDEX, SERIAL_RX)
990
+  #endif
977 991
   #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
978 992
 #else
979 993
   #define Z2_E_INDEX Y2_E_INDEX
@@ -1001,6 +1015,12 @@
1001 1015
   #ifndef Z2_MS3_PIN
1002 1016
     #define Z2_MS3_PIN    _EPIN(Z2_E_INDEX, MS3)
1003 1017
   #endif
1018
+  #ifndef Z2_SERIAL_TX_PIN
1019
+    #define Z2_SERIAL_TX_PIN    _EPIN(Z2_E_INDEX, SERIAL_TX)
1020
+  #endif
1021
+  #ifndef Z2_SERIAL_RX_PIN
1022
+    #define Z2_SERIAL_RX_PIN    _EPIN(Z2_E_INDEX, SERIAL_RX)
1023
+  #endif
1004 1024
   #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
1005 1025
 #else
1006 1026
   #define Z3_E_INDEX Z2_E_INDEX
@@ -1027,4 +1047,10 @@
1027 1047
   #ifndef Z3_MS3_PIN
1028 1048
     #define Z3_MS3_PIN    _EPIN(Z3_E_INDEX, MS3)
1029 1049
   #endif
1050
+  #ifndef Z3_SERIAL_TX_PIN
1051
+    #define Z3_SERIAL_TX_PIN    _EPIN(Z3_E_INDEX, SERIAL_TX)
1052
+  #endif
1053
+  #ifndef Z3_SERIAL_RX_PIN
1054
+    #define Z3_SERIAL_RX_PIN    _EPIN(Z3_E_INDEX, SERIAL_RX)
1055
+  #endif
1030 1056
 #endif

+ 160
- 0
Marlin/src/pins/pins_GMARSH_X6_REV1.h Datei anzeigen

@@ -0,0 +1,160 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifndef TARGET_LPC1768
25
+  #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
26
+#endif
27
+
28
+#define BOARD_NAME "GMARSH X6 REV1"
29
+
30
+// Ignore temp readings during develpment.
31
+//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
32
+
33
+//
34
+// Enable 12MHz clock output on P1.27 pin to sync TMC2208 chip clocks
35
+//
36
+#define LPC1768_ENABLE_CLKOUT_12M
37
+
38
+//
39
+// Servos
40
+//
41
+#define SERVO0_PIN         P1_26   // PWM1[6]
42
+#define SERVO1_PIN         P1_18   // PWM1[1]
43
+
44
+//
45
+// Limit Switches
46
+//
47
+#define X_MIN_PIN          P0_00
48
+#define X_MAX_PIN          P0_01
49
+#define Y_MIN_PIN          P0_10
50
+#define Y_MAX_PIN          P0_21
51
+#define Z_MIN_PIN          P2_13
52
+#define Z_MAX_PIN          P2_22
53
+
54
+//
55
+// Steppers
56
+//
57
+
58
+#define X_STEP_PIN         P1_01
59
+#define X_DIR_PIN          P1_04
60
+#define X_ENABLE_PIN       P0_26
61
+
62
+#define Y_STEP_PIN         P1_10
63
+#define Y_DIR_PIN          P1_14
64
+#define Y_ENABLE_PIN       P1_08
65
+
66
+#define Z_STEP_PIN         P1_17
67
+#define Z_DIR_PIN          P4_29
68
+#define Z_ENABLE_PIN       P1_15
69
+
70
+#define E0_STEP_PIN        P0_05
71
+#define E0_DIR_PIN         P2_00
72
+#define E0_ENABLE_PIN      P4_28
73
+
74
+#define E1_STEP_PIN        P2_03
75
+#define E1_DIR_PIN         P2_04
76
+#define E1_ENABLE_PIN      P2_01
77
+
78
+#define E2_STEP_PIN        P2_07
79
+#define E2_DIR_PIN         P2_08
80
+#define E2_ENABLE_PIN      P2_05
81
+
82
+//
83
+// TMC2208 UART pins
84
+//
85
+#if HAS_DRIVER(TMC2208)
86
+  #define X_SERIAL_TX_PIN  P1_00
87
+  #define X_SERIAL_RX_PIN  P1_00
88
+  #define Y_SERIAL_TX_PIN  P1_09
89
+  #define Y_SERIAL_RX_PIN  P1_09
90
+  #define Z_SERIAL_TX_PIN  P1_16
91
+  #define Z_SERIAL_RX_PIN  P1_16
92
+  #define E0_SERIAL_TX_PIN P0_04
93
+  #define E0_SERIAL_RX_PIN P0_04
94
+  #define E1_SERIAL_TX_PIN P2_02
95
+  #define E1_SERIAL_RX_PIN P2_02
96
+  #define E2_SERIAL_TX_PIN P2_06
97
+  #define E2_SERIAL_RX_PIN P2_06
98
+#else
99
+  #error "TMC2208 UART configuration is required for GMarsh X6."
100
+#endif
101
+
102
+//
103
+// Temperature Sensors
104
+//  3.3V max when defined as an analog input
105
+//
106
+#define TEMP_0_PIN          1   // AD0[0] on P0_23
107
+#define TEMP_BED_PIN        0   // AD0[1] on P0_24
108
+
109
+//
110
+// Heaters / Fans
111
+//
112
+#define HEATER_BED_PIN     P1_19 // Not a PWM pin, software PWM required
113
+#define HEATER_0_PIN       P3_26 // PWM1[3]
114
+#define FAN_PIN            P3_25 // Part cooling fan - connected to PWM1[2]
115
+#define E0_AUTO_FAN_PIN    P0_27 // Extruder cooling fan
116
+
117
+//
118
+// Misc. Functions
119
+//
120
+#define LED_PIN            P1_31
121
+
122
+//
123
+// LCD
124
+//
125
+#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
126
+  #define BEEPER_PIN       P0_19
127
+  #define BTN_EN1          P1_23
128
+  #define BTN_EN2          P1_24
129
+  #define BTN_ENC          P1_25
130
+  #define LCD_PINS_RS      P0_20
131
+  #define LCD_PINS_ENABLE  P0_21
132
+  #define LCD_PINS_D4      P2_11
133
+  #define LCD_PINS_D5      P0_22
134
+  #define LCD_PINS_D6      P1_29
135
+  #define LCD_PINS_D7      P1_28
136
+#endif
137
+
138
+//
139
+// SD Support
140
+//
141
+
142
+#ifndef SDCARD_CONNECTION
143
+  #define SDCARD_CONNECTION LCD
144
+#endif
145
+
146
+#define ONBOARD_SD_CS_PIN  P0_06   // Chip select for "System" SD card
147
+
148
+#if SD_CONNECTION_IS(LCD)
149
+  #define SCK_PIN          P0_15
150
+  #define MISO_PIN         P0_17
151
+  #define MOSI_PIN         P0_18
152
+  #define SS_PIN           P0_16
153
+#elif SD_CONNECTION_IS(ONBOARD)
154
+  #undef SD_DETECT_PIN
155
+  #define SD_DETECT_PIN    P0_27
156
+  #define SCK_PIN          P0_07
157
+  #define MISO_PIN         P0_08
158
+  #define MOSI_PIN         P0_09
159
+  #define SS_PIN           ONBOARD_SD_CS_PIN
160
+#endif

Laden…
Abbrechen
Speichern