Przeglądaj źródła

MKS Robin Mini Board Support (#14366)

thisiskeithb 5 lat temu
rodzic
commit
a4aa3621c0

+ 1
- 0
Marlin/src/core/boards.h Wyświetl plik

@@ -247,6 +247,7 @@
247 247
 #define BOARD_GTM32_PRO_VB            1805  // STM32f103VET6 controller
248 248
 #define BOARD_MORPHEUS                1806  // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller
249 249
 #define BOARD_MKS_ROBIN               1808  // MKS Robin / STM32F103ZET6
250
+#define BOARD_MKS_ROBIN_MINI          1813  // MKS Robin Mini / STM32F103VET6
250 251
 #define BOARD_BIGTREE_SKR_MINI_V1_1   1814  // STM32F103RC
251 252
 #define BOARD_JGAURORA_A5S_A1         1820  // JGAurora A5S A1 / STM32F103ZET6
252 253
 

+ 6
- 2
Marlin/src/lcd/ultralcd.cpp Wyświetl plik

@@ -521,7 +521,9 @@ void MarlinUI::status_screen() {
521 521
         next_filament_display = millis() + 5000UL;  // Show status message for 5s
522 522
       #endif
523 523
       goto_screen(menu_main);
524
-      init_lcd(); // May revive the LCD if static electricity killed it
524
+      #if DISABLED(NO_LCD_REINIT)
525
+        init_lcd(); // May revive the LCD if static electricity killed it
526
+      #endif
525 527
       return;
526 528
     }
527 529
 
@@ -793,7 +795,9 @@ void MarlinUI::update() {
793 795
           }
794 796
         }
795 797
 
796
-        init_lcd(); // May revive the LCD if static electricity killed it
798
+        #if DISABLED(NO_LCD_REINIT)
799
+          init_lcd(); // May revive the LCD if static electricity killed it
800
+        #endif
797 801
 
798 802
       #endif
799 803
 

+ 2
- 0
Marlin/src/pins/pins.h Wyświetl plik

@@ -430,6 +430,8 @@
430 430
   #include "pins_MORPHEUS.h"          // STM32F1                                    env:STM32F1
431 431
 #elif MB(MKS_ROBIN)
432 432
   #include "pins_MKS_ROBIN.h"         // STM32F1                                    env:mks_robin
433
+#elif MB(MKS_ROBIN_MINI)
434
+  #include "pins_MKS_ROBIN_MINI.h"    // STM32F1                                    env:mks_robin_mini
433 435
 #elif MB(JGAURORA_A5S_A1)
434 436
   #include "pins_JGAURORA_A5S_A1.h"   // STM32F1                                    env:JGAURORA_A5S_A1
435 437
 

+ 133
- 0
Marlin/src/pins/pins_MKS_ROBIN_MINI.h Wyświetl plik

