Browse Source

✨ BTT SKR Mini E3 V3.0.1 (#24722)

ellensp 2 years ago
parent
commit
3c449b220f
No account linked to committer's email address

+ 40
- 39
Marlin/src/core/boards.h View File

@@ -329,45 +329,46 @@
329 329
 #define BOARD_BTT_SKR_MINI_E3_V1_2    4025  // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
330 330
 #define BOARD_BTT_SKR_MINI_E3_V2_0    4026  // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC / STM32F103RE)
331 331
 #define BOARD_BTT_SKR_MINI_E3_V3_0    4027  // BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RE)
332
-#define BOARD_BTT_SKR_MINI_MZ_V1_0    4028  // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
333
-#define BOARD_BTT_SKR_E3_DIP          4029  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
334
-#define BOARD_BTT_SKR_CR6             4030  // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
335
-#define BOARD_JGAURORA_A5S_A1         4031  // JGAurora A5S A1 (STM32F103ZE)
336
-#define BOARD_FYSETC_AIO_II           4032  // FYSETC AIO_II (STM32F103RC)
337
-#define BOARD_FYSETC_CHEETAH          4033  // FYSETC Cheetah (STM32F103RC)
338
-#define BOARD_FYSETC_CHEETAH_V12      4034  // FYSETC Cheetah V1.2 (STM32F103RC)
339
-#define BOARD_LONGER3D_LK             4035  // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE)
340
-#define BOARD_CCROBOT_MEEB_3DP        4036  // ccrobot-online.com MEEB_3DP (STM32F103RC)
341
-#define BOARD_CHITU3D_V5              4037  // Chitu3D TronXY X5SA V5 Board (STM32F103ZE)
342
-#define BOARD_CHITU3D_V6              4038  // Chitu3D TronXY X5SA V6 Board (STM32F103ZE)
343
-#define BOARD_CHITU3D_V9              4039  // Chitu3D TronXY X5SA V9 Board (STM32F103ZE)
344
-#define BOARD_CREALITY_V4             4040  // Creality v4.x (STM32F103RC / STM32F103RE)
345
-#define BOARD_CREALITY_V422           4041  // Creality v4.2.2 (STM32F103RC / STM32F103RE)
346
-#define BOARD_CREALITY_V423           4042  // Creality v4.2.3 (STM32F103RC / STM32F103RE)
347
-#define BOARD_CREALITY_V425           4043  // Creality v4.2.5 (STM32F103RC / STM32F103RE)
348
-#define BOARD_CREALITY_V427           4044  // Creality v4.2.7 (STM32F103RC / STM32F103RE)
349
-#define BOARD_CREALITY_V4210          4045  // Creality v4.2.10 (STM32F103RC / STM32F103RE) as found in the CR-30
350
-#define BOARD_CREALITY_V431           4046  // Creality v4.3.1 (STM32F103RC / STM32F103RE)
351
-#define BOARD_CREALITY_V431_A         4047  // Creality v4.3.1a (STM32F103RC / STM32F103RE)
352
-#define BOARD_CREALITY_V431_B         4048  // Creality v4.3.1b (STM32F103RC / STM32F103RE)
353
-#define BOARD_CREALITY_V431_C         4049  // Creality v4.3.1c (STM32F103RC / STM32F103RE)
354
-#define BOARD_CREALITY_V431_D         4050  // Creality v4.3.1d (STM32F103RC / STM32F103RE)
355
-#define BOARD_CREALITY_V452           4051  // Creality v4.5.2 (STM32F103RC / STM32F103RE)
356
-#define BOARD_CREALITY_V453           4052  // Creality v4.5.3 (STM32F103RC / STM32F103RE)
357
-#define BOARD_CREALITY_V24S1          4053  // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender-7
358
-#define BOARD_CREALITY_V24S1_301      4054  // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) v301 as found in the Ender-3 S1
359
-#define BOARD_CREALITY_V25S1          4055  // Creality v2.5.S1 (STM32F103RE) as found in the CR-10 Smart Pro
360
-#define BOARD_TRIGORILLA_PRO          4056  // Trigorilla Pro (STM32F103ZE)
361
-#define BOARD_FLY_MINI                4057  // FLYmaker FLY MINI (STM32F103RC)
362
-#define BOARD_FLSUN_HISPEED           4058  // FLSUN HiSpeedV1 (STM32F103VE)
363
-#define BOARD_BEAST                   4059  // STM32F103RE Libmaple-based controller
364
-#define BOARD_MINGDA_MPX_ARM_MINI     4060  // STM32F103ZE Mingda MD-16
365
-#define BOARD_GTM32_PRO_VD            4061  // STM32F103VE controller
366
-#define BOARD_ZONESTAR_ZM3E2          4062  // Zonestar ZM3E2    (STM32F103RC)
367
-#define BOARD_ZONESTAR_ZM3E4          4063  // Zonestar ZM3E4 V1 (STM32F103VC)
368
-#define BOARD_ZONESTAR_ZM3E4V2        4064  // Zonestar ZM3E4 V2 (STM32F103VC)
369
-#define BOARD_ERYONE_ERY32_MINI       4065  // Eryone Ery32 mini (STM32F103VE)
370
-#define BOARD_PANDA_PI_V29            4066  // Panda Pi V2.9 - Standalone (STM32F103RC)
332
+#define BOARD_BTT_SKR_MINI_E3_V3_0_1  4028  // BigTreeTech SKR Mini E3 V3.0.1 (STM32F401RC)
333
+#define BOARD_BTT_SKR_MINI_MZ_V1_0    4029  // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
334
+#define BOARD_BTT_SKR_E3_DIP          4030  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
335
+#define BOARD_BTT_SKR_CR6             4031  // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
336
+#define BOARD_JGAURORA_A5S_A1         4032  // JGAurora A5S A1 (STM32F103ZE)
337
+#define BOARD_FYSETC_AIO_II           4033  // FYSETC AIO_II (STM32F103RC)
338
+#define BOARD_FYSETC_CHEETAH          4034  // FYSETC Cheetah (STM32F103RC)
339
+#define BOARD_FYSETC_CHEETAH_V12      4035  // FYSETC Cheetah V1.2 (STM32F103RC)
340
+#define BOARD_LONGER3D_LK             4036  // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE)
341
+#define BOARD_CCROBOT_MEEB_3DP        4037  // ccrobot-online.com MEEB_3DP (STM32F103RC)
342
+#define BOARD_CHITU3D_V5              4038  // Chitu3D TronXY X5SA V5 Board (STM32F103ZE)
343
+#define BOARD_CHITU3D_V6              4039  // Chitu3D TronXY X5SA V6 Board (STM32F103ZE)
344
+#define BOARD_CHITU3D_V9              4040  // Chitu3D TronXY X5SA V9 Board (STM32F103ZE)
345
+#define BOARD_CREALITY_V4             4041  // Creality v4.x (STM32F103RC / STM32F103RE)
346
+#define BOARD_CREALITY_V422           4042  // Creality v4.2.2 (STM32F103RC / STM32F103RE)
347
+#define BOARD_CREALITY_V423           4043  // Creality v4.2.3 (STM32F103RC / STM32F103RE)
348
+#define BOARD_CREALITY_V425           4044  // Creality v4.2.5 (STM32F103RC / STM32F103RE)
349
+#define BOARD_CREALITY_V427           4045  // Creality v4.2.7 (STM32F103RC / STM32F103RE)
350
+#define BOARD_CREALITY_V4210          4046  // Creality v4.2.10 (STM32F103RC / STM32F103RE) as found in the CR-30
351
+#define BOARD_CREALITY_V431           4047  // Creality v4.3.1 (STM32F103RC / STM32F103RE)
352
+#define BOARD_CREALITY_V431_A         4048  // Creality v4.3.1a (STM32F103RC / STM32F103RE)
353
+#define BOARD_CREALITY_V431_B         4049  // Creality v4.3.1b (STM32F103RC / STM32F103RE)
354
+#define BOARD_CREALITY_V431_C         4050  // Creality v4.3.1c (STM32F103RC / STM32F103RE)
355
+#define BOARD_CREALITY_V431_D         4051  // Creality v4.3.1d (STM32F103RC / STM32F103RE)
356
+#define BOARD_CREALITY_V452           4052  // Creality v4.5.2 (STM32F103RC / STM32F103RE)
357
+#define BOARD_CREALITY_V453           4053  // Creality v4.5.3 (STM32F103RC / STM32F103RE)
358
+#define BOARD_CREALITY_V24S1          4054  // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender-7
359
+#define BOARD_CREALITY_V24S1_301      4055  // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) v301 as found in the Ender-3 S1
360
+#define BOARD_CREALITY_V25S1          4056  // Creality v2.5.S1 (STM32F103RE) as found in the CR-10 Smart Pro
361
+#define BOARD_TRIGORILLA_PRO          4057  // Trigorilla Pro (STM32F103ZE)
362
+#define BOARD_FLY_MINI                4058  // FLYmaker FLY MINI (STM32F103RC)
363
+#define BOARD_FLSUN_HISPEED           4059  // FLSUN HiSpeedV1 (STM32F103VE)
364
+#define BOARD_BEAST                   4060  // STM32F103RE Libmaple-based controller
365
+#define BOARD_MINGDA_MPX_ARM_MINI     4061  // STM32F103ZE Mingda MD-16
366
+#define BOARD_GTM32_PRO_VD            4062  // STM32F103VE controller
367
+#define BOARD_ZONESTAR_ZM3E2          4063  // Zonestar ZM3E2    (STM32F103RC)
368
+#define BOARD_ZONESTAR_ZM3E4          4064  // Zonestar ZM3E4 V1 (STM32F103VC)
369
+#define BOARD_ZONESTAR_ZM3E4V2        4065  // Zonestar ZM3E4 V2 (STM32F103VC)
370
+#define BOARD_ERYONE_ERY32_MINI       4066  // Eryone Ery32 mini (STM32F103VE)
371
+#define BOARD_PANDA_PI_V29            4067  // Panda Pi V2.9 - Standalone (STM32F103RC)
371 372
 
372 373
 //
373 374
 // ARM Cortex-M4F

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

@@ -541,6 +541,8 @@
541 541
   #include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h"  // STM32F1                              env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple
542 542
 #elif MB(BTT_SKR_MINI_E3_V3_0)
543 543
   #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h"  // STM32G0                              env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer
544
+#elif MB(BTT_SKR_MINI_E3_V3_0_1)
545
+  #include "stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h"// STM32F4                              env:STM32F401RC_btt
544 546
 #elif MB(BTT_SKR_MINI_MZ_V1_0)
545 547
   #include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h"  // STM32F1                              env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple
546 548
 #elif MB(BTT_SKR_E3_DIP)

+ 34
- 28
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h View File

@@ -135,6 +135,12 @@
135 135
   #define EXP1_02_PIN                       PB6
136 136
   #define EXP1_08_PIN                       PB7
137 137
 #endif
138
+#define EXP1_01_PIN                         PB5
139
+#define EXP1_03_PIN                         PA9
140
+#define EXP1_04_PIN                         -1    // RESET
141
+#define EXP1_05_PIN                         PA10
142
+#define EXP1_06_PIN                         PB9
143
+#define EXP1_07_PIN                         PB8
138 144
 
139 145
 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
140 146
   /**
@@ -156,22 +162,22 @@
156 162
 
157 163
   #define BEEPER_PIN                 EXP1_02_PIN
158 164
   #define BTN_EN1                    EXP1_08_PIN
159
-  #define BTN_EN2                           PB8
160
-  #define BTN_ENC                           PB5
165
+  #define BTN_EN2                    EXP1_07_PIN
166
+  #define BTN_ENC                    EXP1_01_PIN
161 167
 
162 168
 #elif HAS_WIRED_LCD
163 169
 
164 170
   #if ENABLED(CR10_STOCKDISPLAY)
165 171
 
166
-    #define BEEPER_PIN                      PB5
172
+    #define BEEPER_PIN               EXP1_01_PIN
167 173
     #define BTN_ENC                  EXP1_02_PIN
168 174
 
169
-    #define BTN_EN1                         PA9
170
-    #define BTN_EN2                         PA10
175
+    #define BTN_EN1                  EXP1_03_PIN
176
+    #define BTN_EN2                  EXP1_05_PIN
171 177
 
172
-    #define LCD_PINS_RS                     PB8
178
+    #define LCD_PINS_RS              EXP1_07_PIN
173 179
     #define LCD_PINS_ENABLE          EXP1_08_PIN
174
-    #define LCD_PINS_D4                     PB9
180
+    #define LCD_PINS_D4              EXP1_06_PIN
175 181
 
176 182
   #elif ENABLED(ZONESTAR_LCD)                     // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD!
177 183
 
@@ -179,23 +185,23 @@
179 185
       #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
180 186
     #endif
181 187
 
182
-    #define LCD_PINS_RS                     PB9
188
+    #define LCD_PINS_RS              EXP1_06_PIN
183 189
     #define LCD_PINS_ENABLE          EXP1_02_PIN
184
-    #define LCD_PINS_D4                     PB8
185
-    #define LCD_PINS_D5                     PA10
186
-    #define LCD_PINS_D6                     PA9
187
-    #define LCD_PINS_D7                     PB5
190
+    #define LCD_PINS_D4              EXP1_07_PIN
191
+    #define LCD_PINS_D5              EXP1_05_PIN
192
+    #define LCD_PINS_D6              EXP1_03_PIN
193
+    #define LCD_PINS_D7              EXP1_01_PIN
188 194
     #define ADC_KEYPAD_PIN                  PA1   // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD!
189 195
 
190 196
   #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
191 197
 
192 198
     #define BTN_ENC                  EXP1_02_PIN
193
-    #define BTN_EN1                         PA9
194
-    #define BTN_EN2                         PA10
199
+    #define BTN_EN1                  EXP1_03_PIN
200
+    #define BTN_EN2                  EXP1_05_PIN
195 201
 
196
-    #define DOGLCD_CS                       PB8
197
-    #define DOGLCD_A0                       PB9
198
-    #define DOGLCD_SCK                      PB5
202
+    #define DOGLCD_CS                EXP1_07_PIN
203
+    #define DOGLCD_A0                EXP1_06_PIN
204
+    #define DOGLCD_SCK               EXP1_01_PIN
199 205
     #define DOGLCD_MOSI              EXP1_08_PIN
200 206
 
201 207
     #define FORCE_SOFT_SPI
@@ -238,7 +244,7 @@
238 244
        *   EXP1-1 ----------- EXP1-7   SD_DET
239 245
        */
240 246
 
241
-      #define TFTGLCD_CS                    PA9
247
+      #define TFTGLCD_CS             EXP1_03_PIN
242 248
 
243 249
     #endif
244 250
 
@@ -291,20 +297,20 @@
291 297
      * for backlight configuration see steps 2 (V2.1) and 3 in https://wiki.fysetc.com/Mini12864_Panel/
292 298
      */
293 299
 
294
-    #define LCD_PINS_RS                     PA9     // CS
300
+    #define LCD_PINS_RS              EXP1_03_PIN    // CS
295 301
     #define LCD_PINS_ENABLE                 PA3     // MOSI
296 302
     #define LCD_BACKLIGHT_PIN               -1
297
-    #define NEOPIXEL_PIN                    PB8
303
+    #define NEOPIXEL_PIN             EXP1_07_PIN
298 304
     #define LCD_CONTRAST                    255
299
-    #define LCD_RESET_PIN                   PA10
305
+    #define LCD_RESET_PIN            EXP1_05_PIN
300 306
 
301
-    #define DOGLCD_CS                       PA9
302
-    #define DOGLCD_A0                       PB5
307
+    #define DOGLCD_CS                EXP1_03_PIN
308
+    #define DOGLCD_A0                EXP1_01_PIN
303 309
     #define DOGLCD_SCK                      PA2
304 310
     #define DOGLCD_MOSI                     PA3
305 311
 
306 312
     #define BTN_ENC                         PA15
307
-    #define BTN_EN1                         PB9
313
+    #define BTN_EN1                  EXP1_06_PIN
308 314
     #define BTN_EN2                         PB15
309 315
 
310 316
     #define FORCE_SOFT_SPI
@@ -354,8 +360,8 @@
354 360
 
355 361
   #define BEEPER_PIN                 EXP1_02_PIN
356 362
 
357
-  #define CLCD_MOD_RESET                    PA9
358
-  #define CLCD_SPI_CS                       PB8
363
+  #define CLCD_MOD_RESET             EXP1_03_PIN
364
+  #define CLCD_SPI_CS                EXP1_07_PIN
359 365
 
360 366
 #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050
361 367
 
@@ -370,8 +376,8 @@
370 376
 #if SD_CONNECTION_IS(ONBOARD)
371 377
   #define SD_DETECT_PIN                     PC4
372 378
 #elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
373
-  #define SD_DETECT_PIN                     PB5
374
-  #define SD_SS_PIN                         PA10
379
+  #define SD_DETECT_PIN              EXP1_01_PIN
380
+  #define SD_SS_PIN                  EXP1_05_PIN
375 381
 #elif SD_CONNECTION_IS(CUSTOM_CABLE)
376 382
   #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
377 383
 #endif

+ 2
- 3
Marlin/src/pins/stm32f4/pins_ARMED.h View File

@@ -19,11 +19,10 @@
19 19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
-
23
-//  https://github.com/ktand/Armed
24
-
25 22
 #pragma once
26 23
 
24
+// https://github.com/ktand/Armed
25
+
27 26
 #include "env_validate.h"
28 27
 
29 28
 #if HOTENDS > 2 || E_STEPPERS > 2

+ 350
- 0
Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h View File

@@ -0,0 +1,350 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 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 <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//#define BOARD_CUSTOM_BUILD_FLAGS -DTONE_CHANNEL=4 -DTONE_TIMER=4 -DTIMER_TONE=4
25
+
26
+#include "env_validate.h"
27
+
28
+#if HOTENDS > 1 || E_STEPPERS > 1
29
+  #error "BTT SKR Mini E3 V3.0.1 supports up to 1 hotend / E stepper."
30
+#endif
31
+
32
+#ifndef BOARD_INFO_NAME
33
+  #define BOARD_INFO_NAME "BTT SKR Mini E3 V3.0.1"
34
+#endif
35
+
36
+#define USES_DIAG_JUMPERS
37
+
38
+// Ignore temp readings during development.
39
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD    2000
40
+
41
+#ifndef NEOPIXEL_LED
42
+  #define LED_PIN                           PA14
43
+#endif
44
+
45
+// Onboard I2C EEPROM
46
+#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
47
+  #undef NO_EEPROM_SELECTED
48
+  #define I2C_EEPROM
49
+  #define SOFT_I2C_EEPROM                         // Force the use of Software I2C
50
+  #define I2C_SCL_PIN                       PB8
51
+  #define I2C_SDA_PIN                       PB9
52
+  #define MARLIN_EEPROM_SIZE              0x1000  // 4KB
53
+#endif
54
+
55
+//
56
+// Servos
57
+//
58
+#define SERVO0_PIN                          PA0   // SERVOS
59
+
60
+//
61
+// Limit Switches
62
+//
63
+#define X_STOP_PIN                          PB5   // X-STOP
64
+#define Y_STOP_PIN                          PB6   // Y-STOP
65
+#define Z_STOP_PIN                          PB7   // Z-STOP
66
+
67
+//
68
+// Z Probe must be this pin
69
+//
70
+#define Z_MIN_PROBE_PIN                     PA1   // PROBE
71
+
72
+//
73
+// Filament Runout Sensor
74
+//
75
+#ifndef FIL_RUNOUT_PIN
76
+  #define FIL_RUNOUT_PIN                    PC15  // E0-STOP
77
+#endif
78
+
79
+//
80
+// Power-loss Detection
81
+//
82
+#ifndef POWER_LOSS_PIN
83
+  #define POWER_LOSS_PIN                    PC13  // Power Loss Detection: PWR-DET
84
+#endif
85
+
86
+#ifndef NEOPIXEL_PIN
87
+  #define NEOPIXEL_PIN                      PA14  // LED driving pin
88
+#endif
89
+
90
+#ifndef PS_ON_PIN
91
+  #define PS_ON_PIN                         PC14  // Power Supply Control
92
+#endif
93
+
94
+//
95
+// Steppers
96
+//
97
+#define X_ENABLE_PIN                        PC10
98
+#define X_STEP_PIN                          PC11
99
+#define X_DIR_PIN                           PC12
100
+
101
+#define Y_ENABLE_PIN                        PB13
102
+#define Y_STEP_PIN                          PB12
103
+#define Y_DIR_PIN                           PB10
104
+
105
+#define Z_ENABLE_PIN                        PB2
106
+#define Z_STEP_PIN                          PB1
107
+#define Z_DIR_PIN                           PB0
108
+
109
+#define E0_ENABLE_PIN                       PC3
110
+#define E0_STEP_PIN                         PC2
111
+#define E0_DIR_PIN                          PC1
112
+
113
+#if HAS_TMC_UART
114
+  /**
115
+   * TMC220x stepper drivers
116
+   * Hardware serial communication ports
117
+   */
118
+  #define X_HARDWARE_SERIAL  MSerial6
119
+  #define Y_HARDWARE_SERIAL  MSerial6
120
+  #define Z_HARDWARE_SERIAL  MSerial6
121
+  #define E0_HARDWARE_SERIAL MSerial6
122
+
123
+  // Default TMC slave addresses
124
+  #ifndef X_SLAVE_ADDRESS
125
+    #define X_SLAVE_ADDRESS                    0
126
+  #endif
127
+  #ifndef Y_SLAVE_ADDRESS
128
+    #define Y_SLAVE_ADDRESS                    2
129
+  #endif
130
+  #ifndef Z_SLAVE_ADDRESS
131
+    #define Z_SLAVE_ADDRESS                    1
132
+  #endif
133
+  #ifndef E0_SLAVE_ADDRESS
134
+    #define E0_SLAVE_ADDRESS                   3
135
+  #endif
136
+#endif
137
+
138
+//
139
+// Temperature Sensors
140
+//
141
+#define TEMP_0_PIN                          PC5   // Analog Input "TH0"
142
+#define TEMP_BED_PIN                        PC4   // Analog Input "TB0"
143
+
144
+//
145
+// Heaters / Fans
146
+//
147
+#define HEATER_0_PIN                        PA15  // "HE"
148
+#define HEATER_BED_PIN                      PB3   // "HB"
149
+#define FAN_PIN                             PC9   // "FAN0"
150
+#define FAN1_PIN                            PA8   // "FAN1"
151
+#define FAN2_PIN                            PC8   // "FAN2"
152
+
153
+/**
154
+ *              SKR Mini E3 V3.0.1
155
+ *                  ------
156
+ *  (BEEPER)  PB15 | 1  2 | PB14 (BTN_ENC)
157
+ *  (BTN_EN1) PA9  | 3  4 | RESET
158
+ *  (BTN_EN2) PA10   5  6 | PB4  (LCD_D4)
159
+ *  (LCD_RS)  PD2  | 7  8 | PC0  (LCD_EN)
160
+ *             GND | 9 10 | 5V
161
+ *                  ------
162
+ *                   EXP1
163
+ */
164
+#define EXP1_01_PIN                         PB15
165
+#define EXP1_02_PIN                         PB14
166
+#define EXP1_03_PIN                         PA9
167
+#define EXP1_04_PIN                         -1    // RESET
168
+#define EXP1_05_PIN                         PA10
169
+#define EXP1_06_PIN                         PB4
170
+#define EXP1_07_PIN                         PD2
171
+#define EXP1_08_PIN                         PC0
172
+
173
+#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
174
+  /**
175
+   *        ------                ------                ------
176
+   * (ENT) | 1  2 | (BEEP)       |10  9 |              |10  9 |
177
+   *  (RX) | 3  4 |         (RX) | 8  7 | (TX)      RX | 8  7 | TX
178
+   *  (TX)   5  6 |        (ENT)   6  5 | (BEEP)   ENT | 6  5 | BEEP
179
+   *   (B) | 7  8 | (A)      (B) | 4  3 | (A)        B | 4  3 | A
180
+   *   GND | 9 10 | (VCC)    GND | 2  1 | VCC      GND | 2  1 | VCC
181
+   *        ------                ------                ------
182
+   *         EXP1                  DWIN               DWIN (plug)
183
+   *
184
+   * All pins are labeled as printed on DWIN PCB. Connect TX-TX, A-A and so on.
185
+   */
186
+
187
+  #error "DWIN_CREALITY_LCD requires a custom cable, see diagram above this line. Comment out this line to continue."
188
+
189
+  #define BEEPER_PIN                 EXP1_02_PIN
190
+  #define BTN_EN1                    EXP1_08_PIN
191
+  #define BTN_EN2                    EXP1_07_PIN
192
+  #define BTN_ENC                    EXP1_01_PIN
193
+
194
+#elif HAS_WIRED_LCD
195
+
196
+  #if ENABLED(CR10_STOCKDISPLAY)
197
+
198
+    #define BEEPER_PIN               EXP1_01_PIN
199
+    #define BTN_ENC                  EXP1_02_PIN
200
+
201
+    #define BTN_EN1                  EXP1_03_PIN
202
+    #define BTN_EN2                  EXP1_05_PIN
203
+
204
+    #define LCD_PINS_RS              EXP1_07_PIN
205
+    #define LCD_PINS_ENABLE          EXP1_08_PIN
206
+    #define LCD_PINS_D4              EXP1_06_PIN
207
+
208
+  #elif ENABLED(ZONESTAR_LCD)                     // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD!
209
+
210
+    #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
211
+      #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
212
+    #endif
213
+
214
+    #define LCD_PINS_RS              EXP1_06_PIN
215
+    #define LCD_PINS_ENABLE          EXP1_02_PIN
216
+    #define LCD_PINS_D4              EXP1_07_PIN
217
+    #define LCD_PINS_D5              EXP1_05_PIN
218
+    #define LCD_PINS_D6              EXP1_03_PIN
219
+    #define LCD_PINS_D7              EXP1_01_PIN
220
+    #define ADC_KEYPAD_PIN                  PA1   // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD!
221
+
222
+  #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
223
+
224
+    #define BTN_ENC                  EXP1_02_PIN
225
+    #define BTN_EN1                  EXP1_03_PIN
226
+    #define BTN_EN2                  EXP1_05_PIN
227
+
228
+    #define DOGLCD_CS                EXP1_07_PIN
229
+    #define DOGLCD_A0                EXP1_06_PIN
230
+    #define DOGLCD_SCK               EXP1_01_PIN
231
+    #define DOGLCD_MOSI              EXP1_08_PIN
232
+
233
+    #define FORCE_SOFT_SPI
234
+    #define LCD_BACKLIGHT_PIN               -1
235
+
236
+  #elif IS_TFTGLCD_PANEL
237
+
238
+    #if ENABLED(TFTGLCD_PANEL_SPI)
239
+
240
+      #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
241
+        #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
242
+      #endif
243
+
244
+      /**
245
+       * TFTGLCD_PANEL_SPI display pinout
246
+       *
247
+       *                Board                                 Display
248
+       *                ------                                ------
249
+       * (BEEPER) PB6  | 1  2 | PB15 (SD_DET)             5V |10  9 | GND
250
+       *         RESET | 3  4 | PA9  (MOD_RESET)          -- | 8  7 | (SD_DET)
251
+       *          PB4    5  6 | PA10 (SD_CS)         (MOSI)  | 6  5 | --
252
+       *          PB7  | 7  8 | PD2  (LCD_CS)        (SD_CS) | 4  3 | (LCD_CS)
253
+       *           GND | 9 10 | 5V                   (SCK)   | 2  1 | (MISO)
254
+       *                ------                                ------
255
+       *                 EXP1                                  EXP1
256
+       *
257
+       * Needs custom cable:
258
+       *
259
+       *    Board             Display
260
+       *
261
+       *   EXP1-10 ---------- EXP1-10
262
+       *   EXP1-9 ----------- EXP1-9
263
+       *   SPI1-4 ----------- EXP1-6
264
+       *   EXP1-7 ----------- FREE
265
+       *   SPI1-3 ----------- EXP1-2
266
+       *   EXP1-5 ----------- EXP1-4
267
+       *   EXP1-4 ----------- FREE
268
+       *   EXP1-3 ----------- EXP1-3
269
+       *   SPI1-1 ----------- EXP1-1
270
+       *   EXP1-1 ----------- EXP1-7
271
+       */
272
+
273
+      #define TFTGLCD_CS             EXP1_03_PIN
274
+
275
+    #endif
276
+
277
+  #else
278
+    #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BIGTREE_SKR_MINI_E3."
279
+  #endif
280
+
281
+#endif // HAS_WIRED_LCD
282
+
283
+#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050)
284
+
285
+  #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
286
+    #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
287
+  #endif
288
+
289
+  /**
290
+   * FYSETC TFT TFT81050 display pinout
291
+   *
292
+   *                   Board                             Display
293
+   *                   ------                            ------
294
+   * (SD_DET)    PB15 | 1  2 | PB6 (BEEPER)          5V |10  9 | GND
295
+   * (MOD_RESET) PA9  | 3  4 | RESET            (RESET) | 8  7 | (SD_DET)
296
+   * (SD_CS)     PA10   5  6 | PB4 (FREE)       (MOSI)  | 6  5 | (LCD_CS)
297
+   * (LCD_CS)    PD2  | 7  8 | PB7 (FREE)       (SD_CS) | 4  3 | (MOD_RESET)
298
+   *               5V | 9 10 | GND              (SCK)   | 2  1 | (MISO)
299
+   *                   ------                            ------
300
+   *                    EXP1                              EXP1
301
+   *
302
+   * Needs custom cable:
303
+   *
304
+   *    Board   Adapter   Display
305
+   *           _________
306
+   *   EXP1-10 ---------- EXP1-10
307
+   *   EXP1-9 ----------- EXP1-9
308
+   *   SPI1-4 ----------- EXP1-6
309
+   *   EXP1-7 ----------- EXP1-5
310
+   *   SPI1-3 ----------- EXP1-2
311
+   *   EXP1-5 ----------- EXP1-4
312
+   *   EXP1-4 ----------- EXP1-8
313
+   *   EXP1-3 ----------- EXP1-3
314
+   *   SPI1-1 ----------- EXP1-1
315
+   *   EXP1-1 ----------- EXP1-7
316
+   */
317
+
318
+  #define CLCD_SPI_BUS                         1  // SPI1 connector
319
+
320
+  #define BEEPER_PIN                 EXP1_02_PIN
321
+
322
+  #define CLCD_MOD_RESET             EXP1_03_PIN
323
+  #define CLCD_SPI_CS                EXP1_07_PIN
324
+
325
+#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050
326
+
327
+//
328
+// SD Support
329
+//
330
+
331
+#ifndef SDCARD_CONNECTION
332
+  #define SDCARD_CONNECTION              ONBOARD
333
+#endif
334
+
335
+#if SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
336
+  #define SD_DETECT_PIN              EXP1_01_PIN
337
+  #define SD_SS_PIN                  EXP1_05_PIN
338
+#elif SD_CONNECTION_IS(CUSTOM_CABLE)
339
+  #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
340
+#endif
341
+
342
+#define ONBOARD_SPI_DEVICE                     1  // SPI1 -> used only by HAL/STM32F1...
343
+#define ONBOARD_SD_CS_PIN                   PA4   // Chip select for "System" SD card
344
+
345
+#define ENABLE_SPI1
346
+#define SDSS                   ONBOARD_SD_CS_PIN
347
+#define SD_SS_PIN              ONBOARD_SD_CS_PIN
348
+#define SD_SCK_PIN                          PA5
349
+#define SD_MISO_PIN                         PA6
350
+#define SD_MOSI_PIN                         PA7

+ 38
- 0
buildroot/share/PlatformIO/boards/marlin_STM32F401RC.json View File

@@ -0,0 +1,38 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m4",
5
+    "extra_flags": "-DSTM32F401xC -DSTM32F4xx",
6
+    "f_cpu": "84000000L",
7
+    "mcu": "stm32f401rct6",
8
+    "product_line": "STM32F401xC",
9
+    "variant": "MARLIN_F401RC"
10
+  },
11
+  "debug": {
12
+    "jlink_device": "STM32F401RC",
13
+    "openocd_target": "stm32f4x",
14
+    "svd_path": "STM32F401x.svd"
15
+  },
16
+  "frameworks": [
17
+    "arduino",
18
+    "cmsis",
19
+    "spl",
20
+    "stm32cube",
21
+    "libopencm3"
22
+  ],
23
+  "name": "STM32F401RC (64k RAM. 256k Flash)",
24
+  "upload": {
25
+    "maximum_ram_size": 65536,
26
+    "maximum_size": 262144,
27
+    "protocol": "serial",
28
+    "protocols": [
29
+      "blackmagic",
30
+      "dfu",
31
+      "jlink",
32
+      "serial",
33
+      "stlink"
34
+    ]
35
+  },
36
+  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401rc.html",
37
+  "vendor": "Generic"
38
+}

