Browse Source

✨ BigTreeTech SKR mini E3 V3.0 (STM32G0B1RET6) (#23283)

BigTreeTech 3 years ago
parent
commit
0077d982cd
No account linked to committer's email address

+ 5
- 1
Marlin/src/HAL/STM32/HAL.h View File

@@ -130,7 +130,11 @@
130 130
 // Types
131 131
 // ------------------------
132 132
 
133
-typedef int16_t pin_t;
133
+#ifdef STM32G0B1xx
134
+  typedef int32_t pin_t;
135
+#else
136
+  typedef int16_t pin_t;
137
+#endif
134 138
 
135 139
 #define HAL_SERVO_LIB libServo
136 140
 #define PAUSE_SERVO_OUTPUT() libServo::pause_all_servos()

+ 1
- 1
Marlin/src/HAL/STM32/HAL_MinSerial.cpp View File

@@ -135,7 +135,7 @@ void install_min_serial() {
135 135
   HAL_min_serial_out = &TX;
136 136
 }
137 137
 
138
-#if DISABLED(DYNAMIC_VECTORTABLE) && DISABLED(STM32F0xx) // Cortex M0 can't jump to a symbol that's too far from the current function, so we work around this in exception_arm.cpp
138
+#if NONE(DYNAMIC_VECTORTABLE, STM32F0xx, STM32G0xx) // Cortex M0 can't jump to a symbol that's too far from the current function, so we work around this in exception_arm.cpp
139 139
 extern "C" {
140 140
   __attribute__((naked)) void JumpHandler_ASM() {
141 141
     __asm__ __volatile__ (

+ 1
- 1
Marlin/src/HAL/STM32/timers.cpp View File

@@ -67,7 +67,7 @@
67 67
   #endif
68 68
 #endif
69 69
 
70
-#ifdef STM32F0xx
70
+#if defined(STM32F0xx) || defined(STM32G0xx)
71 71
   #define MCU_STEP_TIMER 16
72 72
   #define MCU_TEMP_TIMER 17
73 73
 #elif defined(STM32F1xx)

+ 1
- 1
Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp View File

@@ -41,7 +41,7 @@
41 41
   #define START_FLASH_ADDR  0x00000000
42 42
   #define END_FLASH_ADDR    0x00080000
43 43
 
44
-#elif defined(__STM32F1__) || defined(STM32F1xx) || defined(STM32F0xx)
44
+#elif defined(__STM32F1__) || defined(STM32F1xx) || defined(STM32F0xx) || defined(STM32G0xx)
45 45
 
46 46
   // For STM32F103ZET6/STM32F103VET6/STM32F0xx
47 47
   //  SRAM  (0x20000000 - 0x20010000) (64kb)

+ 1
- 1
Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp View File

@@ -101,7 +101,7 @@ struct __attribute__((packed)) ContextSavedFrame {
101 101
   uint32_t ELR;
102 102
 };
103 103
 
104
-#if DISABLED(STM32F0xx)
104
+#if NONE(STM32F0xx, STM32G0xx)
105 105
   extern "C"
106 106
   __attribute__((naked)) void CommonHandler_ASM() {
107 107
     __asm__ __volatile__ (

+ 34
- 33
Marlin/src/core/boards.h View File

@@ -324,39 +324,40 @@
324 324
 #define BOARD_BTT_SKR_MINI_E3_V1_0    4024  // BigTreeTech SKR Mini E3 (STM32F103RC)
325 325
 #define BOARD_BTT_SKR_MINI_E3_V1_2    4025  // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
326 326
 #define BOARD_BTT_SKR_MINI_E3_V2_0    4026  // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC / STM32F103RE)
327
-#define BOARD_BTT_SKR_MINI_MZ_V1_0    4027  // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
328
-#define BOARD_BTT_SKR_E3_DIP          4028  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
329
-#define BOARD_BTT_SKR_CR6             4029  // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
330
-#define BOARD_JGAURORA_A5S_A1         4030  // JGAurora A5S A1 (STM32F103ZET6)
331
-#define BOARD_FYSETC_AIO_II           4031  // FYSETC AIO_II
332
-#define BOARD_FYSETC_CHEETAH          4032  // FYSETC Cheetah
333
-#define BOARD_FYSETC_CHEETAH_V12      4033  // FYSETC Cheetah V1.2
334
-#define BOARD_LONGER3D_LK             4034  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
335
-#define BOARD_CCROBOT_MEEB_3DP        4035  // ccrobot-online.com MEEB_3DP (STM32F103RC)
336
-#define BOARD_CHITU3D_V5              4036  // Chitu3D TronXY X5SA V5 Board
337
-#define BOARD_CHITU3D_V6              4037  // Chitu3D TronXY X5SA V6 Board
338
-#define BOARD_CHITU3D_V9              4038  // Chitu3D TronXY X5SA V9 Board
339
-#define BOARD_CREALITY_V4             4039  // Creality v4.x (STM32F103RE)
340
-#define BOARD_CREALITY_V427           4040  // Creality v4.2.7 (STM32F103RE)
341
-#define BOARD_CREALITY_V4210          4041  // Creality v4.2.10 (STM32F103RE) as found in the CR-30
342
-#define BOARD_CREALITY_V431           4042  // Creality v4.3.1 (STM32F103RE)
343
-#define BOARD_CREALITY_V431_A         4043  // Creality v4.3.1a (STM32F103RE)
344
-#define BOARD_CREALITY_V431_B         4044  // Creality v4.3.1b (STM32F103RE)
345
-#define BOARD_CREALITY_V431_C         4045  // Creality v4.3.1c (STM32F103RE)
346
-#define BOARD_CREALITY_V431_D         4046  // Creality v4.3.1d (STM32F103RE)
347
-#define BOARD_CREALITY_V452           4047  // Creality v4.5.2 (STM32F103RE)
348
-#define BOARD_CREALITY_V453           4048  // Creality v4.5.3 (STM32F103RE)
349
-#define BOARD_CREALITY_V24S1          4049  // Creality v2.4.S1 (STM32F103RE) v101 as found in the Ender 7
350
-#define BOARD_TRIGORILLA_PRO          4050  // Trigorilla Pro (STM32F103ZET6)
351
-#define BOARD_FLY_MINI                4051  // FLYmaker FLY MINI (STM32F103RCT6)
352
-#define BOARD_FLSUN_HISPEED           4052  // FLSUN HiSpeedV1 (STM32F103VET6)
353
-#define BOARD_BEAST                   4053  // STM32F103RET6 Libmaple-based controller
354
-#define BOARD_MINGDA_MPX_ARM_MINI     4054  // STM32F103ZET6 Mingda MD-16
355
-#define BOARD_GTM32_PRO_VD            4055  // STM32F103VET6 controller
356
-#define BOARD_ZONESTAR_ZM3E2          4056  // Zonestar ZM3E2    (STM32F103RCT6)
357
-#define BOARD_ZONESTAR_ZM3E4          4057  // Zonestar ZM3E4 V1 (STM32F103VCT6)
358
-#define BOARD_ZONESTAR_ZM3E4V2        4058  // Zonestar ZM3E4 V2 (STM32F103VCT6)
359
-#define BOARD_ERYONE_ERY32_MINI       4059  // Eryone Ery32 mini (STM32F103VET6)
327
+#define BOARD_BTT_SKR_MINI_E3_V3_0    4027  // BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RE)
328
+#define BOARD_BTT_SKR_MINI_MZ_V1_0    4028  // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
329
+#define BOARD_BTT_SKR_E3_DIP          4029  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
330
+#define BOARD_BTT_SKR_CR6             4030  // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
331
+#define BOARD_JGAURORA_A5S_A1         4031  // JGAurora A5S A1 (STM32F103ZET6)
332
+#define BOARD_FYSETC_AIO_II           4032  // FYSETC AIO_II
333
+#define BOARD_FYSETC_CHEETAH          4033  // FYSETC Cheetah
334
+#define BOARD_FYSETC_CHEETAH_V12      4034  // FYSETC Cheetah V1.2
335
+#define BOARD_LONGER3D_LK             4035  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
336
+#define BOARD_CCROBOT_MEEB_3DP        4036  // ccrobot-online.com MEEB_3DP (STM32F103RC)
337
+#define BOARD_CHITU3D_V5              4037  // Chitu3D TronXY X5SA V5 Board
338
+#define BOARD_CHITU3D_V6              4038  // Chitu3D TronXY X5SA V6 Board
339
+#define BOARD_CHITU3D_V9              4039  // Chitu3D TronXY X5SA V9 Board
340
+#define BOARD_CREALITY_V4             4040  // Creality v4.x (STM32F103RE)
341
+#define BOARD_CREALITY_V427           4041  // Creality v4.2.7 (STM32F103RE)
342
+#define BOARD_CREALITY_V4210          4042  // Creality v4.2.10 (STM32F103RE) as found in the CR-30
343
+#define BOARD_CREALITY_V431           4043  // Creality v4.3.1 (STM32F103RE)
344
+#define BOARD_CREALITY_V431_A         4044  // Creality v4.3.1a (STM32F103RE)
345
+#define BOARD_CREALITY_V431_B         4045  // Creality v4.3.1b (STM32F103RE)
346
+#define BOARD_CREALITY_V431_C         4046  // Creality v4.3.1c (STM32F103RE)
347
+#define BOARD_CREALITY_V431_D         4047  // Creality v4.3.1d (STM32F103RE)
348
+#define BOARD_CREALITY_V452           4048  // Creality v4.5.2 (STM32F103RE)
349
+#define BOARD_CREALITY_V453           4049  // Creality v4.5.3 (STM32F103RE)
350
+#define BOARD_CREALITY_V24S1          4050  // Creality v2.4.S1 (STM32F103RE) v101 as found in the Ender 7
351
+#define BOARD_TRIGORILLA_PRO          4051  // Trigorilla Pro (STM32F103ZET6)
352
+#define BOARD_FLY_MINI                4052  // FLYmaker FLY MINI (STM32F103RCT6)
353
+#define BOARD_FLSUN_HISPEED           4053  // FLSUN HiSpeedV1 (STM32F103VET6)
354
+#define BOARD_BEAST                   4054  // STM32F103RET6 Libmaple-based controller
355
+#define BOARD_MINGDA_MPX_ARM_MINI     4055  // STM32F103ZET6 Mingda MD-16
356
+#define BOARD_GTM32_PRO_VD            4056  // STM32F103VET6 controller
357
+#define BOARD_ZONESTAR_ZM3E2          4057  // Zonestar ZM3E2    (STM32F103RCT6)
358
+#define BOARD_ZONESTAR_ZM3E4          4058  // Zonestar ZM3E4 V1 (STM32F103VCT6)
359
+#define BOARD_ZONESTAR_ZM3E4V2        4059  // Zonestar ZM3E4 V2 (STM32F103VCT6)
360
+#define BOARD_ERYONE_ERY32_MINI       4060  // Eryone Ery32 mini (STM32F103VET6)
360 361
 
361 362
 //
362 363
 // ARM Cortex-M4F

+ 1
- 1
Marlin/src/module/stepper.cpp View File

@@ -1380,7 +1380,7 @@ void Stepper::set_directions() {
1380 1380
     }
1381 1381
 
1382 1382
     FORCE_INLINE int32_t Stepper::_eval_bezier_curve(const uint32_t curr_step) {
1383
-      #if defined(__arm__) || defined(__thumb__)
1383
+      #if (defined(__arm__) || defined(__thumb__)) && !defined(STM32G0B1xx) // TODO: Test define STM32G0xx versus STM32G0B1xx
1384 1384
 
1385 1385
         // For ARM Cortex M3/M4 CPUs, we have the optimized assembler version, that takes 43 cycles to execute
1386 1386
         uint32_t flo = 0;

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

@@ -527,6 +527,8 @@
527 527
   #include "stm32f1/pins_BTT_SKR_MINI_E3_V1_2.h"  // STM32F1                              env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple
528 528
 #elif MB(BTT_SKR_MINI_E3_V2_0)
529 529
   #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
530
+#elif MB(BTT_SKR_MINI_E3_V3_0)
531
+  #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h"  // STM32G0                              env:STM32G0B1RE_btt
530 532
 #elif MB(BTT_SKR_MINI_MZ_V1_0)
531 533
   #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
532 534
 #elif MB(BTT_SKR_E3_DIP)

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

@@ -206,7 +206,7 @@
206 206
       /**
207 207
        * TFTGLCD_PANEL_SPI display pinout
208 208
        *
209
-       *               Board                                      Display
209
+       *               Board                                        Display
210 210
        *               ------                                       ------
211 211
        *           5V | 1  2 | GND                (SPI1-MISO) MISO | 1  2 | SCK   (SPI1-SCK)
212 212
        * (FREE)   PB7 | 3  4 | PB8  (LCD_CS)      (PA9)     LCD_CS | 3  4 | SD_CS (PA10)
@@ -249,7 +249,7 @@
249 249
   /**
250 250
    * FYSETC TFT TFT81050 display pinout
251 251
    *
252
-   *               Board                                      Display
252
+   *               Board                                        Display
253 253
    *               ------                                       ------
254 254
    *           5V | 1  2 | GND                (SPI1-MISO) MISO | 1  2 | SCK   (SPI1-SCK)
255 255
    * (FREE)   PB7 | 3  4 | PB8  (LCD_CS)      (PA9)  MOD_RESET | 3  4 | SD_CS (PA10)

+ 332
- 0
Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h View File

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

+ 47
- 0
buildroot/share/PlatformIO/boards/marlin_STM32G0B1RE.json View File

@@ -0,0 +1,47 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m0plus",
5
+    "extra_flags": "-DSTM32G0xx -DSTM32G0B1xx",
6
+    "f_cpu": "64000000L",
7
+    "framework_extra_flags": {
8
+      "arduino": "-D__CORTEX_SC=0"
9
+    },
10
+    "mcu": "stm32g0b1ret6",
11
+    "product_line": "STM32G0B1xx",
12
+    "variant": "STM32G0xx/MARLIN_G0B1RE"
13
+  },
14
+  "debug": {
15
+    "default_tools": [
16
+      "stlink"
17
+    ],
18
+    "jlink_device": "STM32G0B1RE",
19
+    "onboard_tools": [
20
+      "stlink"
21
+    ],
22
+    "openocd_target": "stm32g0x",
23
+    "svd_path": "STM32G0B1.svd"
24
+  },
25
+  "frameworks": [
26
+    "arduino",
27
+    "cmsis",
28
+    "libopencm3",
29
+    "stm32cube",
30
+    "zephyr"
31
+  ],
32
+  "name": "STM32G0B1RE",
33
+  "upload": {
34
+    "maximum_ram_size": 147456,
35
+    "maximum_size": 524288,
36
+    "protocol": "stlink",
37
+    "protocols": [
38
+      "stlink",
39
+      "jlink",
40
+      "cmsis-dap",
41
+      "blackmagic",
42
+      "mbed"
43
+    ]
44
+  },
45
+  "url": "https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32g0-series/stm32g0x1.html",
46
+  "vendor": "ST"
47
+}

+ 1
- 1
buildroot/share/PlatformIO/scripts/generic_create_variant.py View File

@@ -30,7 +30,7 @@ if pioutil.is_pio_build():
30 30
 	else:
31 31
 		platform_name = PackageSpec(platform_packages[0]).name
32 32
 
33
-	if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround" ]:
33
+	if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround", "main" ]:
34 34
 		platform_name = "framework-arduinoststm32"
35 35
 
36 36
 	FRAMEWORK_DIR = platform.get_package_dir(platform_name)

+ 428
- 0
buildroot/share/PlatformIO/variants/STM32G0xx/MARLIN_G0B1RE/PeripheralPins.c View File

@@ -0,0 +1,428 @@
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 STM32G0B1R(B-C-E)IxN.xml, STM32G0B1R(B-C-E)TxN.xml
15
+ * STM32G0C1R(C-E)IxN.xml, STM32G0C1R(C-E)TxN.xml
16
+ * CubeMX DB release 6.0.30
17
+ */
18
+#if !defined(CUSTOM_PERIPHERAL_PINS)
19
+#include "Arduino.h"
20
+#include "PeripheralPins.h"
21
+
22
+/* =====
23
+ * Notes:
24
+ * - The pins mentioned Px_y_ALTz are alternative possibilities which use other
25
+ *   HW peripheral instances. You can use them the same way as any other "normal"
26
+ *   pin (i.e. analogWrite(PA7_ALT1, 128);).
27
+ *
28
+ * - Commented lines are alternative possibilities which are not used per default.
29
+ *   If you change them, you will have to know what you do
30
+ * =====
31
+ */
32
+
33
+//*** ADC ***
34
+
35
+#ifdef HAL_ADC_MODULE_ENABLED
36
+WEAK const PinMap PinMap_ADC[] = {
37
+  {PA_0,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
38
+  {PA_1,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
39
+  {PA_2,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
40
+  {PA_3,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
41
+  {PA_4,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
42
+  {PA_5,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
43
+  {PA_6,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
44
+  {PA_7,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
45
+  {PB_0,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
46
+  {PB_1,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
47
+  {PB_2,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
48
+  {PB_10, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
49
+  {PB_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
50
+  {PB_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16
51
+  {PC_4,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_IN17
52
+  {PC_5,  ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_IN18
53
+  {NC,    NP,   0}
54
+};
55
+#endif
56
+
57
+//*** DAC ***
58
+
59
+#ifdef HAL_DAC_MODULE_ENABLED
60
+WEAK const PinMap PinMap_DAC[] = {
61
+  {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1
62
+  {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2
63
+  {NC,   NP,   0}
64
+};
65
+#endif
66
+
67
+//*** I2C ***
68
+
69
+#ifdef HAL_I2C_MODULE_ENABLED
70
+WEAK const PinMap PinMap_I2C_SDA[] = {
71
+  {PA_6,         I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
72
+  {PA_6_ALT1,    I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)},
73
+  {PA_10,        I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
74
+  {PA_10_ALT1,   I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
75
+  {PA_10_R,      I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
76
+  {PA_10_R_ALT1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
77
+  {PA_12,        I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
78
+  {PB_4,         I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
79
+  {PB_4_ALT1,    I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C3)},
80
+  {PB_7,         I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
81
+  {PB_9,         I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
82
+  {PB_11,        I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
83
+  {PB_14,        I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
84
+  {PC_1,         I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C3)},
85
+  {NC,           NP,   0}
86
+};
87
+#endif
88
+
89
+#ifdef HAL_I2C_MODULE_ENABLED
90
+WEAK const PinMap PinMap_I2C_SCL[] = {
91
+  {PA_7,        I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
92
+  {PA_7_ALT1,   I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)},
93
+  {PA_9,        I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
94
+  {PA_9_ALT1,   I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
95
+  {PA_9_R,      I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
96
+  {PA_9_R_ALT1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
97
+  {PA_11,       I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
98
+  {PB_3,        I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF8_I2C2)},
99
+  {PB_3_ALT1,   I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C3)},
100
+  {PB_6,        I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
101
+  {PB_8,        I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)},
102
+  {PB_10,       I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
103
+  {PB_13,       I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)},
104
+  {PC_0,        I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C3)},
105
+  {NC,          NP,   0}
106
+};
107
+#endif
108
+
109
+//*** TIM ***
110
+
111
+#ifdef HAL_TIM_MODULE_ENABLED
112
+WEAK const PinMap PinMap_TIM[] = {
113
+  {PA_0,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
114
+  {PA_1,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2
115
+  {PA_1_ALT1,  TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 1, 1)}, // TIM15_CH1N
116
+  {PA_2,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3
117
+  {PA_2_ALT1,  TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 1, 0)}, // TIM15_CH1
118
+  {PA_3,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 4, 0)}, // TIM2_CH4
119
+  {PA_3_ALT1,  TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 2, 0)}, // TIM15_CH2
120
+  {PA_4,       TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1
121
+  {PA_5,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
122
+  {PA_6,       TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1
123
+  {PA_6_ALT1,  TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM16, 1, 0)}, // TIM16_CH1
124
+  {PA_7,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 1)}, // TIM1_CH1N
125
+  {PA_7_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2
126
+  {PA_7_ALT2,  TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1
127
+  {PA_7_ALT3,  TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM17, 1, 0)}, // TIM17_CH1
128
+  {PA_8,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 0)}, // TIM1_CH1
129
+  {PA_9,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2
130
+  {PA_9_R,     TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2
131
+  {PA_10,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3
132
+  {PA_10_R,    TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3
133
+  {PA_11,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 4, 0)}, // TIM1_CH4
134
+  {PA_15,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
135
+  {PB_0,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 1)}, // TIM1_CH2N
136
+  {PB_0_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 3, 0)}, // TIM3_CH3
137
+  {PB_1,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N
138
+  {PB_1_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4
139
+  {PB_1_ALT2,  TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM14, 1, 0)}, // TIM14_CH1
140
+  {PB_3,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
141
+  {PB_3_ALT1,  TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2
142
+  {PB_4,       TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1
143
+  {PB_5,       TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2
144
+  {PB_6,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
145
+  {PB_6_ALT1,  TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM4, 1, 0)}, // TIM4_CH1
146
+  {PB_6_ALT2,  TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM16, 1, 1)}, // TIM16_CH1N
147
+  {PB_7,       TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM4, 2, 0)}, // TIM4_CH2
148
+  {PB_7_ALT1,  TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 1)}, // TIM17_CH1N
149
+  {PB_8,       TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM4, 3, 0)}, // TIM4_CH3
150
+  {PB_8_ALT1,  TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM16, 1, 0)}, // TIM16_CH1
151
+  {PB_9,       TIM4,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM4, 4, 0)}, // TIM4_CH4
152
+  {PB_9_ALT1,  TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 0)}, // TIM17_CH1
153
+  {PB_10,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3
154
+  {PB_11,      TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 4, 0)}, // TIM2_CH4
155
+  {PB_13,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 1)}, // TIM1_CH1N
156
+  {PB_13_ALT1, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 1, 1)}, // TIM15_CH1N
157
+  {PB_14,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 1)}, // TIM1_CH2N
158
+  {PB_14_ALT1, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 1, 0)}, // TIM15_CH1
159
+  {PB_15,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N
160
+  {PB_15_ALT1, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N
161
+  {PB_15_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM15, 2, 0)}, // TIM15_CH2
162
+  {PC_1,       TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 0)}, // TIM15_CH1
163
+  {PC_2,       TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 2, 0)}, // TIM15_CH2
164
+  {PC_4,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1
165
+  {PC_5,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2
166
+  {PC_6,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3
167
+  {PC_6_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1
168
+  {PC_7,       TIM2,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 4, 0)}, // TIM2_CH4
169
+  {PC_7_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2
170
+  {PC_8,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 0)}, // TIM1_CH1
171
+  {PC_8_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 3, 0)}, // TIM3_CH3
172
+  {PC_9,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 0)}, // TIM1_CH2
173
+  {PC_9_ALT1,  TIM3,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4
174
+  {PC_10,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3
175
+  {PC_11,      TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 4, 0)}, // TIM1_CH4
176
+  {PC_12,      TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM14, 1, 0)}, // TIM14_CH1
177
+  {PD_0,       TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM16, 1, 0)}, // TIM16_CH1
178
+  {PD_1,       TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 0)}, // TIM17_CH1
179
+  {PD_2,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 1)}, // TIM1_CH1N
180
+  {PD_3,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 2, 1)}, // TIM1_CH2N
181
+  {PD_4,       TIM1,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 1)}, // TIM1_CH3N
182
+  {PF_0,       TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM14, 1, 0)}, // TIM14_CH1
183
+  {PF_1,       TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 1)}, // TIM15_CH1N
184
+  {NC,         NP,    0}
185
+};
186
+#endif
187
+
188
+//*** UART ***
189
+
190
+#ifdef HAL_UART_MODULE_ENABLED
191
+WEAK const PinMap PinMap_UART_TX[] = {
192
+  {PA_0,       USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART4)},
193
+  {PA_2,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
194
+  {PA_2_ALT1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
195
+  {PA_4,       USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART6)},
196
+  {PA_5,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
197
+  {PA_9,       USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
198
+  {PA_9_R,     USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
199
+  {PA_14,      LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
200
+  {PA_14_ALT1, USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
201
+  {PB_0,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART5)},
202
+  {PB_2,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
203
+  {PB_3,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
204
+  {PB_6,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
205
+  {PB_6_ALT1,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)},
206
+  {PB_8,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
207
+  {PB_8_ALT1,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
208
+  {PB_10,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
209
+  {PB_11,      LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
210
+  {PC_0,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
211
+  {PC_0_ALT1,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART6)},
212
+  {PC_1,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
213
+  {PC_4,       USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
214
+  {PC_4_ALT1,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART3)},
215
+  {PC_6,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
216
+  {PC_10,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART3)},
217
+  {PC_10_ALT1, USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART4)},
218
+  {PC_12,      USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
219
+  {PD_3,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
220
+  {PD_5,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)},
221
+  {PF_2,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART2)},
222
+  {NC,         NP,      0}
223
+};
224
+#endif
225
+
226
+#ifdef HAL_UART_MODULE_ENABLED
227
+WEAK const PinMap PinMap_UART_RX[] = {
228
+  {PA_1,       USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART4)},
229
+  {PA_3,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
230
+  {PA_3_ALT1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
231
+  {PA_5,       USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART6)},
232
+  {PA_10,      USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
233
+  {PA_10_R,    USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
234
+  {PA_13,      LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
235
+  {PA_15,      USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
236
+  {PB_0,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
237
+  {PB_1,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART5)},
238
+  {PB_4,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
239
+  {PB_7,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
240
+  {PB_7_ALT1,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)},
241
+  {PB_9,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
242
+  {PB_9_ALT1,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
243
+  {PB_10,      LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
244
+  {PB_11,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
245
+  {PC_0,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
246
+  {PC_1,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
247
+  {PC_1_ALT1,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART6)},
248
+  {PC_5,       USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
249
+  {PC_5_ALT1,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART3)},
250
+  {PC_7,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
251
+  {PC_11,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART3)},
252
+  {PC_11_ALT1, USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART4)},
253
+  {PD_2,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
254
+  {PD_6,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)},
255
+  {NC,         NP,      0}
256
+};
257
+#endif
258
+
259
+#ifdef HAL_UART_MODULE_ENABLED
260
+WEAK const PinMap PinMap_UART_RTS[] = {
261
+  {PA_1,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
262
+  {PA_7,       USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART6)},
263
+  {PA_12,      USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
264
+  {PA_15,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_USART3)},
265
+  {PA_15_ALT1, USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART4)},
266
+  {PB_1,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
267
+  {PB_1_ALT1,  LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
268
+  {PB_1_ALT2,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
269
+  {PB_3,       USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)},
270
+  {PB_5,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART5)},
271
+  {PB_12,      LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
272
+  {PB_14,      USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
273
+  {PB_14_ALT1, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
274
+  {PC_9,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
275
+  {PD_2,       USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART3)},
276
+  {PD_4,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)},
277
+  {PD_4_ALT1,  USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
278
+  {PF_2,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
279
+  {NC,         NP,      0}
280
+};
281
+#endif
282
+
283
+#ifdef HAL_UART_MODULE_ENABLED
284
+WEAK const PinMap PinMap_UART_CTS[] = {
285
+  {PA_0,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)},
286
+  {PA_6,       LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)},
287
+  {PA_6_ALT1,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
288
+  {PA_6_ALT2,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART6)},
289
+  {PA_11,      USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)},
290
+  {PB_0,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_LPUART2)},
291
+  {PB_4,       USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)},
292
+  {PB_6,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART5)},
293
+  {PB_7,       USART4,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART4)},
294
+  {PB_13,      LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_LPUART1)},
295
+  {PB_13_ALT1, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART3)},
296
+  {PB_15,      USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
297
+  {PC_8,       LPUART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART2)},
298
+  {PD_3,       USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART2)},
299
+  {PD_5,       USART5,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART5)},
300
+  {NC,         NP,      0}
301
+};
302
+#endif
303
+
304
+//*** SPI ***
305
+
306
+#ifdef HAL_SPI_MODULE_ENABLED
307
+WEAK const PinMap PinMap_SPI_MOSI[] = {
308
+  {PA_2,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
309
+  {PA_4,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
310
+  {PA_7,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
311
+  {PA_10,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
312
+  {PA_10_R,   SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
313
+  {PA_12,     SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
314
+  {PB_5,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
315
+  {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SPI3)},
316
+  {PB_7,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
317
+  {PB_11,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
318
+  {PB_15,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
319
+  {PC_3,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
320
+  {PC_12,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI3)},
321
+  {PD_4,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
322
+  {PD_6,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI1)},
323
+  {NC,        NP,   0}
324
+};
325
+#endif
326
+
327
+#ifdef HAL_SPI_MODULE_ENABLED
328
+WEAK const PinMap PinMap_SPI_MISO[] = {
329
+  {PA_3,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
330
+  {PA_6,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
331
+  {PA_9,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI2)},
332
+  {PA_9_R,    SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI2)},
333
+  {PA_11,     SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
334
+  {PB_2,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
335
+  {PB_4,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
336
+  {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SPI3)},
337
+  {PB_6,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI2)},
338
+  {PB_14,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
339
+  {PC_2,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
340
+  {PC_11,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI3)},
341
+  {PD_3,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
342
+  {PD_5,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI1)},
343
+  {NC,        NP,   0}
344
+};
345
+#endif
346
+
347
+#ifdef HAL_SPI_MODULE_ENABLED
348
+WEAK const PinMap PinMap_SPI_SCLK[] = {
349
+  {PA_0,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
350
+  {PA_1,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
351
+  {PA_5,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
352
+  {PB_3,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
353
+  {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SPI3)},
354
+  {PB_8,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
355
+  {PB_10,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
356
+  {PB_13,     SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
357
+  {PC_10,     SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_SPI3)},
358
+  {PD_1,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
359
+  {NC,        NP,   0}
360
+};
361
+#endif
362
+
363
+#ifdef HAL_SPI_MODULE_ENABLED
364
+WEAK const PinMap PinMap_SPI_SSEL[] = {
365
+  {PA_4,       SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
366
+  {PA_4_ALT1,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SPI3)},
367
+  {PA_8,       SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
368
+  {PA_15,      SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
369
+  {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SPI3)},
370
+  {PB_0,       SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)},
371
+  {PB_9,       SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
372
+  {PB_12,      SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
373
+  {PD_0,       SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)},
374
+  {NC,         NP,   0}
375
+};
376
+#endif
377
+
378
+//*** FDCAN ***
379
+
380
+#ifdef HAL_FDCAN_MODULE_ENABLED
381
+WEAK const PinMap PinMap_CAN_RD[] = {
382
+  {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
383
+  {PB_0,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
384
+  {PB_5,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
385
+  {PB_8,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
386
+  {PB_12, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
387
+  {PC_2,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
388
+  {PC_4,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
389
+  {PD_0,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
390
+  {NC,    NP,     0}
391
+};
392
+#endif
393
+
394
+#ifdef HAL_FDCAN_MODULE_ENABLED
395
+WEAK const PinMap PinMap_CAN_TD[] = {
396
+  {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
397
+  {PB_1,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
398
+  {PB_6,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
399
+  {PB_9,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
400
+  {PB_13, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
401
+  {PC_3,  FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN2)},
402
+  {PC_5,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
403
+  {PD_1,  FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_FDCAN1)},
404
+  {NC,    NP,     0}
405
+};
406
+#endif
407
+
408
+//*** No ETHERNET ***
409
+
410
+//*** No QUADSPI ***
411
+
412
+//*** USB ***
413
+
414
+#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED)
415
+WEAK const PinMap PinMap_USB_DRD_FS[] = {
416
+  // {PA_4,  USB_DRD_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_USB)}, // USB_NOE
417
+  {PA_11, USB_DRD_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_DM
418
+  {PA_12, USB_DRD_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_DP
419
+  // {PA_13, USB_DRD_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_USB)}, // USB_NOE
420
+  // {PA_15, USB_DRD_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USB)}, // USB_NOE
421
+  // {PC_9,  USB_DRD_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USB)}, // USB_NOE
422
+  {NC,    NP,         0}
423
+};
424
+#endif
425
+
426
+//*** No SD ***
427
+
428
+#endif /* !CUSTOM_PERIPHERAL_PINS */

+ 90
- 0
buildroot/share/PlatformIO/variants/STM32G0xx/MARLIN_G0B1RE/PinNamesVar.h View File

@@ -0,0 +1,90 @@
1
+/* Remap pin name */
2
+PA_9_R       = PA_9    | PREMAP,
3
+PA_10_R      = PA_10   | PREMAP,
4
+
5
+/* Alternate pin name */
6
+PA_1_ALT1    = PA_1    | ALT1,
7
+PA_2_ALT1    = PA_2    | ALT1,
8
+PA_3_ALT1    = PA_3    | ALT1,
9
+PA_4_ALT1    = PA_4    | ALT1,
10
+PA_6_ALT1    = PA_6    | ALT1,
11
+PA_6_ALT2    = PA_6    | ALT2,
12
+PA_7_ALT1    = PA_7    | ALT1,
13
+PA_7_ALT2    = PA_7    | ALT2,
14
+PA_7_ALT3    = PA_7    | ALT3,
15
+PA_9_ALT1    = PA_9    | ALT1,
16
+PA_9_R_ALT1  = PA_9_R  | ALT1,
17
+PA_10_ALT1   = PA_10   | ALT1,
18
+PA_10_R_ALT1 = PA_10_R | ALT1,
19
+PA_14_ALT1   = PA_14   | ALT1,
20
+PA_15_ALT1   = PA_15   | ALT1,
21
+PB_0_ALT1    = PB_0    | ALT1,
22
+PB_1_ALT1    = PB_1    | ALT1,
23
+PB_1_ALT2    = PB_1    | ALT2,
24
+PB_3_ALT1    = PB_3    | ALT1,
25
+PB_4_ALT1    = PB_4    | ALT1,
26
+PB_5_ALT1    = PB_5    | ALT1,
27
+PB_6_ALT1    = PB_6    | ALT1,
28
+PB_6_ALT2    = PB_6    | ALT2,
29
+PB_7_ALT1    = PB_7    | ALT1,
30
+PB_8_ALT1    = PB_8    | ALT1,
31
+PB_9_ALT1    = PB_9    | ALT1,
32
+PB_13_ALT1   = PB_13   | ALT1,
33
+PB_14_ALT1   = PB_14   | ALT1,
34
+PB_15_ALT1   = PB_15   | ALT1,
35
+PB_15_ALT2   = PB_15   | ALT2,
36
+PC_0_ALT1    = PC_0    | ALT1,
37
+PC_1_ALT1    = PC_1    | ALT1,
38
+PC_4_ALT1    = PC_4    | ALT1,
39
+PC_5_ALT1    = PC_5    | ALT1,
40
+PC_6_ALT1    = PC_6    | ALT1,
41
+PC_7_ALT1    = PC_7    | ALT1,
42
+PC_8_ALT1    = PC_8    | ALT1,
43
+PC_9_ALT1    = PC_9    | ALT1,
44
+PC_10_ALT1   = PC_10   | ALT1,
45
+PC_11_ALT1   = PC_11   | ALT1,
46
+PD_4_ALT1    = PD_4    | ALT1,
47
+
48
+/* SYS_WKUP */
49
+#ifdef PWR_WAKEUP_PIN1
50
+  SYS_WKUP1 = PA_0,
51
+#endif
52
+#ifdef PWR_WAKEUP_PIN2
53
+  SYS_WKUP2 = PC_13,
54
+#endif
55
+#ifdef PWR_WAKEUP_PIN3
56
+  SYS_WKUP3 = NC,
57
+#endif
58
+#ifdef PWR_WAKEUP_PIN4
59
+  SYS_WKUP4 = PA_2,
60
+#endif
61
+#ifdef PWR_WAKEUP_PIN5
62
+  SYS_WKUP5 = PC_5,
63
+#endif
64
+#ifdef PWR_WAKEUP_PIN6
65
+  SYS_WKUP6 = PB_5,
66
+#endif
67
+#ifdef PWR_WAKEUP_PIN7
68
+  SYS_WKUP7 = NC,
69
+#endif
70
+#ifdef PWR_WAKEUP_PIN8
71
+  SYS_WKUP8 = NC,
72
+#endif
73
+
74
+/* USB */
75
+#ifdef USBCON
76
+  USB_DM  = PA_11,
77
+  USB_DP  = PA_12,
78
+  #ifdef USB_NOE_PA_4
79
+    USB_NOE = PA_4,
80
+  #endif
81
+  #ifdef USB_NOE_PA_13
82
+    USB_NOE = PA_13,
83
+  #endif
84
+  #ifdef USB_NOE_PA_15
85
+    USB_NOE = PA_15,
86
+  #endif
87
+  #ifdef USB_NOE_PC_9
88
+    USB_NOE = PC_9,
89
+  #endif
90
+#endif

+ 177
- 0
buildroot/share/PlatformIO/variants/STM32G0xx/MARLIN_G0B1RE/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 STM32G0B1RETx Device from STM32G0 series
6
+ *                      512Kbytes FLASH
7
+ *                      144Kbytes 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
+}

+ 177
- 0
buildroot/share/PlatformIO/variants/STM32G0xx/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.cpp View File

@@ -0,0 +1,177 @@
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(STM32G0B1xx)
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/A10
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/A11
46
+  PB_11,  // D27/A12
47
+  PB_12,  // D28/A13
48
+  PB_13,  // D29
49
+  PB_14,  // D30
50
+  PB_15,  // D31
51
+  PC_0,   // D32
52
+  PC_1,   // D33
53
+  PC_2,   // D34
54
+  PC_3,   // D35
55
+  PC_4,   // D36/A14
56
+  PC_5,   // D37/A15
57
+  PC_6,   // D38
58
+  PC_7,   // D39
59
+  PC_8,   // D40
60
+  PC_9,   // D41
61
+  PC_10,  // D42
62
+  PC_11,  // D43
63
+  PC_12,  // D44
64
+  PC_13,  // D45
65
+  PC_14,  // D46
66
+  PC_15,  // D47
67
+  PD_0,   // D48
68
+  PD_1,   // D49
69
+  PD_2,   // D50
70
+  PD_3,   // D51
71
+  PD_4,   // D52
72
+  PD_5,   // D53
73
+  PD_6,   // D54
74
+  PD_8,   // D55
75
+  PD_9,   // D56
76
+  PF_0,   // D57
77
+  PF_1,   // D58
78
+  PF_2,   // D59
79
+  PA_9_R, // D60
80
+  PA_10_R // D61
81
+};
82
+
83
+// Analog (Ax) pin number array
84
+const uint32_t analogInputPin[] = {
85
+  0,  // A0,  PA0
86
+  1,  // A1,  PA1
87
+  2,  // A2,  PA2
88
+  3,  // A3,  PA3
89
+  4,  // A4,  PA4
90
+  5,  // A5,  PA5
91
+  6,  // A6,  PA6
92
+  7,  // A7,  PA7
93
+  16, // A8,  PB0
94
+  17, // A9,  PB1
95
+  18, // A10, PB2
96
+  26, // A11, PB10
97
+  27, // A12, PB11
98
+  28, // A13, PB12
99
+  36, // A14, PC4
100
+  37  // A15, PC5
101
+};
102
+
103
+// ----------------------------------------------------------------------------
104
+
105
+#ifdef __cplusplus
106
+extern "C" {
107
+#endif
108
+
109
+/**
110
+  * @brief  System Clock Configuration
111
+  *         The system Clock is configured as follows :
112
+  *            System Clock source            = PLL (HSE)
113
+  *            SYSCLK(Hz)                     = 64000000
114
+  *            HCLK(Hz)                       = 64000000
115
+  *            AHB Prescaler                  = 1
116
+  *            APB1 Prescaler                 = 1
117
+  *            PLL_M                          = 1
118
+  *            PLL_N                          = 16
119
+  *            PLL_R                          = 2
120
+  *            PLL_P                          = 2
121
+  *            PLL_Q                          = 2
122
+  *            USB(Hz)                        = 48000000 (HSI48M)
123
+  * @param  None
124
+  * @retval None
125
+  */
126
+WEAK void SystemClock_Config(void)
127
+{
128
+  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
129
+  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
130
+  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
131
+
132
+  /** Configure the main internal regulator output voltage
133
+  */
134
+  HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
135
+  /** Initializes the RCC Oscillators according to the specified parameters
136
+  * in the RCC_OscInitTypeDef structure.
137
+  */
138
+  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_HSI48;
139
+  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
140
+  RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
141
+  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
142
+  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
143
+  RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
144
+  RCC_OscInitStruct.PLL.PLLN = 16;
145
+  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
146
+  RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
147
+  RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
148
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
149
+  {
150
+    Error_Handler();
151
+  }
152
+  /** Initializes the CPU, AHB and APB buses clocks
153
+  */
154
+  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
155
+                              |RCC_CLOCKTYPE_PCLK1;
156
+  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
157
+  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
158
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
159
+
160
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
161
+  {
162
+    Error_Handler();
163
+  }
164
+  /** Initializes the peripherals clocks
165
+  */
166
+  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
167
+  PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
168
+  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
169
+  {
170
+    Error_Handler();
171
+  }
172
+}
173
+
174
+#ifdef __cplusplus
175
+}
176
+#endif
177
+#endif /* STM32G0B1xx */

+ 199
- 0
buildroot/share/PlatformIO/variants/STM32G0xx/MARLIN_G0B1RE/variant_MARLIN_STM32G0B1RE.h View File

@@ -0,0 +1,199 @@
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                     PIN_A10
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                    PIN_A11
45
+#define PB11                    PIN_A12
46
+#define PB12                    PIN_A13
47
+#define PB13                    29
48
+#define PB14                    30
49
+#define PB15                    31
50
+#define PC0                     32
51
+#define PC1                     33
52
+#define PC2                     34
53
+#define PC3                     35
54
+#define PC4                     PIN_A14
55
+#define PC5                     PIN_A15
56
+#define PC6                     38
57
+#define PC7                     39
58
+#define PC8                     40
59
+#define PC9                     41
60
+#define PC10                    42
61
+#define PC11                    43
62
+#define PC12                    44
63
+#define PC13                    45
64
+#define PC14                    46
65
+#define PC15                    47
66
+#define PD0                     48
67
+#define PD1                     49
68
+#define PD2                     50
69
+#define PD3                     51
70
+#define PD4                     52
71
+#define PD5                     53
72
+#define PD6                     54
73
+#define PD8                     55
74
+#define PD9                     56
75
+#define PF0                     57
76
+#define PF1                     58
77
+#define PF2                     59
78
+#define PA9_R                   60
79
+#define PA10_R                  61
80
+
81
+// Alternate pins number
82
+#define PA1_ALT1                (PA1    | ALT1)
83
+#define PA2_ALT1                (PA2    | ALT1)
84
+#define PA3_ALT1                (PA3    | ALT1)
85
+#define PA4_ALT1                (PA4    | ALT1)
86
+#define PA6_ALT1                (PA6    | ALT1)
87
+#define PA6_ALT2                (PA6    | ALT2)
88
+#define PA7_ALT1                (PA7    | ALT1)
89
+#define PA7_ALT2                (PA7    | ALT2)
90
+#define PA7_ALT3                (PA7    | ALT3)
91
+#define PA9_ALT1                (PA9    | ALT1)
92
+#define PA9_R_ALT1              (PA9_R  | ALT1)
93
+#define PA10_ALT1               (PA10   | ALT1)
94
+#define PA10_R_ALT1             (PA10_R | ALT1)
95
+#define PA14_ALT1               (PA14   | ALT1)
96
+#define PA15_ALT1               (PA15   | ALT1)
97
+#define PB0_ALT1                (PB0    | ALT1)
98
+#define PB1_ALT1                (PB1    | ALT1)
99
+#define PB1_ALT2                (PB1    | ALT2)
100
+#define PB3_ALT1                (PB3    | ALT1)
101
+#define PB4_ALT1                (PB4    | ALT1)
102
+#define PB5_ALT1                (PB5    | ALT1)
103
+#define PB6_ALT1                (PB6    | ALT1)
104
+#define PB6_ALT2                (PB6    | ALT2)
105
+#define PB7_ALT1                (PB7    | ALT1)
106
+#define PB8_ALT1                (PB8    | ALT1)
107
+#define PB9_ALT1                (PB9    | ALT1)
108
+#define PB13_ALT1               (PB13   | ALT1)
109
+#define PB14_ALT1               (PB14   | ALT1)
110
+#define PB15_ALT1               (PB15   | ALT1)
111
+#define PB15_ALT2               (PB15   | ALT2)
112
+#define PC0_ALT1                (PC0    | ALT1)
113
+#define PC1_ALT1                (PC1    | ALT1)
114
+#define PC4_ALT1                (PC4    | ALT1)
115
+#define PC5_ALT1                (PC5    | ALT1)
116
+#define PC6_ALT1                (PC6    | ALT1)
117
+#define PC7_ALT1                (PC7    | ALT1)
118
+#define PC8_ALT1                (PC8    | ALT1)
119
+#define PC9_ALT1                (PC9    | ALT1)
120
+#define PC10_ALT1               (PC10   | ALT1)
121
+#define PC11_ALT1               (PC11   | ALT1)
122
+#define PD4_ALT1                (PD4    | ALT1)
123
+
124
+#define NUM_DIGITAL_PINS        62
125
+#define NUM_REMAP_PINS          2
126
+#define NUM_ANALOG_INPUTS       16
127
+
128
+// SPI definitions
129
+#ifndef PIN_SPI_SS
130
+  #define PIN_SPI_SS            PA4
131
+#endif
132
+#ifndef PIN_SPI_MOSI
133
+  #define PIN_SPI_MOSI          PA7
134
+#endif
135
+#ifndef PIN_SPI_MISO
136
+  #define PIN_SPI_MISO          PA6
137
+#endif
138
+#ifndef PIN_SPI_SCK
139
+  #define PIN_SPI_SCK           PA5
140
+#endif
141
+
142
+// I2C definitions
143
+#ifndef PIN_WIRE_SDA
144
+  #define PIN_WIRE_SDA          PB6
145
+#endif
146
+#ifndef PIN_WIRE_SCL
147
+  #define PIN_WIRE_SCL          PB7
148
+#endif
149
+
150
+// Timer Definitions
151
+// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
152
+#ifndef TIMER_TONE
153
+  #define TIMER_TONE            TIM6
154
+#endif
155
+#ifndef TIMER_SERVO
156
+  #define TIMER_SERVO           TIM7
157
+#endif
158
+
159
+// UART Definitions
160
+#ifndef SERIAL_UART_INSTANCE
161
+  #define SERIAL_UART_INSTANCE  2
162
+#endif
163
+
164
+// Default pin used for generic 'Serial' instance
165
+// Mandatory for Firmata
166
+#ifndef PIN_SERIAL_RX
167
+  #define PIN_SERIAL_RX         PA3
168
+#endif
169
+#ifndef PIN_SERIAL_TX
170
+  #define PIN_SERIAL_TX         PA2
171
+#endif
172
+
173
+/*----------------------------------------------------------------------------
174
+ *        Arduino objects - C++ only
175
+ *----------------------------------------------------------------------------*/
176
+
177
+#ifdef __cplusplus
178
+  // These serial port names are intended to allow libraries and architecture-neutral
179
+  // sketches to automatically default to the correct port name for a particular type
180
+  // of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
181
+  // the first hardware serial port whose RX/TX pins are not dedicated to another use.
182
+  //
183
+  // SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
184
+  //
185
+  // SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
186
+  //
187
+  // SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
188
+  //
189
+  // SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
190
+  //
191
+  // SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
192
+  //                            pins are NOT connected to anything by default.
193
+  #ifndef SERIAL_PORT_MONITOR
194
+    #define SERIAL_PORT_MONITOR   Serial
195
+  #endif
196
+  #ifndef SERIAL_PORT_HARDWARE
197
+    #define SERIAL_PORT_HARDWARE  Serial2
198
+  #endif
199
+#endif

+ 39
- 0
ini/stm32g0.ini View File

@@ -0,0 +1,39 @@
1
+#
2
+# Marlin Firmware
3
+# PlatformIO Configuration File
4
+#
5
+
6
+#################################
7
+#
8
+# STM32G0 Architecture
9
+#
10
+# Naming Example: STM32G0B1RET6
11
+#
12
+#   G : Foundation
13
+#   0 : Cortex M0+ core (0:M0, 1-2:M3, 3-4:M4, 7:M7)
14
+#  B1 : Line/Features
15
+#   R : 64 pins  (R:64 or 66, F:20)
16
+#   E : 512KB Flash-memory  (C:256KB, D:384KB, E:512KB, G:1024KB)
17
+#   T : LQFP package
18
+#   6 : -40...85°C   (7: ...105°C)
19
+#
20
+#################################
21
+
22
+#
23
+# BigTree SKR mini E3 V3.0 (STM32G0B1RET6 ARM Cortex-M0+)
24
+#
25
+[env:STM32G0B1RE_btt]
26
+platform          = ststm32@~14.1.0
27
+platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip
28
+extends            = stm32_variant
29
+board              = marlin_STM32G0B1RE
30
+board_build.offset          = 0x2000
31
+board_upload.offset_address = 0x08002000
32
+build_flags        = ${stm32_variant.build_flags}
33
+                   -DADC_RESOLUTION=12
34
+                   -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10
35
+                   -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024
36
+                   -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4
37
+                   -DSTEP_TIMER_IRQ_PRIO=0
38
+upload_protocol   = stlink
39
+debug_tool        = stlink

+ 1
- 0
platformio.ini View File

@@ -30,6 +30,7 @@ extra_configs =
30 30
     ini/stm32f4.ini
31 31
     ini/stm32f7.ini
32 32
     ini/stm32h7.ini
33
+    ini/stm32g0.ini
33 34
     ini/teensy.ini
34 35
 
35 36
 #

Loading…
Cancel
Save