Browse Source

New board STM32F407 (#14994)

chzj333 4 years ago
parent
commit
0b47558a09

+ 14
- 9
Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp View File

@@ -22,7 +22,6 @@
22 22
  */
23 23
 #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
24 24
 
25
-
26 25
 #include "../../inc/MarlinConfig.h"
27 26
 
28 27
 #include <SPI.h>
@@ -73,16 +72,22 @@ void spiInit(uint8_t spiRate) {
73 72
   // Use datarates Marlin uses
74 73
   uint32_t clock;
75 74
   switch (spiRate) {
76
-  case SPI_FULL_SPEED:    clock = 20000000; break; // 13.9mhz=20000000  6.75mhz=10000000  3.38mhz=5000000  .833mhz=1000000
77
-  case SPI_HALF_SPEED:    clock =  5000000; break;
78
-  case SPI_QUARTER_SPEED: clock =  2500000; break;
79
-  case SPI_EIGHTH_SPEED:  clock =  1250000; break;
80
-  case SPI_SPEED_5:       clock =   625000; break;
81
-  case SPI_SPEED_6:       clock =   300000; break;
82
-  default:
83
-    clock = 4000000; // Default from the SPI library
75
+    case SPI_FULL_SPEED:    clock = 20000000; break; // 13.9mhz=20000000  6.75mhz=10000000  3.38mhz=5000000  .833mhz=1000000
76
+    case SPI_HALF_SPEED:    clock =  5000000; break;
77
+    case SPI_QUARTER_SPEED: clock =  2500000; break;
78
+    case SPI_EIGHTH_SPEED:  clock =  1250000; break;
79
+    case SPI_SPEED_5:       clock =   625000; break;
80
+    case SPI_SPEED_6:       clock =   300000; break;
81
+    default:
82
+      clock = 4000000; // Default from the SPI library
84 83
   }
85 84
   spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
85
+  #if defined(MISO_PIN) && defined(SDSS) && defined(MOSI_PIN) && defined(SCK_PIN)
86
+    SPI.setMISO(MISO_PIN);
87
+    SPI.setSSEL(SDSS);
88
+    SPI.setMOSI(MOSI_PIN);
89
+    SPI.setSCLK(SCK_PIN);
90
+  #endif
86 91
   SPI.begin();
87 92
 }
88 93
 

+ 1
- 0
Marlin/src/core/boards.h View File

@@ -290,6 +290,7 @@
290 290
 #define BOARD_BLACK_STM32F407ZE       4205  // BLACK_STM32F407ZE
291 291
 #define BOARD_STEVAL                  4206  // STEVAL-3DP001V1 3D PRINTER BOARD
292 292
 #define BOARD_BIGTREE_SKR_PRO_V1_1    4207  // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
293
+#define BOARD_BIGTREE_BTT002_V1_0     4208  // BigTreeTech BTT002 v1.0 (STM32F407VE)
293 294
 
294 295
 //
295 296
 // ARM Cortex M7

+ 2
- 0
Marlin/src/pins/pins.h View File

@@ -502,6 +502,8 @@
502 502
   #include "stm32/pins_STEVAL.h"                // STM32F4                                env:STM32F4
503 503
 #elif MB(BIGTREE_SKR_PRO_V1_1)
504 504
   #include "stm32/pins_BIGTREE_SKR_PRO_V1.1.h"  // STM32F4                                env:BIGTREE_SKR_PRO
505
+#elif MB(BIGTREE_BTT002_V1_0)
506
+  #include "stm32/pins_BIGTREE_BTT002_V1.0.h"   // STM32F4                                env:BIGTREE_BTTOO2
505 507
 
506 508
 //
507 509
 // ARM Cortex M7

+ 254
- 0
Marlin/src/pins/stm32/pins_BIGTREE_BTT002_V1.0.h View File

@@ -0,0 +1,254 @@
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_STM32F4
25
+  #error "Oops! Select an STM32F4 board in 'Tools > Board.'"
26
+#elif HOTENDS > 3 || E_STEPPERS > 3
27
+  #error "BIGTREE SKR Pro V1.1 supports up to 3 hotends / E-steppers."
28
+#endif
29
+
30
+#define BOARD_NAME "BIGTREE Btt002 1.0"
31
+
32
+#define SRAM_EEPROM_EMULATION
33
+
34
+// Ignore temp readings during development.
35
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
36
+
37
+//
38
+// Servos  
39
+//
40
+#define SERVO0_PIN         PC3
41
+
42
+//
43
+// Limit Switches
44
+//
45
+#define X_MIN_PIN          PD3
46
+#define X_MAX_PIN          PD3
47
+#define Y_MIN_PIN          PD2
48
+#define Y_MAX_PIN          PD2
49
+#define Z_MIN_PIN          PD1
50
+#define Z_MAX_PIN          PD1
51
+
52
+//
53
+// Z Probe must be this pins  ##
54
+//
55
+#ifndef Z_MIN_PROBE_PIN
56
+  #define Z_MIN_PROBE_PIN  PD1
57
+#endif
58
+
59
+//
60
+// Steppers
61
+//
62
+#define X_STEP_PIN         PA9
63
+#define X_DIR_PIN          PA10
64
+#define X_ENABLE_PIN       PA8
65
+#ifndef X_CS_PIN
66
+  #define X_CS_PIN         PE2
67
+#endif
68
+
69
+#define Y_STEP_PIN         PC8
70
+#define Y_DIR_PIN          PC9
71
+#define Y_ENABLE_PIN       PC7
72
+ #ifndef Y_CS_PIN
73
+  #define Y_CS_PIN         PE3
74
+#endif
75
+
76
+#define Z_STEP_PIN         PD15
77
+#define Z_DIR_PIN          PC6
78
+#define Z_ENABLE_PIN       PD14
79
+#ifndef Z_CS_PIN
80
+  #define Z_CS_PIN         PE4
81
+#endif
82
+
83
+#define E0_STEP_PIN        PD12
84
+#define E0_DIR_PIN         PD13
85
+#define E0_ENABLE_PIN      PD11
86
+#ifndef E0_CS_PIN
87
+  #define E0_CS_PIN        PD7
88
+#endif
89
+
90
+/*
91
+//SKR_PRO_V1.1 
92
+#define E1_STEP_PIN        PD15
93
+#define E1_DIR_PIN         PE7
94
+#define E1_ENABLE_PIN      PA3
95
+#ifndef E1_CS_PIN
96
+  #define E1_CS_PIN        PG15
97
+#endif
98
+
99
+#define E2_STEP_PIN        PD13
100
+#define E2_DIR_PIN         PG9
101
+#define E2_ENABLE_PIN      PF0
102
+#ifndef E2_CS_PIN
103
+  #define E2_CS_PIN        PG12
104
+#endif
105
+*/
106
+//
107
+// Software SPI pins for TMC2130 stepper drivers
108
+//
109
+#if ENABLED(TMC_USE_SW_SPI)
110
+  #ifndef TMC_SW_MOSI
111
+    #define TMC_SW_MOSI    PB15
112
+  #endif
113
+  #ifndef TMC_SW_MISO
114
+    #define TMC_SW_MISO    PB14
115
+  #endif
116
+  #ifndef TMC_SW_SCK
117
+    #define TMC_SW_SCK     PB13
118
+  #endif
119
+#endif
120
+
121
+#if HAS_TMC220x
122
+  /**
123
+   * TMC2208/TMC2209 stepper drivers
124
+   *
125
+   * Hardware serial communication ports.
126
+   * If undefined software serial is used according to the pins below
127
+   */
128
+  //#define X_HARDWARE_SERIAL Serial1
129
+  //#define X2_HARDWARE_SERIAL Serial1
130
+  //#define Y_HARDWARE_SERIAL  Serial1
131
+  //#define Y2_HARDWARE_SERIAL Serial1
132
+  //#define Z_HARDWARE_SERIAL  Serial1
133
+  //#define Z2_HARDWARE_SERIAL Serial1
134
+  //#define E0_HARDWARE_SERIAL Serial1
135
+  //#define E1_HARDWARE_SERIAL Serial1
136
+  //#define E2_HARDWARE_SERIAL Serial1
137
+  //#define E3_HARDWARE_SERIAL Serial1
138
+  //#define E4_HARDWARE_SERIAL Serial1
139
+
140
+  //
141
+  // Software serial  ##
142
+  //
143
+  #define X_SERIAL_TX_PIN  PE2
144
+  #define X_SERIAL_RX_PIN  PE2
145
+
146
+  #define Y_SERIAL_TX_PIN  PE3
147
+  #define Y_SERIAL_RX_PIN  PE3
148
+
149
+  #define Z_SERIAL_TX_PIN  PE4
150
+  #define Z_SERIAL_RX_PIN  PE4
151
+
152
+  #define E0_SERIAL_TX_PIN PD7
153
+  #define E0_SERIAL_RX_PIN PD7
154
+
155
+  //#define E1_SERIAL_TX_PIN PD1
156
+  //#define E1_SERIAL_RX_PIN PD1
157
+
158
+  //#define E2_SERIAL_TX_PIN PD6
159
+  //#define E2_SERIAL_RX_PIN PD6
160
+#endif
161
+
162
+//
163
+// Temperature Sensors
164
+//
165
+#define TEMP_0_PIN         PA2   // T1 <-> E0
166
+#define TEMP_1_PIN         PA0   // T2 <-> E1
167
+//#define TEMP_2_PIN         PC2   // T3 <-> E2  SKR_PRO
168
+#define TEMP_BED_PIN       PA1   // T0 <-> Bed
169
+
170
+//
171
+// Heaters / Fans
172
+//
173
+#define HEATER_0_PIN       PE6  // Heater0
174
+//#define HEATER_1_PIN       PD14  // Heater1
175
+//#define HEATER_2_PIN       PB0   // Heater1
176
+#define HEATER_BED_PIN     PE5   // Hotbed
177
+#define FAN_PIN            PB9   // Fan0
178
+#define FAN1_PIN           PB8   // Fan1
179
+//#define FAN2_PIN           PE6   // Fan2
180
+
181
+// HAL SPI pins group
182
+#define SCK_PIN            PA5   // SPI SCLK
183
+#define MYSSEL             PA4   // SPI SSEL
184
+#define MISO_PIN           PA6   // SPI MISO
185
+#define MOSI_PIN           PA7   // SPI MOSI
186
+
187
+//
188
+// Misc. Functions
189
+//
190
+#define SDSS               PA4
191
+
192
+/**
193
+ * -------------------------------------SKR_MK3-----------------------------------------------
194
+ *               _____                                             _____                      |
195
+ *          PA3 | · · | GND                                    5V | · · | GND                 |
196
+ *       NRESET | · · | PC4(SD_DET)                 (LCD_D7) PE13 | · · | PE12  (LCD_D6)      | 
197
+ *   (MOSI)PA7  | · · | PB0(BTN_EN2)                (LCD_D5) PE11 | · · | PE10  (LCD_D4)      |
198
+ *  (SD_SS)PA4  | · · | PC5(BTN_EN1)                (LCD_RS) PE8  | · · | PE9   (LCD_EN)      |
199
+ *    (SCK)PA5  | · · | PA6(MISO)                  (BTN_ENC) PB1  | · · | PE7   (BEEPER)      |
200
+ *                ̄ ̄                                                ̄ ̄                       |
201
+ *               EXP2                                              EXP1                       |
202
+ * ---------------------------------------------------------------------------------------------
203
+ */
204
+//
205
+// LCDs and Controllers
206
+//
207
+#if HAS_SPI_LCD
208
+  #define BEEPER_PIN       PE7
209
+  #define BTN_ENC          PB1
210
+
211
+  #if ENABLED(CR10_STOCKDISPLAY)
212
+    #define LCD_PINS_RS    PE12
213
+
214
+    #define BTN_EN1        PE9
215
+    #define BTN_EN2        PE10
216
+
217
+    #define LCD_PINS_ENABLE PE13
218
+    #define LCD_PINS_D4    PE11
219
+
220
+  #else
221
+
222
+    #define LCD_PINS_RS    PE8
223
+
224
+    #define BTN_EN1        PC5
225
+    #define BTN_EN2        PB0
226
+    #define SD_DETECT_PIN  PC4
227
+
228
+    #define LCD_SDSS       PA4
229
+
230
+    #define LCD_PINS_ENABLE PE9 
231
+    #define LCD_PINS_D4    PE10
232
+
233
+    #if ENABLED(ULTIPANEL)
234
+      #define LCD_PINS_D5  PE11
235
+      #define LCD_PINS_D6  PE12
236
+      #define LCD_PINS_D7  PE13
237
+    #endif
238
+
239
+  #endif
240
+
241
+  // Alter timing for graphical display
242
+  #if HAS_GRAPHICAL_LCD
243
+    #ifndef ST7920_DELAY_1
244
+      #define ST7920_DELAY_1 DELAY_NS(96)
245
+    #endif
246
+    #ifndef ST7920_DELAY_2
247
+      #define ST7920_DELAY_2 DELAY_NS(48)
248
+    #endif
249
+    #ifndef ST7920_DELAY_3
250
+      #define ST7920_DELAY_3 DELAY_NS(600)
251
+    #endif
252
+  #endif
253
+
254
+#endif // HAS_SPI_LCD

+ 65
- 0
buildroot/share/PlatformIO/boards/BigTree_Btt002.json View File

@@ -0,0 +1,65 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m4",
5
+    "extra_flags": "-DSTM32F407xx",
6
+    "f_cpu": "168000000L",
7
+    "hwids": [
8
+      [
9
+        "0x1EAF",
10
+        "0x0003"
11
+      ],
12
+      [
13
+        "0x0483",
14
+        "0x3748"
15
+      ]
16
+    ],
17
+    "ldscript": "stm32f407xg.ld",
18
+    "mcu": "stm32f407vet6",
19
+    "variant": "BIGTREE_GENERIC_STM32F407_5X"
20
+  },
21
+  "debug": {
22
+    "jlink_device": "STM32F407VE",
23
+    "openocd_target": "stm32f4x",
24
+    "svd_path": "STM32F40x.svd",
25
+    "tools": {
26
+      "stlink": {
27
+        "server": {
28
+          "arguments": [
29
+            "-f",
30
+            "scripts/interface/stlink.cfg",
31
+            "-c",
32
+            "transport select hla_swd",
33
+            "-f",
34
+            "scripts/target/stm32f4x.cfg",
35
+            "-c",
36
+            "reset_config none"
37
+          ],
38
+          "executable": "bin/openocd",
39
+          "package": "tool-openocd"
40
+        }
41
+      }
42
+    }
43
+  },
44
+  "frameworks": [
45
+    "arduino",
46
+    "stm32cube"
47
+  ],
48
+  "name": "STM32F407VE (64k RAM. 512k Flash)",
49
+  "upload": {
50
+    "disable_flushing": false,
51
+    "maximum_ram_size": 65536,
52
+    "maximum_size": 524288,
53
+    "protocol": "stlink",
54
+    "protocols": [
55
+      "stlink",
56
+      "dfu",
57
+      "jlink"
58
+    ],
59
+    "require_upload_port": true,
60
+    "use_1200bps_touch": false,
61
+    "wait_for_upload_port": false
62
+  },
63
+  "url": "http://www.st.com/en/microcontrollers/stm32f407zg.html",
64
+  "vendor": "Generic"
65
+}

