Преглед изворни кода

MKS Robin Nano board support (#14363)

thisiskeithb пре 4 година
родитељ
комит
8b63e3701f

+ 1
- 0
Marlin/src/core/boards.h Прегледај датотеку

@@ -249,6 +249,7 @@
249 249
 #define BOARD_MORPHEUS                1806  // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller
250 250
 #define BOARD_MKS_ROBIN               1808  // MKS Robin / STM32F103ZET6
251 251
 #define BOARD_MKS_ROBIN_MINI          1813  // MKS Robin Mini / STM32F103VET6
252
+#define BOARD_MKS_ROBIN_NANO          1812  // MKS Robin Nano / STM32F103VET6
252 253
 #define BOARD_BIGTREE_SKR_MINI_V1_1   1814  // STM32F103RC
253 254
 #define BOARD_JGAURORA_A5S_A1         1820  // JGAurora A5S A1 / STM32F103ZET6
254 255
 #define BOARD_FYSETC_AIO_II           1890  // FYSETC AIO_II

+ 2
- 0
Marlin/src/pins/pins.h Прегледај датотеку

@@ -434,6 +434,8 @@
434 434
   #include "pins_MKS_ROBIN.h"         // STM32F1                                    env:mks_robin
435 435
 #elif MB(MKS_ROBIN_MINI)
436 436
   #include "pins_MKS_ROBIN_MINI.h"    // STM32F1                                    env:mks_robin_mini
437
+#elif MB(MKS_ROBIN_NANO)
438
+  #include "pins_MKS_ROBIN_NANO.h"    // STM32F1                                    env:mks_robin_nano
437 439
 #elif MB(JGAURORA_A5S_A1)
438 440
   #include "pins_JGAURORA_A5S_A1.h"   // STM32F1                                    env:JGAURORA_A5S_A1
439 441
 #elif MB(FYSETC_AIO_II)

+ 118
- 0
Marlin/src/pins/pins_MKS_ROBIN_NANO.h Прегледај датотеку

@@ -0,0 +1,118 @@
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
+
23
+/**
24
+ * MKS Robin nano (STM32F130VET6) board pin assignments
25
+ */
26
+
27
+#ifndef __STM32F1__
28
+  #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
29
+#endif
30
+
31
+#if HOTENDS > 2 || E_STEPPERS > 2
32
+  #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue."
33
+#endif
34
+
35
+#define BOARD_NAME "MKS Robin nano"
36
+
37
+//
38
+// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
39
+//
40
+#define DISABLE_DEBUG
41
+
42
+//
43
+// Note: MKS Robin board is using SPI2 interface.
44
+//
45
+#define SPI_MODULE 2
46
+
47
+//
48
+// Limit Switches
49
+//
50
+#define X_STOP_PIN        PA15
51
+#define Y_STOP_PIN        PA12
52
+#define Z_MIN_PIN         PA11
53
+#define Z_MAX_PIN         PC4
54
+
55
+//
56
+// Steppers
57
+//
58
+#define X_ENABLE_PIN       PE4
59
+#define X_STEP_PIN         PE3
60
+#define X_DIR_PIN          PE2
61
+
62
+#define Y_ENABLE_PIN       PE1
63
+#define Y_STEP_PIN         PE0
64
+#define Y_DIR_PIN          PB9
65
+
66
+#define Z_ENABLE_PIN       PB8
67
+#define Z_STEP_PIN         PB5
68
+#define Z_DIR_PIN          PB4
69
+
70
+#define E0_ENABLE_PIN      PB3
71
+#define E0_STEP_PIN        PD6
72
+#define E0_DIR_PIN         PD3
73
+
74
+#define E1_ENABLE_PIN      PA3
75
+#define E1_STEP_PIN        PA6
76
+#define E1_DIR_PIN         PA1
77
+
78
+//
79
+// Temperature Sensors
80
+//
81
+#define TEMP_0_PIN         PC1   // TH1
82
+#define TEMP_1_PIN         PC2   // TH2
83
+#define TEMP_BED_PIN       PC0   // TB1
84
+
85
+//
86
+// Heaters / Fans
87
+//
88
+#define HEATER_0_PIN       PC3   // HEATER1
89
+#define HEATER_1_PIN       PB0   // HEATER2
90
+#define HEATER_BED_PIN     PA0   // HOT BED
91
+
92
+#define FAN_PIN            PA1   // FAN
93
+
94
+#define BTN_ENC            PC13  // Pin is not connected. Real pin is needed to enable encoder's push button functionality used by touch screen
95
+
96
+//#define MAX6675_SS_PIN     PE5  // TC1 - CS1
97
+//#define MAX6675_SS_PIN     PE6  // TC2 - CS2
98
+
99
+#define POWER_LOSS_PIN     PA2   // PW_DET
100
+#define PS_ON_PIN          PA3   // PW_OFF
101
+#define FIL_RUNOUT_PIN     PA4   // MT_DET
102
+
103
+#define BEEPER_PIN         PC5
104
+#define LED_PIN            PB2
105
+
106
+/**
107
+ * Note: MKS Robin TFT screens may have different TFT controllers
108
+ * If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization.
109
+ */
110
+#define LCD_RESET_PIN      PF6
111
+#define NO_LCD_REINIT             // Suppress LCD re-initialization
112
+
113
+#define LCD_BACKLIGHT_PIN  PD13
114
+#define FSMC_CS_PIN        PD7   // NE4
115
+#define FSMC_RS_PIN        PD11  // A0
116
+#define TOUCH_CS           PA7
117
+
118
+#define SD_DETECT_PIN      PD12

+ 14
- 0
buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld Прегледај датотеку

@@ -0,0 +1,14 @@
1
+MEMORY
2
+{
3
+  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
4
+  rom (rx)  : ORIGIN = 0x08007000, LENGTH = 512K - 28K
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_nano.py Прегледај датотеку

@@ -0,0 +1,30 @@
1
+Import("env")
2
+
3
+# Relocate firmware from 0x08000000 to 0x08007000
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", "0x08007000"))
8
+env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
9
+
10
+# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.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 +'/Robin_nano.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);

+ 22
- 1
platformio.ini Прегледај датотеку

@@ -377,7 +377,7 @@ lib_ignore    = c1921b4
377 377
   U8glib-HAL
378 378
 
379 379
 #
380
-# MKS Robin nano (STM32F103VET6)
380
+# MKS Robin Mini (STM32F103VET6)
381 381
 #
382 382
 [env:mks_robin_mini]
383 383
 platform      = ststm32
@@ -398,6 +398,27 @@ lib_ignore    = c1921b4
398 398
   TMC26XStepper
399 399
 
400 400
 #
401
+# MKS Robin Nano (STM32F103VET6)
402
+#
403
+[env:mks_robin_nano]
404
+platform      = ststm32
405
+framework     = arduino
406
+board         = genericSTM32F103VE
407
+extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py
408
+build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
409
+  ${common.build_flags} -std=gnu++14
410
+build_unflags = -std=gnu++11
411
+src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
412
+lib_deps      = ${common.lib_deps}
413
+lib_ignore    = c1921b4
414
+  libf3c
415
+  lib066
416
+  Adafruit NeoPixel_ID28
417
+  Adafruit NeoPixel
418
+  libf3e
419
+  TMC26XStepper
420
+
421
+#
401 422
 # JGAurora A5S A1 (STM32F103ZET6)
402 423
 #
403 424
 [env:JGAURORA_A5S_A1]

Loading…
Откажи
Сачувај