Parcourir la source

Tronxy X5SA (V5 / V6 boards) (#18243)

Victor il y a 4 ans
Parent
révision
e2cc966621
Aucun compte lié à l'adresse e-mail de l'auteur

+ 2
- 0
Marlin/src/core/boards.h Voir le fichier

@@ -307,6 +307,8 @@
307 307
 #define BOARD_MKS_ROBIN_E3            4027  // MKS Robin E3 (STM32F103RCT6)
308 308
 #define BOARD_MALYAN_M300             4028  // STM32F070-based delta
309 309
 #define BOARD_CCROBOT_MEEB_3DP        4029  // ccrobot-online.com MEEB_3DP (STM32F103RC)
310
+#define BOARD_CHITU3D_V5              4030  // Chitu3D TronXY X5SA V5 Board
311
+#define BOARD_CHITU3D_V6              4031  // Chitu3D TronXY X5SA V5 Board
310 312
 
311 313
 //
312 314
 // ARM Cortex-M4F

+ 4
- 0
Marlin/src/pins/pins.h Voir le fichier

@@ -538,6 +538,10 @@
538 538
   #include "stm32f1/pins_MKS_ROBIN_E3.h"        // STM32F1                                env:mks_robin_e3
539 539
 #elif MB(CCROBOT_MEEB_3DP)
540 540
   #include "stm32f1/pins_CCROBOT_MEEB_3DP.h"    // STM32F1                                env:STM32F103RC_meeb
541
+#elif MB(CHITU3D_V5)
542
+  #include "stm32f1/pins_CHITU3D_V5.h"          // STM32F1                                env:chitu_f103
543
+#elif MB(CHITU3D_V6)
544
+  #include "stm32f1/pins_CHITU3D_V6.h"          // STM32F1                                env:chitu_f103
541 545
 
542 546
 //
543 547
 // ARM Cortex-M4F

+ 159
- 0
Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h Voir le fichier

@@ -0,0 +1,159 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 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
+#if !defined(__STM32F1__) && !defined(__STM32F4__)
25
+  #error "Oops! Select an STM32F1/4 board in 'Tools > Board.'"
26
+#endif
27
+
28
+/**
29
+ * 2017 Victor Perez Marlin for stm32f1 test
30
+ */
31
+
32
+#define BOARD_INFO_NAME      "Chitu3D V5"
33
+#define DEFAULT_MACHINE_NAME "STM32F103ZET6"
34
+
35
+#define DISABLE_JTAG
36
+
37
+//
38
+// EEPROM
39
+//
40
+#define FLASH_EEPROM_EMULATION
41
+#if ENABLED(FLASH_EEPROM_EMULATION)
42
+  // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
43
+  #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
44
+  #define EEPROM_PAGE_SIZE     (0x800U)     // 2KB, but will use 2x more (4KB)
45
+  #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
46
+#else
47
+  #define MARLIN_EEPROM_SIZE 0x800U         // On SD, Limit to 2KB, require this amount of RAM
48
+#endif
49
+
50
+//
51
+// Limit Switches
52
+//
53
+#define X_STOP_PIN                          PG10
54
+#define Y_STOP_PIN                          PA12
55
+#define Z_STOP_PIN                          PA14
56
+
57
+//
58
+// Steppers
59
+//
60
+#define X_ENABLE_PIN                        PC13
61
+#define X_STEP_PIN                          PE5
62
+#define X_DIR_PIN                           PE6
63
+
64
+#define Y_ENABLE_PIN                        PE4
65
+#define Y_STEP_PIN                          PE2
66
+#define Y_DIR_PIN                           PE3
67
+
68
+#define Z_ENABLE_PIN                        PE1
69
+#define Z_STEP_PIN                          PB9
70
+#define Z_DIR_PIN                           PE0
71
+
72
+#define E0_ENABLE_PIN                       PB8
73
+#define E0_STEP_PIN                         PB4
74
+#define E0_DIR_PIN                          PB5
75
+
76
+#define E1_ENABLE_PIN                       PG8
77
+#define E1_STEP_PIN                         PC7
78
+#define E1_DIR_PIN                          PC6
79
+
80
+//
81
+// Temperature Sensors
82
+//
83
+#define TEMP_0_PIN                          PA1   // TH1
84
+#define TEMP_BED_PIN                        PA0   // TB1
85
+
86
+//
87
+// Heaters
88
+//
89
+#define HEATER_0_PIN                        PG12  // HEATER1
90
+#define HEATER_BED_PIN                      PG11  // HOT BED
91
+
92
+//
93
+// Fans
94
+//
95
+#define CONTROLLER_FAN_PIN                  PD6   // BOARD FAN
96
+#define FAN_PIN                             PG13  // FAN
97
+#define FAN_PIN_2                           PG14
98
+
99
+//
100
+// Misc
101
+//
102
+#define BEEPER_PIN                          PB0
103
+//#define LED_PIN                           -1
104
+//#define POWER_LOSS_PIN                    -1
105
+#define FIL_RUNOUT_PIN                      PA15
106
+
107
+//
108
+// TronXY TFT Support
109
+//
110
+//#define FSMC_GRAPHICAL_TFT
111
+//#define TOUCH_BUTTONS
112
+
113
+#if ENABLED(FSMC_GRAPHICAL_TFT)
114
+  #define FSMC_UPSCALE 3
115
+  #define LCD_FULL_PIXEL_WIDTH 480
116
+  #define LCD_PIXEL_OFFSET_X 48
117
+  #define LCD_FULL_PIXEL_HEIGHT 320
118
+
119
+  #define LCD_RESET_PIN                     PF11
120
+  #define NO_LCD_REINIT
121
+  #define LCD_BACKLIGHT_PIN                 PD13
122
+  #define FSMC_CS_PIN                       PD7
123
+  #define FSMC_RS_PIN                       PD11
124
+
125
+  #define LCD_USE_DMA_FSMC                        // Use DMA transfers to send data to the TFT
126
+  #define FSMC_DMA_DEV                      DMA2
127
+  #define FSMC_DMA_CHANNEL               DMA_CH5
128
+
129
+  #if ENABLED(TOUCH_BUTTONS)
130
+    #define TOUCH_CS_PIN                    PB7   // SPI1_NSS
131
+    #define TOUCH_SCK_PIN                   PA5   // SPI1_SCK
132
+    #define TOUCH_MISO_PIN                  PA6   // SPI1_MISO
133
+    #define TOUCH_MOSI_PIN                  PA7   // SPI1_MOSI
134
+
135
+    #define BUTTON_DELAY_EDIT 50                  // (ms) Button repeat delay for edit screens
136
+    #define BUTTON_DELAY_MENU 250                 // (ms) Button repeat delay for menus
137
+
138
+    #define XPT2046_X_CALIBRATION  -12316
139
+    #define XPT2046_Y_CALIBRATION   8981
140
+    #define XPT2046_X_OFFSET        340
141
+    #define XPT2046_Y_OFFSET        -20
142
+  #endif
143
+#endif
144
+
145
+// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
146
+// We nee to use the SPI2
147
+#define ENABLE_SPI2
148
+#define SCK_PIN                             PB13
149
+#define MISO_PIN                            PB14
150
+#define MOSI_PIN                            PB15
151
+#define SS_PIN                              PB12
152
+
153
+//
154
+// SD Card
155
+//
156
+#define SDIO_SUPPORT
157
+#define SD_DETECT_PIN                       -1    // PF0, but it isn't connected
158
+#define SDIO_CLOCK 4500000
159
+#define SDIO_READ_RETRIES 16

+ 164
- 0
Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h Voir le fichier

@@ -0,0 +1,164 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 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
+#if !defined(__STM32F1__) && !defined(__STM32F4__)
25
+  #error "Oops! Select an STM32F1/4 board in 'Tools > Board.'"
26
+#endif
27
+
28
+/**
29
+ * 2017 Victor Perez Marlin for stm32f1 test
30
+ */
31
+
32
+#define BOARD_INFO_NAME      "Chitu3D"
33
+#define DEFAULT_MACHINE_NAME "STM32F103ZET6"
34
+
35
+#define DISABLE_JTAG
36
+
37
+//
38
+// EEPROM
39
+//
40
+
41
+#if NO_EEPROM_SELECTED
42
+  #define FLASH_EEPROM_EMULATION
43
+#endif
44
+
45
+#if ENABLED(FLASH_EEPROM_EMULATION)
46
+  // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
47
+  #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
48
+  #define EEPROM_PAGE_SIZE     (0x800U)     // 2KB, but will use 2x more (4KB)
49
+  #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
50
+#else
51
+  #define MARLIN_EEPROM_SIZE 0x800U         // On SD, Limit to 2KB, require this amount of RAM
52
+#endif
53
+
54
+//
55
+// Limit Switches
56
+//
57
+#define X_STOP_PIN                          PG10
58
+#define Y_STOP_PIN                          PA12
59
+#define Z_STOP_PIN                          PG9
60
+
61
+//
62
+// Steppers
63
+//
64
+#define X_ENABLE_PIN                        PC13
65
+#define X_STEP_PIN                          PE5
66
+#define X_DIR_PIN                           PE6
67
+
68
+#define Y_ENABLE_PIN                        PE4
69
+#define Y_STEP_PIN                          PE2
70
+#define Y_DIR_PIN                           PE3
71
+
72
+#define Z_ENABLE_PIN                        PE1
73
+#define Z_STEP_PIN                          PB9
74
+#define Z_DIR_PIN                           PE0
75
+
76
+#define E0_ENABLE_PIN                       PB8
77
+#define E0_STEP_PIN                         PB4
78
+#define E0_DIR_PIN                          PB5
79
+
80
+#define E1_ENABLE_PIN                       PG8
81
+#define E1_STEP_PIN                         PC7
82
+#define E1_DIR_PIN                          PC6
83
+
84
+//
85
+// Temperature Sensors
86
+//
87
+#define TEMP_0_PIN                          PA1   // TH1
88
+#define TEMP_BED_PIN                        PA0   // TB1
89
+
90
+//
91
+// Heaters
92
+//
93
+#define HEATER_0_PIN                        PG12  // HEATER1
94
+#define HEATER_BED_PIN                      PG11  // HOT BED
95
+//#define HEATER_BED_INVERTING true
96
+
97
+//
98
+// Fans
99
+//
100
+#define CONTROLLER_FAN_PIN                  PD6   // BOARD FAN
101
+#define FAN_PIN                             PG13  // FAN
102
+#define FAN_PIN_2                           PG14
103
+
104
+//
105
+// Misc
106
+//
107
+#define BEEPER_PIN                          PB0
108
+//#define LED_PIN                           PD3
109
+//#define POWER_LOSS_PIN                    PG2   // PG4 PW_DET
110
+#define FIL_RUNOUT_PIN                      PA15  // MT_DET
111
+
112
+//
113
+// TronXY TFT Support
114
+//
115
+#define FSMC_GRAPHICAL_TFT
116
+#define TOUCH_BUTTONS
117
+
118
+#if ENABLED(FSMC_GRAPHICAL_TFT)
119
+  #define FSMC_UPSCALE 3
120
+  #define LCD_FULL_PIXEL_WIDTH 480
121
+  #define LCD_PIXEL_OFFSET_X 48
122
+  #define LCD_FULL_PIXEL_HEIGHT 320
123
+
124
+  #define LCD_RESET_PIN                     PF11
125
+  #define NO_LCD_REINIT
126
+  #define LCD_BACKLIGHT_PIN                 PD13
127
+  #define FSMC_CS_PIN                       PD7
128
+  #define FSMC_RS_PIN                       PD11
129
+
130
+  #define LCD_USE_DMA_FSMC                        // Use DMA transfers to send data to the TFT
131
+  #define FSMC_DMA_DEV                      DMA2
132
+  #define FSMC_DMA_CHANNEL               DMA_CH5
133
+
134
+  #if ENABLED(TOUCH_BUTTONS)
135
+    #define TOUCH_CS_PIN                    PB7   // SPI1_NSS
136
+    #define TOUCH_SCK_PIN                   PA5   // SPI1_SCK
137
+    #define TOUCH_MISO_PIN                  PA6   // SPI1_MISO
138
+    #define TOUCH_MOSI_PIN                  PA7   // SPI1_MOSI
139
+
140
+    #define BUTTON_DELAY_EDIT 50                  // (ms) Button repeat delay for edit screens
141
+    #define BUTTON_DELAY_MENU 250                 // (ms) Button repeat delay for menus
142
+
143
+    #define XPT2046_X_CALIBRATION  -12316
144
+    #define XPT2046_Y_CALIBRATION   8981
145
+    #define XPT2046_X_OFFSET        340
146
+    #define XPT2046_Y_OFFSET        -20
147
+  #endif
148
+#endif
149
+
150
+// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
151
+// so SPI2 is required.
152
+#define ENABLE_SPI2
153
+#define SCK_PIN                             PB13
154
+#define MISO_PIN                            PB14
155
+#define MOSI_PIN                            PB15
156
+#define SS_PIN                              PB12
157
+
158
+//
159
+// SD Card
160
+//
161
+#define SDIO_SUPPORT
162
+#define SD_DETECT_PIN                       -1    // PF0, but it isn't connected
163
+#define SDIO_CLOCK 4500000
164
+#define SDIO_READ_RETRIES 16

+ 2
- 2
buildroot/share/PlatformIO/ldscripts/chitu_f103.ld Voir le fichier

@@ -1,7 +1,7 @@
1 1
 MEMORY
2 2
 {
3
-  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
4
-  rom (rx)  : ORIGIN = 0x08008800, LENGTH = 512K - 32K
3
+  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 60K
4
+  rom (rx)  : ORIGIN = 0x08008800, LENGTH = 512K - 34K
5 5
 }
6 6
 
7 7
 /* Provide memory region aliases for common.inc */

+ 10
- 8
buildroot/share/PlatformIO/scripts/chitu_crypt.py Voir le fichier

@@ -1,12 +1,12 @@
1
+Import("env")
1 2
 import os
3
+import random
2 4
 import struct
3
-Import("env")
5
+import uuid
4 6
 
5 7
 # Relocate firmware from 0x08000000 to 0x08008800
6
-for define in env['CPPDEFINES']:
7
-    if define[0] == "VECT_TAB_ADDR":
8
-        env['CPPDEFINES'].remove(define)
9
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x8008800"))
8
+env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000"))
9
+env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08008800"))
10 10
 
11 11
 custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/chitu_f103.ld")
12 12
 for i, flag in enumerate(env["LINKFLAGS"]):
@@ -73,7 +73,9 @@ def encrypt_file(input, output_file, file_length):
73 73
     input_file = bytearray(input.read())
74 74
     block_size = 0x800
75 75
     key_length = 0x18
76
-    file_key = 0xDAB27F94
76
+
77
+    uid_value = uuid.uuid4()
78
+    file_key = int(uid_value.hex[0:8], 16)
77 79
 
78 80
     xor_crc = 0xef3d4323;
79 81
 
@@ -87,11 +89,11 @@ def encrypt_file(input, output_file, file_length):
87 89
     # encrypt the contents using a known file header key
88 90
 
89 91
     # write the file_key
90
-    output_file.write(struct.pack(">I", 0x947FB2DA))
92
+    output_file.write(struct.pack("<I", file_key))
91 93
 
92 94
     #TODO - how to enforce that the firmware aligns to block boundaries?
93 95
     block_count = int(len(input_file) / block_size)
94
-    print "Block Count is ", block_count
96
+    print ("Block Count is ", block_count)
95 97
     for block_number in range(0, block_count):
96 98
         block_offset = (block_number * block_size)
97 99
         block_end = block_offset + block_size

+ 1
- 1
platformio.ini Voir le fichier

@@ -589,7 +589,7 @@ lib_ignore  = LiquidCrystal, LiquidTWI2, Adafruit NeoPixel, TMCStepper, U8glib-H
589 589
 platform      = ${common_stm32f1.platform}
590 590
 extends       = common_stm32f1
591 591
 board         = genericSTM32F103ZE
592
-extra_scripts = buildroot/share/PlatformIO/scripts/chitu_crypt.py
592
+#extra_scripts = buildroot/share/PlatformIO/scripts/chitu_crypt.py
593 593
 build_flags   = ${common_stm32f1.build_flags}
594 594
   -DSTM32F1xx -DSTM32_XL_DENSITY
595 595
 build_unflags = ${common_stm32f1.build_unflags}

Chargement…
Annuler
Enregistrer