+ 22
- 2
platformio.ini View File

@@ -478,6 +478,26 @@ src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32>
478 478
 monitor_speed = 250000
479 479
 
480 480
 #
481
+# BIGTREE_SKR_BTT002 (STM32F407VET6 ARM Cortex-M4)
482
+#
483
+[env:BIGTREE_BTT002]
484
+platform = ststm32@5.4.3
485
+framework = arduino
486
+board = BigTree_BTT002
487
+extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
488
+build_flags = ${common.build_flags}
489
+  -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407VE\"
490
+  -DTARGET_STM32F4 -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000
491
+  -DHAVE_HWSERIAL2
492
+  -DHAVE_HWSERIAL3
493
+  -DPIN_SERIAL2_RX=PD_6
494
+  -DPIN_SERIAL2_TX=PD_5
495
+lib_deps = ${common.lib_deps}
496
+lib_ignore = Adafruit NeoPixel, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster
497
+src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32>
498
+monitor_speed = 250000
499
+
500
+#
481 501
 # Teensy 3.1 / 3.2 (ARM Cortex-M4)
482 502
 #
483 503
 [env:teensy31]
@@ -516,7 +536,7 @@ build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py -DMCU_ST
516 536
   -DDEBUG_LEVEL=0
517 537
 src_filter  = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
518 538
 #-<frameworks>
519
-lib_ignore  = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, TMC26XStepper, U8glib-HAL
539
+lib_ignore  = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL
520 540
 
521 541
 #
522 542
 # Espressif ESP32
@@ -531,7 +551,7 @@ upload_port = /dev/ttyUSB0
531 551
 lib_deps =
532 552
   AsyncTCP=https://github.com/me-no-dev/AsyncTCP/archive/master.zip
533 553
   ESPAsyncWebServer=https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip
534
-lib_ignore  = TMC26XStepper, LiquidCrystal, LiquidTWI2, SailfishLCD, SailfishRGB_LED
554
+lib_ignore  = LiquidCrystal, LiquidTWI2, SailfishLCD, SailfishRGB_LED
535 555
 src_filter  = ${common.default_src_filter} +<src/HAL/HAL_ESP32>
536 556
 
537 557
 #

Loading…
Cancel
Save