Pārlūkot izejas kodu

MKS Robin Lite/Lite2 Board Support (#14729)

thisiskeithb 5 gadus atpakaļ
vecāks
revīzija
d74efd9d46

+ 8
- 7
Marlin/src/core/boards.h Parādīt failu

@@ -259,13 +259,14 @@
259 259
 #define BOARD_MKS_ROBIN               4005  // MKS Robin (STM32F103ZET6)
260 260
 #define BOARD_MKS_ROBIN_MINI          4006  // MKS Robin Mini (STM32F103VET6)
261 261
 #define BOARD_MKS_ROBIN_NANO          4007  // MKS Robin Nano (STM32F103VET6)
262
-#define BOARD_BIGTREE_SKR_MINI_V1_1   4008  // BigTreeTech SKR Mini v1.1 (STM32F103RC)
263
-#define BOARD_BIGTREE_SKR_MINI_E3     4009  // BigTreeTech SKR Mini E3 (STM32F103RC)
264
-#define BOARD_BIGTREE_SKR_E3_DIP      4010  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC)
265
-#define BOARD_JGAURORA_A5S_A1         4011  // JGAurora A5S A1 (STM32F103ZET6)
266
-#define BOARD_FYSETC_AIO_II           4012  // FYSETC AIO_II
267
-#define BOARD_FYSETC_CHEETAH          4013  // FYSETC Cheetah
268
-#define BOARD_LONGER3D_LK             4014  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
262
+#define BOARD_MKS_ROBIN_LITE          4008  // MKS Robin Lite/Lite2 (STM32F103RCT6)
263
+#define BOARD_BIGTREE_SKR_MINI_V1_1   4009  // BigTreeTech SKR Mini v1.1 (STM32F103RC)
264
+#define BOARD_BIGTREE_SKR_MINI_E3     4010  // BigTreeTech SKR Mini E3 (STM32F103RC)
265
+#define BOARD_BIGTREE_SKR_E3_DIP      4011  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC)
266
+#define BOARD_JGAURORA_A5S_A1         4012  // JGAurora A5S A1 (STM32F103ZET6)
267
+#define BOARD_FYSETC_AIO_II           4013  // FYSETC AIO_II
268
+#define BOARD_FYSETC_CHEETAH          4014  // FYSETC Cheetah
269
+#define BOARD_LONGER3D_LK             4015  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
269 270
 
270 271
 //
271 272
 // ARM Cortex-M4F

+ 2
- 0
Marlin/src/pins/pins.h Parādīt failu

@@ -462,6 +462,8 @@
462 462
   #include "stm32/pins_MKS_ROBIN_MINI.h"        // STM32F1                                env:mks_robin_mini
463 463
 #elif MB(MKS_ROBIN_NANO)
464 464
   #include "stm32/pins_MKS_ROBIN_NANO.h"        // STM32F1                                env:mks_robin_nano
465
+#elif MB(MKS_ROBIN_LITE)
466
+  #include "stm32/pins_MKS_ROBIN_LITE.h"        // STM32F1                                env:mks_robin_lite
465 467
 #elif MB(JGAURORA_A5S_A1)
466 468
   #include "stm32/pins_JGAURORA_A5S_A1.h"       // STM32F1                                env:JGAURORA_A5S_A1
467 469
 #elif MB(FYSETC_AIO_II)

+ 143
- 0
Marlin/src/pins/stm32/pins_MKS_ROBIN_LITE.h Parādīt failu

@@ -0,0 +1,143 @@
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 __STM32F1__
25
+  #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
26
+#endif
27
+
28
+#if HOTENDS > 1 || E_STEPPERS > 1
29
+  #error "MKS Robin Lite supports up to 1 hotends / E-steppers. Comment out this line to continue."
30
+#endif
31
+
32
+#ifndef BOARD_NAME
33
+  #define BOARD_NAME "MKS Robin Lite"
34
+#endif
35
+#define BOARD_WEBSITE_URL "https://github.com/makerbase-mks"
36
+
37
+//#define DISABLE_DEBUG
38
+#define DISABLE_JTAG
39
+#define ENABLE_SPI2
40
+
41
+//
42
+// Limit Switches
43
+//
44
+#define X_STOP_PIN         PC13
45
+#define Y_STOP_PIN         PC0
46
+#define Z_MIN_PIN          PC12
47
+#define Z_MAX_PIN          PB9
48
+
49
+//
50
+// Steppers
51
+//
52
+#define X_STEP_PIN         PC6
53
+#define X_DIR_PIN          PB12
54
+#define X_ENABLE_PIN       PB10
55
+
56
+#define Y_STEP_PIN         PB11
57
+#define Y_DIR_PIN          PB2
58
+#define Y_ENABLE_PIN       PB10
59
+
60
+#define Z_STEP_PIN         PB1
61
+#define Z_DIR_PIN          PC5
62
+#define Z_ENABLE_PIN       PB10
63
+
64
+#define E0_STEP_PIN        PC4
65
+#define E0_DIR_PIN         PA5
66
+#define E0_ENABLE_PIN      PA4
67
+
68
+//
69
+// Heaters / Fans
70
+//
71
+#define HEATER_0_PIN       PC9
72
+#define FAN_PIN            PA8
73
+#define HEATER_BED_PIN     PC8
74
+
75
+//
76
+// Temperature Sensors
77
+//
78
+#define TEMP_BED_PIN       PA1
79
+#define TEMP_0_PIN         PA0
80
+
81
+#define FIL_RUNOUT_PIN     PB8  // MT_DET
82
+
83
+//
84
+// LCD Pins
85
+//
86
+#if HAS_SPI_LCD
87
+  #define BEEPER_PIN       PD2
88
+  #define BTN_ENC          PB3
89
+  #define LCD_PINS_RS      PC3
90
+
91
+  #define BTN_EN1          PB5
92
+  #define BTN_EN2          PB4
93
+
94
+  #define LCD_PINS_ENABLE  PC2
95
+
96
+  #if ENABLED(MKS_MINI_12864)
97
+
98
+    #define LCD_BACKLIGHT_PIN -1
99
+    #define LCD_RESET_PIN  -1
100
+    #define DOGLCD_A0      PC1
101
+    #define DOGLCD_CS      PC2
102
+    #define DOGLCD_SCK     PB13
103
+    #define DOGLCD_MOSI    PB15
104
+
105
+  #else // !MKS_MINI_12864
106
+
107
+    #define LCD_PINS_D4    PC1
108
+    #if ENABLED(ULTIPANEL)
109
+      #define LCD_PINS_D5  -1
110
+      #define LCD_PINS_D6  -1
111
+      #define LCD_PINS_D7  -1
112
+    #endif
113
+
114
+  #endif // !MKS_MINI_12864
115
+
116
+#endif // HAS_SPI_LCD
117
+
118
+// Motor current PWM pins
119
+#define MOTOR_CURRENT_PWM_XY_PIN PB0
120
+#define MOTOR_CURRENT_PWM_Z_PIN  PA7
121
+#define MOTOR_CURRENT_PWM_E_PIN  PA6
122
+#define MOTOR_CURRENT_PWM_RANGE (65535/10/3.3) // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
123
+#define DEFAULT_PWM_MOTOR_CURRENT { 1000, 1000, 1000 } // 1.05Amp per driver, here is XY, Z and E. This values determined empirically.
124
+
125
+//
126
+// SD Card
127
+//
128
+#define ENABLE_SPI2
129
+#define SD_DETECT_PIN      PC10
130
+#define SCK_PIN            PB13
131
+#define MISO_PIN           P1B4
132
+#define MOSI_PIN           P1B5
133
+#define SS_PIN             PA15
134
+
135
+#ifndef ST7920_DELAY_1
136
+  #define ST7920_DELAY_1 DELAY_NS(125)
137
+#endif
138
+#ifndef ST7920_DELAY_2
139
+  #define ST7920_DELAY_2 DELAY_NS(125)
140
+#endif
141
+#ifndef ST7920_DELAY_3
142
+  #define ST7920_DELAY_3 DELAY_NS(125)
143
+#endif

+ 14
- 0
buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld Parādīt failu

@@ -0,0 +1,14 @@
1
+MEMORY
2
+{
3
+  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
4
+  rom (rx)  : ORIGIN = 0x08005000, LENGTH = 256K - 20K
5
+}
6
+
7
+/* Provide memory region aliases for common.inc */
8
+REGION_ALIAS("REGION_TEXT", rom);
9
+REGION_ALIAS("REGION_DATA", ram);
10
+REGION_ALIAS("REGION_BSS", ram);
11
+REGION_ALIAS("REGION_RODATA", rom);
12
+
13
+/* Let common.inc handle the real work. */
14
+INCLUDE common.inc

+ 30
- 0
buildroot/share/PlatformIO/scripts/mks_robin_lite.py Parādīt failu

@@ -0,0 +1,30 @@
1
+Import("env")
2
+
3
+# Relocate firmware from 0x08000000 to 0x08005000
4
+for define in env['CPPDEFINES']:
5
+    if define[0] == "VECT_TAB_ADDR":
6
+        env['CPPDEFINES'].remove(define)
7
+env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
8
+env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
9
+
10
+# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
11
+def encrypt(source, target, env):
12
+    import os
13
+
14
+    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
+
16
+    firmware = open(target[0].path, "rb")
17
+    robin = open(target[0].dir.path +'/mksLite.bin', "wb")
18
+    length = os.path.getsize(target[0].path)
19
+    position = 0
20
+    try:
21
+        while position < length:
22
+            byte = firmware.read(1)
23
+            if position >= 320 and position < 31040:
24
+                byte = chr(ord(byte) ^ key[position & 31])
25
+            robin.write(byte)
26
+            position += 1
27
+    finally:
28
+        firmware.close()
29
+        robin.close()
30
+env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

+ 21
- 0
platformio.ini Parādīt failu

@@ -413,6 +413,27 @@ lib_ignore    = c1921b4
413 413
   U8glib-HAL
414 414
 
415 415
 #
416
+# MKS ROBIN LITE/LITE2 (STM32F103RCT6)
417
+#
418
+[env:mks_robin_lite]
419
+platform      = ststm32
420
+framework     = arduino
421
+board         = genericSTM32F103RC
422
+extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_lite.py
423
+build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
424
+  ${common.build_flags} -std=gnu++14
425
+build_unflags = -std=gnu++11
426
+src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
427
+lib_deps      = ${common.lib_deps}
428
+lib_ignore    = c1921b4
429
+  libf3c
430
+  lib066
431
+  Adafruit NeoPixel_ID28
432
+  Adafruit NeoPixel
433
+  libf3e
434
+  TMC26XStepper
435
+
436
+#
416 437
 # MKS Robin Mini (STM32F103VET6)
417 438
 #
418 439
 [env:mks_robin_mini]

Notiek ielāde…
Atcelt
Saglabāt