+ 256
- 0
buildroot/share/PlatformIO/variants/MARLIN_F401RC/PeripheralPins.c View File

@@ -0,0 +1,256 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2020-2021, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * This software component is licensed by ST under BSD 3-Clause license,
7
+ * the "License"; You may not use this file except in compliance with the
8
+ * License. You may obtain a copy of the License at:
9
+ *                        opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ *******************************************************************************
12
+ */
13
+/*
14
+ * Automatically generated from STM32F401R(B-C)Tx.xml, STM32F401R(D-E)Tx.xml
15
+ * CubeMX DB release 6.0.30
16
+ */
17
+#if !defined(CUSTOM_PERIPHERAL_PINS)
18
+#include "Arduino.h"
19
+#include "PeripheralPins.h"
20
+
21
+/* =====
22
+ * Notes:
23
+ * - The pins mentioned Px_y_ALTz are alternative possibilities which use other
24
+ *   HW peripheral instances. You can use them the same way as any other "normal"
25
+ *   pin (i.e. analogWrite(PA7_ALT1, 128);).
26
+ *
27
+ * - Commented lines are alternative possibilities which are not used per default.
28
+ *   If you change them, you will have to know what you do
29
+ * =====
30
+ */
31
+
32
+//*** ADC ***
33
+
34
+#ifdef HAL_ADC_MODULE_ENABLED
35
+WEAK const PinMap PinMap_ADC[] = {
36
+  {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
37
+  {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
38
+  {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
39
+  {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
40
+  {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
41
+  {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
42
+  {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
43
+  {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
44
+  {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
45
+  {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
46
+  {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
47
+  {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
48
+  {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
49
+  {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
50
+  {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
51
+  {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
52
+  {NC,   NP,   0}
53
+};
54
+#endif
55
+
56
+//*** No DAC ***
57
+
58
+//*** I2C ***
59
+
60
+#ifdef HAL_I2C_MODULE_ENABLED
61
+WEAK const PinMap PinMap_I2C_SDA[] = {
62
+  {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)},
63
+  {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)},
64
+  {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
65
+  {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
66
+  {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
67
+  {NC,   NP,   0}
68
+};
69
+#endif
70
+
71
+#ifdef HAL_I2C_MODULE_ENABLED
72
+WEAK const PinMap PinMap_I2C_SCL[] = {
73
+  {PA_8,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
74
+  {PB_6,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
75
+  {PB_8,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
76
+  {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
77
+  {NC,    NP,   0}
78
+};
79
+#endif
80
+
81
+//*** TIM ***
82
+
83
+#ifdef HAL_TIM_MODULE_ENABLED
84
+WEAK const PinMap PinMap_TIM[] = {
85
+  {PA_0,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
86
+  {PA_0_ALT1, TIM5,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
87
+  {PA_1,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
88
+  {PA_1_ALT1, TIM5,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2
89
+  {PA_2,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
90
+  {PA_2_ALT1, TIM5,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
91
+  {PA_2_ALT2, TIM9,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
92
+  {PA_3,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
93
+  {PA_3_ALT1, TIM5,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
94
+  {PA_3_ALT2, TIM9,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
95
+  {PA_5,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
96
+  {PA_6,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
97
+  {PA_7,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
98
+  {PA_7_ALT1, TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
99
+  {PA_8,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
100
+  {PA_9,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
101
+  {PA_10,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
102
+  {PA_11,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
103
+  {PA_15,     TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
104
+  {PB_0,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
105
+  {PB_0_ALT1, TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
106
+  {PB_1,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
107
+  {PB_1_ALT1, TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
108
+  {PB_3,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
109
+  {PB_4,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
110
+  {PB_5,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
111
+  {PB_6,      TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
112
+  {PB_7,      TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
113
+  {PB_8,      TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
114
+  {PB_8_ALT1, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
115
+  {PB_9,      TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
116
+  {PB_9_ALT1, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
117
+  {PB_10,     TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
118
+  {PB_13,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
119
+  {PB_14,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
120
+  {PB_15,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
121
+  {PC_6,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
122
+  {PC_7,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
123
+  {PC_8,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
124
+  {PC_9,      TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
125
+  {NC,        NP,    0}
126
+};
127
+#endif
128
+
129
+//*** UART ***
130
+
131
+#ifdef HAL_UART_MODULE_ENABLED
132
+WEAK const PinMap PinMap_UART_TX[] = {
133
+  {PA_2,  USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
134
+  {PA_9,  USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
135
+  {PA_11, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
136
+  {PB_6,  USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
137
+  {PC_6,  USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
138
+  {NC,    NP,     0}
139
+};
140
+#endif
141
+
142
+#ifdef HAL_UART_MODULE_ENABLED
143
+WEAK const PinMap PinMap_UART_RX[] = {
144
+  {PA_3,  USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
145
+  {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
146
+  {PA_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
147
+  {PB_7,  USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
148
+  {PC_7,  USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
149
+  {NC,    NP,     0}
150
+};
151
+#endif
152
+
153
+#ifdef HAL_UART_MODULE_ENABLED
154
+WEAK const PinMap PinMap_UART_RTS[] = {
155
+  {PA_1,  USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
156
+  {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
157
+  {NC,    NP,     0}
158
+};
159
+#endif
160
+
161
+#ifdef HAL_UART_MODULE_ENABLED
162
+WEAK const PinMap PinMap_UART_CTS[] = {
163
+  {PA_0,  USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
164
+  {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
165
+  {NC,    NP,     0}
166
+};
167
+#endif
168
+
169
+//*** SPI ***
170
+
171
+#ifdef HAL_SPI_MODULE_ENABLED
172
+WEAK const PinMap PinMap_SPI_MOSI[] = {
173
+  {PA_7,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
174
+  {PB_5,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
175
+  {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
176
+  {PB_15,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
177
+  {PC_3,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
178
+  {PC_12,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
179
+  {NC,        NP,   0}
180
+};
181
+#endif
182
+
183
+#ifdef HAL_SPI_MODULE_ENABLED
184
+WEAK const PinMap PinMap_SPI_MISO[] = {
185
+  {PA_6,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
186
+  {PB_4,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
187
+  {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
188
+  {PB_14,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
189
+  {PC_2,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
190
+  {PC_11,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
191
+  {NC,        NP,   0}
192
+};
193
+#endif
194
+
195
+#ifdef HAL_SPI_MODULE_ENABLED
196
+WEAK const PinMap PinMap_SPI_SCLK[] = {
197
+  {PA_5,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
198
+  {PB_3,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
199
+  {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
200
+  {PB_10,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
201
+  {PB_13,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
202
+  {PC_10,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
203
+  {NC,        NP,   0}
204
+};
205
+#endif
206
+
207
+#ifdef HAL_SPI_MODULE_ENABLED
208
+WEAK const PinMap PinMap_SPI_SSEL[] = {
209
+  {PA_4,       SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
210
+  {PA_4_ALT1,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
211
+  {PA_15,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
212
+  {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
213
+  {PB_9,       SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
214
+  {PB_12,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
215
+  {NC,         NP,   0}
216
+};
217
+#endif
218
+
219
+//*** No CAN ***
220
+
221
+//*** No ETHERNET ***
222
+
223
+//*** No QUADSPI ***
224
+
225
+//*** USB ***
226
+
227
+#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED)
228
+WEAK const PinMap PinMap_USB_OTG_FS[] = {
229
+  {PA_8,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
230
+  {PA_9,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
231
+  {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
232
+  {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
233
+  {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP
234
+  {NC,    NP,         0}
235
+};
236
+#endif
237
+
238
+//*** SD ***
239
+
240
+#ifdef HAL_SD_MODULE_ENABLED
241
+WEAK const PinMap PinMap_SD[] = {
242
+  {PB_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4
243
+  {PB_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5
244
+  {PC_6,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6
245
+  {PC_7,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7
246
+  {PC_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0
247
+  {PC_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1
248
+  {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2
249
+  {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3
250
+  {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK
251
+  {PD_2,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD
252
+  {NC,    NP,   0}
253
+};
254
+#endif
255
+
256
+#endif /* !CUSTOM_PERIPHERAL_PINS */

+ 52
- 0
buildroot/share/PlatformIO/variants/MARLIN_F401RC/PinNamesVar.h View File

@@ -0,0 +1,52 @@
1
+/* Alternate pin name */
2
+PA_0_ALT1  = PA_0  | ALT1,
3
+PA_1_ALT1  = PA_1  | ALT1,
4
+PA_2_ALT1  = PA_2  | ALT1,
5
+PA_2_ALT2  = PA_2  | ALT2,
6
+PA_3_ALT1  = PA_3  | ALT1,
7
+PA_3_ALT2  = PA_3  | ALT2,
8
+PA_4_ALT1  = PA_4  | ALT1,
9
+PA_7_ALT1  = PA_7  | ALT1,
10
+PA_15_ALT1 = PA_15 | ALT1,
11
+PB_0_ALT1  = PB_0  | ALT1,
12
+PB_1_ALT1  = PB_1  | ALT1,
13
+PB_3_ALT1  = PB_3  | ALT1,
14
+PB_4_ALT1  = PB_4  | ALT1,
15
+PB_5_ALT1  = PB_5  | ALT1,
16
+PB_8_ALT1  = PB_8  | ALT1,
17
+PB_9_ALT1  = PB_9  | ALT1,
18
+
19
+/* SYS_WKUP */
20
+#ifdef PWR_WAKEUP_PIN1
21
+  SYS_WKUP1 = PA_0,
22
+#endif
23
+#ifdef PWR_WAKEUP_PIN2
24
+  SYS_WKUP2 = NC,
25
+#endif
26
+#ifdef PWR_WAKEUP_PIN3
27
+  SYS_WKUP3 = NC,
28
+#endif
29
+#ifdef PWR_WAKEUP_PIN4
30
+  SYS_WKUP4 = NC,
31
+#endif
32
+#ifdef PWR_WAKEUP_PIN5
33
+  SYS_WKUP5 = NC,
34
+#endif
35
+#ifdef PWR_WAKEUP_PIN6
36
+  SYS_WKUP6 = NC,
37
+#endif
38
+#ifdef PWR_WAKEUP_PIN7
39
+  SYS_WKUP7 = NC,
40
+#endif
41
+#ifdef PWR_WAKEUP_PIN8
42
+  SYS_WKUP8 = NC,
43
+#endif
44
+
45
+/* USB */
46
+#ifdef USBCON
47
+  USB_OTG_FS_DM   = PA_11,
48
+  USB_OTG_FS_DP   = PA_12,
49
+  USB_OTG_FS_ID   = PA_10,
50
+  USB_OTG_FS_SOF  = PA_8,
51
+  USB_OTG_FS_VBUS = PA_9,
52
+#endif

+ 177
- 0
buildroot/share/PlatformIO/variants/MARLIN_F401RC/ldscript.ld View File

@@ -0,0 +1,177 @@
1
+/**
2
+ ******************************************************************************
3
+ * @file      LinkerScript.ld
4
+ * @author    Auto-generated by STM32CubeIDE
5
+ * @brief     Linker script for STM32F401RBTx Device from STM32F4 series
6
+ *                      128Kbytes FLASH
7
+ *                      64Kbytes RAM
8
+ *
9
+ *            Set heap size, stack size and stack location according
10
+ *            to application requirements.
11
+ *
12
+ *            Set memory bank area and size if external memory is used
13
+ ******************************************************************************
14
+ * @attention
15
+ *
16
+ * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
17
+ * All rights reserved.</center></h2>
18
+ *
19
+ * This software component is licensed by ST under BSD 3-Clause license,
20
+ * the "License"; You may not use this file except in compliance with the
21
+ * License. You may obtain a copy of the License at:
22
+ *                        opensource.org/licenses/BSD-3-Clause
23
+ *
24
+ ******************************************************************************
25
+ */
26
+
27
+/* Entry Point */
28
+ENTRY(Reset_Handler)
29
+
30
+/* Highest address of the user mode stack */
31
+_estack = ORIGIN(RAM) + LENGTH(RAM);	/* end of "RAM" Ram type memory */
32
+
33
+_Min_Heap_Size = 0x200;	/* required amount of heap  */
34
+_Min_Stack_Size = 0x400;	/* required amount of stack */
35
+
36
+/* Memories definition */
37
+MEMORY
38
+{
39
+  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = LD_MAX_DATA_SIZE
40
+  FLASH    (rx)    : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
41
+}
42
+
43
+/* Sections */
44
+SECTIONS
45
+{
46
+  /* The startup code into "FLASH" Rom type memory */
47
+  .isr_vector :
48
+  {
49
+    . = ALIGN(4);
50
+    KEEP(*(.isr_vector)) /* Startup code */
51
+    . = ALIGN(4);
52
+  } >FLASH
53
+
54
+  /* The program code and other data into "FLASH" Rom type memory */
55
+  .text :
56
+  {
57
+    . = ALIGN(4);
58
+    *(.text)           /* .text sections (code) */
59
+    *(.text*)          /* .text* sections (code) */
60
+    *(.glue_7)         /* glue arm to thumb code */
61
+    *(.glue_7t)        /* glue thumb to arm code */
62
+    *(.eh_frame)
63
+
64
+    KEEP (*(.init))
65
+    KEEP (*(.fini))
66
+
67
+    . = ALIGN(4);
68
+    _etext = .;        /* define a global symbols at end of code */
69
+  } >FLASH
70
+
71
+  /* Constant data into "FLASH" Rom type memory */
72
+  .rodata :
73
+  {
74
+    . = ALIGN(4);
75
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
76
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
77
+    . = ALIGN(4);
78
+  } >FLASH
79
+
80
+  .ARM.extab   : {
81
+    . = ALIGN(4);
82
+    *(.ARM.extab* .gnu.linkonce.armextab.*)
83
+    . = ALIGN(4);
84
+  } >FLASH
85
+
86
+  .ARM : {
87
+    . = ALIGN(4);
88
+    __exidx_start = .;
89
+    *(.ARM.exidx*)
90
+    __exidx_end = .;
91
+    . = ALIGN(4);
92
+  } >FLASH
93
+
94
+  .preinit_array     :
95
+  {
96
+    . = ALIGN(4);
97
+    PROVIDE_HIDDEN (__preinit_array_start = .);
98
+    KEEP (*(.preinit_array*))
99
+    PROVIDE_HIDDEN (__preinit_array_end = .);
100
+    . = ALIGN(4);
101
+  } >FLASH
102
+
103
+  .init_array :
104
+  {
105
+    . = ALIGN(4);
106
+    PROVIDE_HIDDEN (__init_array_start = .);
107
+    KEEP (*(SORT(.init_array.*)))
108
+    KEEP (*(.init_array*))
109
+    PROVIDE_HIDDEN (__init_array_end = .);
110
+    . = ALIGN(4);
111
+  } >FLASH
112
+
113
+  .fini_array :
114
+  {
115
+    . = ALIGN(4);
116
+    PROVIDE_HIDDEN (__fini_array_start = .);
117
+    KEEP (*(SORT(.fini_array.*)))
118
+    KEEP (*(.fini_array*))
119
+    PROVIDE_HIDDEN (__fini_array_end = .);
120
+    . = ALIGN(4);
121
+  } >FLASH
122
+
123
+  /* Used by the startup to initialize data */
124
+  _sidata = LOADADDR(.data);
125
+
126
+  /* Initialized data sections into "RAM" Ram type memory */
127
+  .data :
128
+  {
129
+    . = ALIGN(4);
130
+    _sdata = .;        /* create a global symbol at data start */
131
+    *(.data)           /* .data sections */
132
+    *(.data*)          /* .data* sections */
133
+    *(.RamFunc)        /* .RamFunc sections */
134
+    *(.RamFunc*)       /* .RamFunc* sections */
135
+
136
+    . = ALIGN(4);
137
+    _edata = .;        /* define a global symbol at data end */
138
+
139
+  } >RAM AT> FLASH
140
+
141
+  /* Uninitialized data section into "RAM" Ram type memory */
142
+  . = ALIGN(4);
143
+  .bss :
144
+  {
145
+    /* This is used by the startup in order to initialize the .bss section */
146
+    _sbss = .;         /* define a global symbol at bss start */
147
+    __bss_start__ = _sbss;
148
+    *(.bss)
149
+    *(.bss*)
150
+    *(COMMON)
151
+
152
+    . = ALIGN(4);
153
+    _ebss = .;         /* define a global symbol at bss end */
154
+    __bss_end__ = _ebss;
155
+  } >RAM
156
+
157
+  /* User_heap_stack section, used to check that there is enough "RAM" Ram  type memory left */
158
+  ._user_heap_stack :
159
+  {
160
+    . = ALIGN(8);
161
+    PROVIDE ( end = . );
162
+    PROVIDE ( _end = . );
163
+    . = . + _Min_Heap_Size;
164
+    . = . + _Min_Stack_Size;
165
+    . = ALIGN(8);
166
+  } >RAM
167
+
168
+  /* Remove information from the compiler libraries */
169
+  /DISCARD/ :
170
+  {
171
+    libc.a ( * )
172
+    libm.a ( * )
173
+    libgcc.a ( * )
174
+  }
175
+
176
+  .ARM.attributes 0 : { *(.ARM.attributes) }
177
+}

+ 223
- 0
buildroot/share/PlatformIO/variants/MARLIN_F401RC/variant_MARLIN_STM32F401RC.cpp View File

@@ -0,0 +1,223 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2020-2021, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * This software component is licensed by ST under BSD 3-Clause license,
7
+ * the "License"; You may not use this file except in compliance with the
8
+ * License. You may obtain a copy of the License at:
9
+ *                        opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ *******************************************************************************
12
+ */
13
+
14
+#if defined(STM32F401xC)
15
+#include "pins_arduino.h"
16
+
17
+// Digital PinName array
18
+const PinName digitalPin[] = {
19
+  PA_0,   // D0/A0
20
+  PA_1,   // D1/A1
21
+  PA_2,   // D2/A2
22
+  PA_3,   // D3/A3
23
+  PA_4,   // D4/A4
24
+  PA_5,   // D5/A5
25
+  PA_6,   // D6/A6
26
+  PA_7,   // D7/A7
27
+  PA_8,   // D8
28
+  PA_9,   // D9
29
+  PA_10,  // D10
30
+  PA_11,  // D11
31
+  PA_12,  // D12
32
+  PA_13,  // D13
33
+  PA_14,  // D14
34
+  PA_15,  // D15
35
+  PB_0,   // D16/A8
36
+  PB_1,   // D17/A9
37
+  PB_2,   // D18
38
+  PB_3,   // D19
39
+  PB_4,   // D20
40
+  PB_5,   // D21
41
+  PB_6,   // D22
42
+  PB_7,   // D23
43
+  PB_8,   // D24
44
+  PB_9,   // D25
45
+  PB_10,  // D26
46
+  PB_12,  // D27
47
+  PB_13,  // D28
48
+  PB_14,  // D29
49
+  PB_15,  // D30
50
+  PC_0,   // D31/A10
51
+  PC_1,   // D32/A11
52
+  PC_2,   // D33/A12
53
+  PC_3,   // D34/A13
54
+  PC_4,   // D35/A14
55
+  PC_5,   // D36/A15
56
+  PC_6,   // D37
57
+  PC_7,   // D38
58
+  PC_8,   // D39
59
+  PC_9,   // D40
60
+  PC_10,  // D41
61
+  PC_11,  // D42
62
+  PC_12,  // D43
63
+  PC_13,  // D44
64
+  PC_14,  // D45
65
+  PC_15,  // D46
66
+  PD_2,   // D47
67
+  PH_0,   // D48
68
+  PH_1    // D49
69
+};
70
+
71
+// Analog (Ax) pin number array
72
+const uint32_t analogInputPin[] = {
73
+  0,  // A0,  PA0
74
+  1,  // A1,  PA1
75
+  2,  // A2,  PA2
76
+  3,  // A3,  PA3
77
+  4,  // A4,  PA4
78
+  5,  // A5,  PA5
79
+  6,  // A6,  PA6
80
+  7,  // A7,  PA7
81
+  16, // A8,  PB0
82
+  17, // A9,  PB1
83
+  31, // A10, PC0
84
+  32, // A11, PC1
85
+  33, // A12, PC2
86
+  34, // A13, PC3
87
+  35, // A14, PC4
88
+  36  // A15, PC5
89
+};
90
+
91
+// ----------------------------------------------------------------------------
92
+
93
+#ifdef __cplusplus
94
+extern "C" {
95
+#endif
96
+
97
+/*
98
+ * @brief  Configures the System clock source, PLL Multiplier and Divider factors,
99
+ *               AHB/APBx prescalers and Flash settings
100
+ * @note   This function should be called only once the RCC clock configuration
101
+ *         is reset to the default reset state (done in SystemInit() function).
102
+ * @param  None
103
+ * @retval None
104
+ */
105
+
106
+/******************************************************************************/
107
+/*            PLL (clocked by HSE) used as System clock source                */
108
+/******************************************************************************/
109
+static uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
110
+{
111
+  RCC_OscInitTypeDef RCC_OscInitStruct;
112
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
113
+
114
+  /* The voltage scaling allows optimizing the power consumption when the device is
115
+  clocked below the maximum system frequency, to update the voltage scaling value
116
+  regarding system frequency refer to product datasheet. */
117
+  __HAL_RCC_PWR_CLK_ENABLE();
118
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
119
+
120
+  // Enable HSE oscillator and activate PLL with HSE as source
121
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSE;
122
+  if (bypass == 0) {
123
+    RCC_OscInitStruct.HSEState          = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT
124
+  } else {
125
+    RCC_OscInitStruct.HSEState          = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN
126
+  }
127
+
128
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
129
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSE;
130
+  RCC_OscInitStruct.PLL.PLLM            = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not
131
+  RCC_OscInitStruct.PLL.PLLN            = 336;           // VCO output clock = 336 MHz (1 MHz * 336)
132
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
133
+  RCC_OscInitStruct.PLL.PLLQ            = 7;             // USB clock = 48 MHz (336 MHz / 7) --> OK for USB
134
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
135
+    return 0; // FAIL
136
+  }
137
+
138
+  // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers
139
+  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
140
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
141
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 84 MHz
142
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;           // 42 MHz
143
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;           // 84 MHz
144
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
145
+    return 0; // FAIL
146
+  }
147
+
148
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
149
+  /*
150
+  if (bypass == 0)
151
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz
152
+  else
153
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz
154
+  */
155
+
156
+  return 1; // OK
157
+}
158
+
159
+/******************************************************************************/
160
+/*            PLL (clocked by HSI) used as System clock source                */
161
+/******************************************************************************/
162
+uint8_t SetSysClock_PLL_HSI(void)
163
+{
164
+  RCC_OscInitTypeDef RCC_OscInitStruct;
165
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
166
+
167
+  /* The voltage scaling allows optimizing the power consumption when the device is
168
+    clocked below the maximum system frequency, to update the voltage scaling value
169
+    regarding system frequency refer to product datasheet. */
170
+  __HAL_RCC_PWR_CLK_ENABLE();
171
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
172
+
173
+  // Enable HSI oscillator and activate PLL with HSI as source
174
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
175
+  RCC_OscInitStruct.HSIState            = RCC_HSI_ON;
176
+  RCC_OscInitStruct.HSEState            = RCC_HSE_OFF;
177
+  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
178
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
179
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSI;
180
+  RCC_OscInitStruct.PLL.PLLM            = 16;            // VCO input clock = 1 MHz (16 MHz / 16)
181
+  RCC_OscInitStruct.PLL.PLLN            = 336;           // VCO output clock = 336 MHz (1 MHz * 336)
182
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
183
+  RCC_OscInitStruct.PLL.PLLQ            = 7;             // USB clock = 48 MHz (336 MHz / 7) --> freq is ok but not precise enough
184
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
185
+    return 0; // FAIL
186
+  }
187
+
188
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
189
+  RCC_ClkInitStruct.ClockType      = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
190
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
191
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 84 MHz
192
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;           // 42 MHz
193
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;           // 84 MHz
194
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
195
+    return 0; // FAIL
196
+  }
197
+
198
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
199
+  //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
200
+
201
+  return 1; // OK
202
+}
203
+
204
+WEAK void SystemClock_Config(void)
205
+{
206
+  /* 1- If fail try to start with HSE and external xtal */
207
+  if (SetSysClock_PLL_HSE(0) == 0) {
208
+    /* 2- Try to start with HSE and external clock */
209
+    if (SetSysClock_PLL_HSE(1) == 0) {
210
+      /* 3- If fail start with HSI clock */
211
+      if (SetSysClock_PLL_HSI() == 0) {
212
+        Error_Handler();
213
+      }
214
+    }
215
+  }
216
+  /* Output clock on MCO2 pin(PC9) for debugging purpose */
217
+  //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4);
218
+}
219
+
220
+#ifdef __cplusplus
221
+}
222
+#endif
223
+#endif /* STM32F401xC */

+ 186
- 0
buildroot/share/PlatformIO/variants/MARLIN_F401RC/variant_MARLIN_STM32F401RC.h View File

@@ -0,0 +1,186 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2020-2021, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * This software component is licensed by ST under BSD 3-Clause license,
7
+ * the "License"; You may not use this file except in compliance with the
8
+ * License. You may obtain a copy of the License at:
9
+ *                        opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ *******************************************************************************
12
+ */
13
+#pragma once
14
+
15
+/*----------------------------------------------------------------------------
16
+ *        STM32 pins number
17
+ *----------------------------------------------------------------------------*/
18
+#define PA0                     PIN_A0
19
+#define PA1                     PIN_A1
20
+#define PA2                     PIN_A2
21
+#define PA3                     PIN_A3
22
+#define PA4                     PIN_A4
23
+#define PA5                     PIN_A5
24
+#define PA6                     PIN_A6
25
+#define PA7                     PIN_A7
26
+#define PA8                     8
27
+#define PA9                     9
28
+#define PA10                    10
29
+#define PA11                    11
30
+#define PA12                    12
31
+#define PA13                    13
32
+#define PA14                    14
33
+#define PA15                    15
34
+#define PB0                     PIN_A8
35
+#define PB1                     PIN_A9
36
+#define PB2                     18
37
+#define PB3                     19
38
+#define PB4                     20
39
+#define PB5                     21
40
+#define PB6                     22
41
+#define PB7                     23
42
+#define PB8                     24
43
+#define PB9                     25
44
+#define PB10                    26
45
+#define PB12                    27
46
+#define PB13                    28
47
+#define PB14                    29
48
+#define PB15                    30
49
+#define PC0                     PIN_A10
50
+#define PC1                     PIN_A11
51
+#define PC2                     PIN_A12
52
+#define PC3                     PIN_A13
53
+#define PC4                     PIN_A14
54
+#define PC5                     PIN_A15
55
+#define PC6                     37
56
+#define PC7                     38
57
+#define PC8                     39
58
+#define PC9                     40
59
+#define PC10                    41
60
+#define PC11                    42
61
+#define PC12                    43
62
+#define PC13                    44
63
+#define PC14                    45
64
+#define PC15                    46
65
+#define PD2                     47
66
+#define PH0                     48
67
+#define PH1                     49
68
+
69
+// Alternate pins number
70
+#define PA0_ALT1                (PA0  | ALT1)
71
+#define PA1_ALT1                (PA1  | ALT1)
72
+#define PA2_ALT1                (PA2  | ALT1)
73
+#define PA2_ALT2                (PA2  | ALT2)
74
+#define PA3_ALT1                (PA3  | ALT1)
75
+#define PA3_ALT2                (PA3  | ALT2)
76
+#define PA4_ALT1                (PA4  | ALT1)
77
+#define PA7_ALT1                (PA7  | ALT1)
78
+#define PA15_ALT1               (PA15 | ALT1)
79
+#define PB0_ALT1                (PB0  | ALT1)
80
+#define PB1_ALT1                (PB1  | ALT1)
81
+#define PB3_ALT1                (PB3  | ALT1)
82
+#define PB4_ALT1                (PB4  | ALT1)
83
+#define PB5_ALT1                (PB5  | ALT1)
84
+#define PB8_ALT1                (PB8  | ALT1)
85
+#define PB9_ALT1                (PB9  | ALT1)
86
+
87
+#define NUM_DIGITAL_PINS        50
88
+#define NUM_ANALOG_INPUTS       16
89
+#define NUM_ANALOG_FIRST        192
90
+
91
+// On-board LED pin number
92
+#ifndef LED_BUILTIN
93
+  #define LED_BUILTIN           PNUM_NOT_DEFINED
94
+#endif
95
+
96
+// On-board user button
97
+#ifndef USER_BTN
98
+  #define USER_BTN              PNUM_NOT_DEFINED
99
+#endif
100
+
101
+// SPI definitions
102
+#ifndef PIN_SPI_SS
103
+  #define PIN_SPI_SS            PA4
104
+#endif
105
+#ifndef PIN_SPI_SS1
106
+  #define PIN_SPI_SS1           PA15
107
+#endif
108
+#ifndef PIN_SPI_SS2
109
+  #define PIN_SPI_SS2           PNUM_NOT_DEFINED
110
+#endif
111
+#ifndef PIN_SPI_SS3
112
+  #define PIN_SPI_SS3           PNUM_NOT_DEFINED
113
+#endif
114
+#ifndef PIN_SPI_MOSI
115
+  #define PIN_SPI_MOSI          PA7
116
+#endif
117
+#ifndef PIN_SPI_MISO
118
+  #define PIN_SPI_MISO          PA6
119
+#endif
120
+#ifndef PIN_SPI_SCK
121
+  #define PIN_SPI_SCK           PA5
122
+#endif
123
+
124
+// I2C definitions
125
+#ifndef PIN_WIRE_SDA
126
+  #define PIN_WIRE_SDA          PB3
127
+#endif
128
+#ifndef PIN_WIRE_SCL
129
+  #define PIN_WIRE_SCL          PB10
130
+#endif
131
+
132
+// Timer Definitions
133
+// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
134
+#ifndef TIMER_TONE
135
+  #define TIMER_TONE            TIM10
136
+#endif
137
+#ifndef TIMER_SERVO
138
+  #define TIMER_SERVO           TIM11
139
+#endif
140
+
141
+// UART Definitions
142
+#ifndef SERIAL_UART_INSTANCE
143
+  #define SERIAL_UART_INSTANCE  2
144
+#endif
145
+
146
+// Default pin used for generic 'Serial' instance
147
+// Mandatory for Firmata
148
+#ifndef PIN_SERIAL_RX
149
+  #define PIN_SERIAL_RX         PA3
150
+#endif
151
+#ifndef PIN_SERIAL_TX
152
+  #define PIN_SERIAL_TX         PA2
153
+#endif
154
+
155
+// Extra HAL modules
156
+#if !defined(HAL_SD_MODULE_DISABLED)
157
+  #define HAL_SD_MODULE_ENABLED
158
+#endif
159
+
160
+/*----------------------------------------------------------------------------
161
+ *        Arduino objects - C++ only
162
+ *----------------------------------------------------------------------------*/
163
+
164
+#ifdef __cplusplus
165
+  // These serial port names are intended to allow libraries and architecture-neutral
166
+  // sketches to automatically default to the correct port name for a particular type
167
+  // of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
168
+  // the first hardware serial port whose RX/TX pins are not dedicated to another use.
169
+  //
170
+  // SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
171
+  //
172
+  // SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
173
+  //
174
+  // SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
175
+  //
176
+  // SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
177
+  //
178
+  // SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
179
+  //                            pins are NOT connected to anything by default.
180
+  #ifndef SERIAL_PORT_MONITOR
181
+    #define SERIAL_PORT_MONITOR   Serial
182
+  #endif
183
+  #ifndef SERIAL_PORT_HARDWARE
184
+    #define SERIAL_PORT_HARDWARE  Serial
185
+  #endif
186
+#endif

+ 18
- 0
ini/stm32f4.ini View File

@@ -656,3 +656,21 @@ upload_protocol             = jlink
656 656
 extends                     = env:STM32F401RC_creality
657 657
 debug_tool                  = stlink
658 658
 upload_protocol             = stlink
659
+
660
+#
661
+# BigTree SKR mini E3 V3.0.1 (STM32F401RCT6 ARM Cortex-M4)
662
+#
663
+[env:STM32F401RC_btt]
664
+extends                     = stm32_variant
665
+platform                    = ststm32@~14.1.0
666
+platform_packages           = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip
667
+board                       = marlin_STM32F401RC
668
+board_build.offset          = 0x4000
669
+board_upload.offset_address = 0x08004000
670
+build_flags                 = ${stm32_variant.build_flags}
671
+                              -DPIN_SERIAL6_RX=PC_7 -DPIN_SERIAL6_TX=PC_6
672
+                              -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024
673
+                              -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4
674
+                              -DSTEP_TIMER_IRQ_PRIO=0
675
+upload_protocol             = stlink
676
+debug_tool                  = stlink

Loading…
Cancel
Save