@@ -0,0 +1,133 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 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 MINI (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 > 1 || E_STEPPERS > 1
32
+  #error "MKS Robin mini supports up to 1 hotends / E-steppers. Comment out this line to continue."
33
+#endif
34
+
35
+#define BOARD_NAME "MKS Robin mini"
36
+
37
+//
38
+// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
39
+//
40
+#define DISABLE_DEBUG
41
+
42
+//
43
+// Note: MKS Robin mini board is using SPI2 interface.
44
+//
45
+#define SPI_MODULE 2
46
+
47
+//
48
+// Limit Switches
49
+//
50
+#define X_MIN_PIN          PA15
51
+#define X_MAX_PIN          PA15
52
+#define Y_MIN_PIN          PA12
53
+#define Y_MAX_PIN          PA12
54
+#define Z_MIN_PIN          PA11
55
+#define Z_MAX_PIN          PC4
56
+
57
+//
58
+// Steppers
59
+//
60
+#define X_ENABLE_PIN       PE4
61
+#define X_STEP_PIN         PE3
62
+#define X_DIR_PIN          PE2
63
+
64
+#define Y_ENABLE_PIN       PE1
65
+#define Y_STEP_PIN         PE0
66
+#define Y_DIR_PIN          PB9
67
+
68
+#define Z_ENABLE_PIN       PB8
69
+#define Z_STEP_PIN         PB5
70
+#define Z_DIR_PIN          PB4
71
+
72
+#define E0_ENABLE_PIN      PB3
73
+#define E0_STEP_PIN        PD6
74
+#define E0_DIR_PIN         PD3
75
+
76
+//
77
+// Temperature Sensors
78
+//
79
+#define TEMP_0_PIN         PC1   // TH1
80
+//#define TEMP_1_PIN         PC2   // TH2
81
+#define TEMP_BED_PIN       PC0   // TB1
82
+
83
+//
84
+// Heaters / Fans
85
+//
86
+#define HEATER_0_PIN       PC3   // HEATER1
87
+//#define HEATER_1_PIN       PA6   // HEATER2
88
+#define HEATER_BED_PIN     PA0   // HOT BED
89
+
90
+#define FAN_PIN            PB1   // FAN
91
+
92
+#define BTN_ENC            PB3   // Pin is not connected. Real pin is needed to enable encoder's push button functionality used by touch screen
93
+
94
+//#define MAX6675_SS_PIN     PE5  // TC1 - CS1
95
+//#define MAX6675_SS_PIN     PE6  // TC2 - CS2
96
+
97
+#define POWER_LOSS_PIN     PA2   // PW_DET
98
+#define PS_ON_PIN          PA3   // PW_OFF
99
+#define FIL_RUNOUT_PIN     PF11  // MT_DET
100
+
101
+#define BEEPER_PIN         PC5
102
+//#define LED_PIN            PB2
103
+
104
+/**
105
+ * Note: MKS Robin TFT screens may have different TFT controllers
106
+ * If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization.
107
+ */
108
+#define LCD_RESET_PIN      PF6
109
+#define NO_LCD_REINIT             // Suppress LCD re-initialization
110
+
111
+#define LCD_BACKLIGHT_PIN  PD13
112
+#define FSMC_CS_PIN        PD7    // NE4
113
+#define FSMC_RS_PIN        PD11   // A0
114
+#define TOUCH_CS           PC2
115
+
116
+#define SD_DETECT_PIN      PD12
117
+
118
+// Motor current PWM pins
119
+#define MOTOR_CURRENT_PWM_XY_PIN   PA6
120
+#define MOTOR_CURRENT_PWM_Z_PIN    PA7
121
+#define MOTOR_CURRENT_PWM_E_PIN    PB0
122
+#define MOTOR_CURRENT_PWM_RANGE    65535 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp
123
+#define DEFAULT_PWM_MOTOR_CURRENT  { 1030, 1030, 1030 } // 1.05Amp per driver, here is XY, Z and E. This values determined empirically.
124
+
125
+// This is a kind of workaround in case native marlin "digipot" interface won't work.
126
+// Required to enable related code in STM32F1/HAL.cpp
127
+//#ifndef MKS_ROBIN_MINI_VREF_PWM
128
+//  #define MKS_ROBIN_MINI_VREF_PWM
129
+//#endif
130
+
131
+//#define VREF_XY_PIN        PA6
132
+//#define VREF_Z_PIN         PA7
133
+//#define VREF_E1_PIN        PB0

+ 14
- 0
buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld Wyświetl plik

@@ -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_mini.py Wyświetl plik

@@ -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_mini.ld")
9
+
10
+# Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.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_mini.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
- 3
platformio.ini Wyświetl plik

@@ -284,7 +284,6 @@ board         = genericSTM32F103RC
284 284
 extra_scripts = buildroot/share/PlatformIO/scripts/STM32F1_SKR_MINI.py
285 285
 build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
286 286
   ${common.build_flags} -std=gnu++14
287
-  -g
288 287
 build_unflags = -std=gnu++11
289 288
 lib_deps      = ${common.lib_deps}
290 289
 lib_ignore    = U8glib-HAL
@@ -337,7 +336,6 @@ board         = genericSTM32F103ZE
337 336
 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py
338 337
 build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
339 338
   ${common.build_flags} -std=gnu++14
340
-  -DSTM32_XL_DENSITY
341 339
 build_unflags = -std=gnu++11
342 340
 src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
343 341
 lib_deps      = ${common.lib_deps}
@@ -351,6 +349,27 @@ lib_ignore    = c1921b4
351 349
   U8glib-HAL
352 350
 
353 351
 #
352
+# MKS Robin nano (STM32F103VET6)
353
+#
354
+[env:mks_robin_mini]
355
+platform      = ststm32
356
+framework     = arduino
357
+board         = genericSTM32F103VE
358
+extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_mini.py
359
+build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
360
+  ${common.build_flags} -std=gnu++14
361
+build_unflags = -std=gnu++11
362
+src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
363
+lib_deps      = ${common.lib_deps}
364
+lib_ignore    = c1921b4
365
+  libf3c
366
+  lib066
367
+  Adafruit NeoPixel_ID28
368
+  Adafruit NeoPixel
369
+  libf3e
370
+  TMC26XStepper
371
+
372
+#
354 373
 # JGAurora A5S A1 (STM32F103ZET6)
355 374
 #
356 375
 [env:JGAURORA_A5S_A1]
@@ -359,7 +378,7 @@ framework     = arduino
359 378
 board         = genericSTM32F103ZE
360 379
 extra_scripts = buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py
361 380
 build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
362
-  ${common.build_flags} -DSTM32_XL_DENSITY
381
+  ${common.build_flags}
363 382
 src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
364 383
 lib_deps      = ${common.lib_deps}
365 384
 lib_ignore    = c1921b4

Ładowanie…
Anuluj
Zapisz