Procházet zdrojové kódy

MKS Robin Nano V3 and STM32F4x0Vx Variant (#20430)

Victor Oliveira před 3 roky
rodič
revize
b167cd2427
No account linked to committer's email address

+ 1
- 0
Marlin/src/core/boards.h Zobrazit soubor

@@ -367,6 +367,7 @@
367 367
 #define BOARD_FLYF407ZG               4217  // FLYF407ZG board (STM32F407ZG)
368 368
 #define BOARD_MKS_ROBIN2              4218  // MKS_ROBIN2 (STM32F407ZE)
369 369
 #define BOARD_MKS_ROBIN_PRO_V2        4219  // MKS Robin Pro V2 (STM32F407VE)
370
+#define BOARD_MKS_ROBIN_NANO_V3       4220  // MKS Robin Nano V3 (STM32F407VG)
370 371
 
371 372
 //
372 373
 // ARM Cortex M7

+ 2
- 0
Marlin/src/pins/pins.h Zobrazit soubor

@@ -592,6 +592,8 @@
592 592
   #include "stm32f4/pins_MKS_ROBIN2.h"          // STM32F4                                env:MKS_ROBIN2
593 593
 #elif MB(MKS_ROBIN_PRO_V2)
594 594
   #include "stm32f4/pins_MKS_ROBIN_PRO_V2.h"    // STM32F4                                env:mks_robin_pro2
595
+#elif MB(MKS_ROBIN_NANO_V3)
596
+  #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h"   // STM32F4                                env:mks_robin_nano_v3
595 597
 
596 598
 //
597 599
 // ARM Cortex M7

+ 367
- 0
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h Zobrazit soubor

@@ -0,0 +1,367 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#if NOT_TARGET(STM32F4, STM32F4xx)
25
+  #error "Oops! Select an STM32F4 board in 'Tools > Board.'"
26
+#elif HOTENDS > 2 || E_STEPPERS > 2
27
+  #error "MKS Robin Nano V3 supports up to 2 hotends / E-steppers."
28
+#elif HAS_FSMC_TFT
29
+  #error "MKS Robin Nano V3 doesn't support FSMC-based TFT displays."
30
+#endif
31
+
32
+#define BOARD_INFO_NAME "MKS Robin Nano V3"
33
+
34
+// Use one of these or SDCard-based Emulation will be used
35
+//#define SRAM_EEPROM_EMULATION                   // Use BackSRAM-based EEPROM emulation
36
+//#define FLASH_EEPROM_EMULATION                  // Use Flash-based EEPROM emulation
37
+#define I2C_EEPROM
38
+
39
+//
40
+// Release PB4 (Z_DIR_PIN) from JTAG NRST role
41
+//
42
+
43
+//
44
+// Limit Switches
45
+//
46
+#define X_DIAG_PIN                          PD15
47
+#define Y_DIAG_PIN                          PD2
48
+#define Z_DIAG_PIN                          PC8
49
+#define E0_DIAG_PIN                         PC4
50
+#define E1_DIAG_PIN                         PE7
51
+
52
+//
53
+#define X_STOP_PIN                          PA15
54
+#define Y_STOP_PIN                          PD2
55
+#define Z_MIN_PIN                           PC8
56
+#define Z_MAX_PIN                           PC4
57
+
58
+//
59
+// Steppers
60
+//
61
+#define X_ENABLE_PIN                        PE4
62
+#define X_STEP_PIN                          PE3
63
+#define X_DIR_PIN                           PE2
64
+#ifndef X_CS_PIN
65
+  #define X_CS_PIN                          PD5
66
+#endif
67
+
68
+#define Y_ENABLE_PIN                        PE1
69
+#define Y_STEP_PIN                          PE0
70
+#define Y_DIR_PIN                           PB9
71
+#ifndef Y_CS_PIN
72
+  #define Y_CS_PIN                          PD7
73
+#endif
74
+
75
+#define Z_ENABLE_PIN                        PB8
76
+#define Z_STEP_PIN                          PB5
77
+#define Z_DIR_PIN                           PB4
78
+#ifndef Z_CS_PIN
79
+  #define Z_CS_PIN                          PD4
80
+#endif
81
+
82
+#define E0_ENABLE_PIN                       PB3
83
+#define E0_STEP_PIN                         PD6
84
+#define E0_DIR_PIN                          PD3
85
+#ifndef E0_CS_PIN
86
+  #define E0_CS_PIN                         PD9
87
+#endif
88
+
89
+#define E1_ENABLE_PIN                       PA3
90
+#define E1_STEP_PIN                         PD15
91
+#define E1_DIR_PIN                          PA1
92
+#ifndef E1_CS_PIN
93
+  #define E1_CS_PIN                         PD8
94
+#endif
95
+
96
+//
97
+// Software SPI pins for TMC2130 stepper drivers
98
+//
99
+// This board only support SW SPI for stepper drivers
100
+#if HAS_TMC_SPI
101
+  #define TMC_USE_SW_SPI
102
+#endif
103
+#if ENABLED(TMC_USE_SW_SPI)
104
+  #if !defined(TMC_SW_MOSI) || TMC_SW_MOSI == -1
105
+    #define TMC_SW_MOSI                     PD14
106
+  #endif
107
+  #if !defined(TMC_SW_MISO) || TMC_SW_MISO == -1
108
+    #define TMC_SW_MISO                     PD1
109
+  #endif
110
+  #if !defined(TMC_SW_SCK) || TMC_SW_SCK == -1
111
+    #define TMC_SW_SCK                      PD0
112
+  #endif
113
+#endif
114
+
115
+#if HAS_TMC_UART
116
+  //
117
+  // Software serial
118
+  // No Hardware serial for steppers
119
+  //
120
+  #define X_SERIAL_TX_PIN                   PD5
121
+  #define X_SERIAL_RX_PIN                   PD5
122
+
123
+  #define Y_SERIAL_TX_PIN                   PD7
124
+  #define Y_SERIAL_RX_PIN                   PD7
125
+
126
+  #define Z_SERIAL_TX_PIN                   PD4
127
+  #define Z_SERIAL_RX_PIN                   PD4
128
+
129
+  #define E0_SERIAL_TX_PIN                  PD9
130
+  #define E0_SERIAL_RX_PIN                  PD9
131
+
132
+  #define E1_SERIAL_TX_PIN                  PD8
133
+  #define E1_SERIAL_RX_PIN                  PD8
134
+
135
+  // Reduce baud rate to improve software serial reliability
136
+  #define TMC_BAUD_RATE                    19200
137
+#endif
138
+
139
+//
140
+// Temperature Sensors
141
+//
142
+#define TEMP_0_PIN                          PC1   // TH1
143
+#define TEMP_1_PIN                          PA2   // TH2
144
+#define TEMP_BED_PIN                        PC0   // TB1
145
+
146
+//
147
+// Heaters / Fans
148
+//
149
+#define HEATER_0_PIN                        PE5   // HEATER1
150
+#define HEATER_1_PIN                        PB0   // HEATER2
151
+#define HEATER_BED_PIN                      PA0   // HOT BED
152
+
153
+#define FAN_PIN                             PB1   // FAN
154
+#define FAN1_PIN                            PC14  // FAN1
155
+
156
+//
157
+// Thermocouples
158
+//
159
+//#define MAX6675_SS_PIN            HEATER_0_PIN  // TC1 - CS1
160
+//#define MAX6675_SS_PIN            HEATER_1_PIN  // TC2 - CS2
161
+
162
+//
163
+// Misc. Functions
164
+//
165
+#define MT_DET_1                            PA4
166
+#define MT_DET_2                            PE6
167
+#define PW_DET                              PA13
168
+#define PW_OFF                              PB2
169
+
170
+#ifndef FIL_RUNOUT_PIN
171
+  #define FIL_RUNOUT_PIN                MT_DET_1
172
+#endif
173
+#ifndef FIL_RUNOUT2_PIN
174
+  #define FIL_RUNOUT2_PIN               MT_DET_2
175
+#endif
176
+
177
+#define POWER_LOSS_PIN                    PW_DET
178
+#define PS_ON_PIN                         PW_OFF
179
+//
180
+// Enable MKSPWC support
181
+//
182
+//#define SUICIDE_PIN                       PB2
183
+//#define KILL_PIN                          PA2
184
+//#define KILL_PIN_INVERTING                true
185
+
186
+#define SERVO0_PIN                          PA8   // Enable BLTOUCH support
187
+//#define LED_PIN                           PB2
188
+
189
+// Random Info
190
+#define USB_SERIAL                         -1  //Usb Serial
191
+#define WIFI_SERIAL                         3  //USART3
192
+#define MKS_WIFI_MODULE_SERIAL              1  //USART1
193
+#define MKS_WIFI_MODULE_SPI                 2  //SPI2
194
+
195
+#ifndef SDCARD_CONNECTION
196
+  #define SDCARD_CONNECTION              ONBOARD
197
+#endif
198
+
199
+//
200
+// Onboard SD card
201
+//
202
+// detect pin dont work when ONBOARD and NO_SD_HOST_DRIVE disabled
203
+#if SD_CONNECTION_IS(ONBOARD)
204
+  #define CUSTOM_SPI_PINS                         // TODO: needed because is the only way to set SPI3 for SD on STM32 (by now)
205
+  #if ENABLED(CUSTOM_SPI_PINS)
206
+    #define ENABLE_SPI3
207
+    #define SS_PIN                          -1
208
+    #define SDSS                            PC9
209
+    #define SCK_PIN                         PC10
210
+    #define MISO_PIN                        PC11
211
+    #define MOSI_PIN                        PC12
212
+    #define SD_DETECT_PIN                   PD12
213
+  #endif
214
+#endif
215
+
216
+//
217
+// LCD SD
218
+//
219
+#if SD_CONNECTION_IS(LCD)
220
+  #define CUSTOM_SPI_PINS
221
+  #if ENABLED(CUSTOM_SPI_PINS)
222
+    #define ENABLE_SPI1
223
+    #define SDSS                            PE10
224
+    #define SCK_PIN                         PA5
225
+    #define MISO_PIN                        PA6
226
+    #define MOSI_PIN                        PA7
227
+    #define SD_DETECT_PIN                   PE12
228
+  #endif
229
+#endif
230
+
231
+//
232
+// LCD / Controller
233
+#define SPI_FLASH
234
+#define HAS_SPI_FLASH                          1
235
+#define SPI_DEVICE                             2
236
+#define SPI_FLASH_SIZE                 0x1000000
237
+#if ENABLED(SPI_FLASH)
238
+  #define W25QXX_CS_PIN                     PB12
239
+  #define W25QXX_MOSI_PIN                   PC3
240
+  #define W25QXX_MISO_PIN                   PC2
241
+  #define W25QXX_SCK_PIN                    PB13
242
+#endif
243
+
244
+/**
245
+ *                _____                                             _____
246
+ *   (BEEPER)PC5 | · · | PE13(BTN_ENC)             (SPI1 MISO) PA6 | · · | PA5 (SPI1 SCK)
247
+ *  (LCD_EN)PD13 | · · | PC6(LCD_RS)                 (BTN_EN1) PE8 | · · | PE10 (SPI1 CS)
248
+ *  (LCD_D4)PE14 | · ·   PE15(LCD_D5)               (BTN_EN2) PE11 | · ·   PA7 (SPI1 MOSI)
249
+ *  (LCD_D6)PD11 | · · | PD10(LCD_D7)               (SPI1_RS) PE12 | · · | RESET
250
+ *           GND | · · | 5V                                    GND | · · | 3.3V
251
+ *                 ̄ ̄ ̄                                              ̄ ̄ ̄
252
+ *                EXP1                                               EXP2
253
+ */
254
+
255
+#if EITHER(TFT_480x320_SPI, TFT_LVGL_UI_SPI)
256
+  #ifndef TOUCH_CALIBRATION_X
257
+    #define TOUCH_CALIBRATION_X           -17253
258
+  #endif
259
+  #ifndef TOUCH_CALIBRATION_Y
260
+    #define TOUCH_CALIBRATION_Y            11579
261
+  #endif
262
+  #ifndef TOUCH_OFFSET_X
263
+    #define TOUCH_OFFSET_X                   514
264
+  #endif
265
+  #ifndef TOUCH_OFFSET_Y
266
+    #define TOUCH_OFFSET_Y                   -24
267
+  #endif
268
+  #ifndef TOUCH_ORIENTATION
269
+    #define TOUCH_ORIENTATION    TOUCH_LANDSCAPE
270
+  #endif
271
+
272
+  #define TFT_CS_PIN                        PD11
273
+  #define TFT_SCK_PIN                       PA5
274
+  #define TFT_MISO_PIN                      PA6
275
+  #define TFT_MOSI_PIN                      PA7
276
+  #define TFT_DC_PIN                        PD10
277
+  #define TFT_RST_PIN                       PC6
278
+  #define TFT_A0_PIN                  TFT_DC_PIN
279
+
280
+  #define TFT_RESET_PIN                     PC6
281
+  #define TFT_BACKLIGHT_PIN                 PD13
282
+
283
+  #define TOUCH_BUTTONS_HW_SPI
284
+  #define TOUCH_BUTTONS_HW_SPI_DEVICE          1
285
+
286
+  #define LCD_BACKLIGHT_PIN                 PD13
287
+  #ifndef TFT_WIDTH
288
+    #define TFT_WIDTH                        480
289
+  #endif
290
+  #ifndef TFT_HEIGHT
291
+    #define TFT_HEIGHT                       320
292
+  #endif
293
+
294
+  #define TOUCH_CS_PIN                      PE14  // SPI1_NSS
295
+  #define TOUCH_SCK_PIN                     PA5   // SPI1_SCK
296
+  #define TOUCH_MISO_PIN                    PA6   // SPI1_MISO
297
+  #define TOUCH_MOSI_PIN                    PA7   // SPI1_MOSI
298
+
299
+  #define BTN_EN1                           PE8
300
+  #define BTN_EN2                           PE11
301
+  #define BEEPER_PIN                        PC5
302
+  #define BTN_ENC                           PE13
303
+
304
+  #define LCD_READ_ID                       0xD3
305
+  #define LCD_USE_DMA_SPI
306
+
307
+  #define TFT_BUFFER_SIZE                  14400
308
+
309
+#elif HAS_SPI_LCD
310
+  #define BEEPER_PIN                        PC5
311
+  #define BTN_ENC                           PE13
312
+  #define LCD_PINS_ENABLE                   PD13
313
+  #define LCD_PINS_RS                       PC6
314
+  #define BTN_EN1                           PE8
315
+  #define BTN_EN2                           PE11
316
+  #define LCD_BACKLIGHT_PIN                 -1
317
+
318
+  // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
319
+  #if ENABLED(MKS_MINI_12864)
320
+    //#define LCD_BACKLIGHT_PIN             -1
321
+    //#define LCD_RESET_PIN                 -1
322
+    #define DOGLCD_A0                       PD11
323
+    #define DOGLCD_CS                       PE15
324
+    //#define DOGLCD_SCK                    PA5
325
+    //#define DOGLCD_MOSI                   PA7
326
+
327
+    // Required for MKS_MINI_12864 with this board
328
+    //#define MKS_LCD12864B
329
+    //#undef SHOW_BOOTSCREEN
330
+
331
+  #else                                           // !MKS_MINI_12864
332
+
333
+    #define LCD_PINS_D4                     PE14
334
+    #if ENABLED(ULTIPANEL)
335
+      #define LCD_PINS_D5                   PE15
336
+      #define LCD_PINS_D6                   PD11
337
+      #define LCD_PINS_D7                   PD10
338
+    #endif
339
+
340
+    #define BOARD_ST7920_DELAY_1    DELAY_NS(96)
341
+    #define BOARD_ST7920_DELAY_2    DELAY_NS(48)
342
+    #define BOARD_ST7920_DELAY_3    DELAY_NS(600)
343
+
344
+  #endif // !MKS_MINI_12864
345
+
346
+#elif ENABLED(SPI_GRAPHICAL_TFT)
347
+  #define SPI_TFT_CS_PIN                    PD11
348
+  #define SPI_TFT_SCK_PIN                   PA5
349
+  #define SPI_TFT_MISO_PIN                  PA6
350
+  #define SPI_TFT_MOSI_PIN                  PA7
351
+  #define SPI_TFT_DC_PIN                    PD10
352
+  #define SPI_TFT_RST_PIN                   PC6
353
+
354
+  #define LCD_BACKLIGHT_PIN                 PD13
355
+
356
+  #define TOUCH_CS_PIN                      PE14  // SPI1_NSS
357
+  #define TOUCH_SCK_PIN                     PA5   // SPI1_SCK
358
+  #define TOUCH_MISO_PIN                    PA6   // SPI1_MISO
359
+  #define TOUCH_MOSI_PIN                    PA7   // SPI1_MOSI
360
+
361
+  #define BTN_EN1                           PE8
362
+  #define BTN_EN2                           PE11
363
+  #define BEEPER_PIN                        PC5
364
+  #define BTN_ENC                           PE13
365
+#endif // HAS_SPI_LCD
366
+
367
+#define HAS_OTG_USB_HOST_SUPPORT

+ 56
- 0
buildroot/share/PlatformIO/boards/genericSTM32F407VGT6.json Zobrazit soubor

@@ -0,0 +1,56 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m4",
5
+    "extra_flags": "-DSTM32F407xx -DSTM32F4",
6
+    "f_cpu": "168000000L",
7
+    "hwids": [
8
+      [
9
+        "0x1EAF",
10
+        "0x0003"
11
+      ],
12
+      [
13
+        "0x0483",
14
+        "0x3748"
15
+      ]
16
+    ],
17
+    "mcu": "stm32f407vgt6",
18
+    "product_line": "STM32F407xx",
19
+    "variant": "Generic_F4x7Vx"
20
+  },
21
+  "debug": {
22
+    "default_tools": [
23
+      "stlink"
24
+    ],
25
+    "jlink_device": "STM32F407VG",
26
+    "openocd_extra_args": [
27
+      "-c",
28
+      "reset_config none"
29
+    ],
30
+    "openocd_target": "stm32f4x",
31
+    "svd_path": "STM32F40x.svd"
32
+  },
33
+  "frameworks": [
34
+    "arduino",
35
+    "cmsis",
36
+    "stm32cube",
37
+    "libopencm3"
38
+  ],
39
+  "name": "STM32F407VG (128k RAM, 64k CCM RAM, 1024k Flash",
40
+  "upload": {
41
+    "disable_flushing": false,
42
+    "maximum_ram_size": 131072,
43
+    "maximum_size": 1048576,
44
+    "protocol": "stlink",
45
+    "protocols": [
46
+      "stlink",
47
+      "dfu",
48
+      "jlink"
49
+    ],
50
+    "require_upload_port": true,
51
+    "use_1200bps_touch": false,
52
+    "wait_for_upload_port": false
53
+  },
54
+  "url": "https://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f407-417/stm32f407vg.html",
55
+  "vendor": "Generic"
56
+}

+ 408
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/PeripheralPins.c Zobrazit soubor

@@ -0,0 +1,408 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2019, 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
+ * Automatically generated from STM32F407V(E-G)Tx.xml
13
+ */
14
+#include "Arduino.h"
15
+#include "PeripheralPins.h"
16
+
17
+/* =====
18
+ * Note: Commented lines are alternative possibilities which are not used per default.
19
+ *       If you change them, you will have to know what you do
20
+ * =====
21
+ */
22
+
23
+//*** ADC ***
24
+
25
+#ifdef HAL_ADC_MODULE_ENABLED
26
+WEAK const PinMap PinMap_ADC[] = {
27
+  {PA_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
28
+  //  {PA_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0
29
+  //  {PA_0,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_IN0
30
+  {PA_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
31
+  //  {PA_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1
32
+  //  {PA_1,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_IN1
33
+  {PA_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
34
+  //  {PA_2,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2
35
+  //  {PA_2,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_IN2
36
+  {PA_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
37
+  //  {PA_3,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3
38
+  //  {PA_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_IN3
39
+  {PA_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
40
+  //  {PA_4,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4
41
+  {PA_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
42
+  //  {PA_5,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5
43
+  {PA_6,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
44
+  //  {PA_6,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6
45
+  {PA_7,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
46
+  //  {PA_7,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7
47
+  {PB_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
48
+  //  {PB_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8
49
+  {PB_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
50
+  //  {PB_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9
51
+  {PC_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
52
+  //  {PC_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_IN10
53
+  //  {PC_0,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_IN10
54
+  {PC_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
55
+  //  {PC_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_IN11
56
+  //  {PC_1,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_IN11
57
+  {PC_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
58
+  //  {PC_2,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC2_IN12
59
+  //  {PC_2,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC3_IN12
60
+  {PC_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
61
+  //  {PC_3,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC2_IN13
62
+  //  {PC_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC3_IN13
63
+  {PC_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
64
+  //  {PC_4,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_IN14
65
+  {PC_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
66
+  //  {PC_5,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_IN15
67
+  {NC,    NP,    0}
68
+};
69
+#endif
70
+
71
+//*** DAC ***
72
+
73
+#ifdef HAL_DAC_MODULE_ENABLED
74
+WEAK const PinMap PinMap_DAC[] = {
75
+  {PA_4,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1
76
+  {PA_5,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2
77
+  {NC,    NP,    0}
78
+};
79
+#endif
80
+
81
+//*** I2C ***
82
+
83
+#ifdef HAL_I2C_MODULE_ENABLED
84
+WEAK const PinMap PinMap_I2C_SDA[] = {
85
+  {PB_7,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
86
+  {PB_9,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
87
+  {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
88
+  {PC_9,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
89
+  {NC,    NP,    0}
90
+};
91
+#endif
92
+
93
+#ifdef HAL_I2C_MODULE_ENABLED
94
+WEAK const PinMap PinMap_I2C_SCL[] = {
95
+  {PA_8,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
96
+  {PB_6,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
97
+  {PB_8,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
98
+  {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
99
+  {NC,    NP,    0}
100
+};
101
+#endif
102
+
103
+//*** PWM ***
104
+
105
+#ifdef HAL_TIM_MODULE_ENABLED
106
+// Some pins can perform PWM from more than one timer. These were selected to utilize as many channels as
107
+// possible from timers which were already dedicated to PWM output.
108
+
109
+// TIM1 = Pins are using for OTG FS
110
+// TIM2 = [HEATER_BED], TIM2 is used OTG HS SOF
111
+// TIM6 = Tone
112
+// TIM8 = [FAN0, HEATER_1] OTG HS
113
+// TIM7 = Servo
114
+// TIM9 = [HEATER_0, ]
115
+// TIM1, TIM8, TIM12 = Pins are using for OTG HS
116
+// No timer = [FAN1 ]
117
+
118
+WEAK const PinMap PinMap_PWM[] = {
119
+  {PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
120
+  //  {PA_0,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
121
+  //  {PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
122
+  {PA_1,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2
123
+  //  {PA_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
124
+  {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
125
+  //  {PA_2,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
126
+  //  {PA_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
127
+  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
128
+  //  {PA_3,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
129
+  {PA_5,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
130
+  //  {PA_5,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N
131
+  //  {PA_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
132
+  {PA_6,  TIM13,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1
133
+  //  {PA_7,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
134
+  //  {PA_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
135
+  //  {PA_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N
136
+  {PA_7,  TIM14,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1
137
+  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
138
+  {PA_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
139
+  {PA_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
140
+  // {PA_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
141
+  {PA_15, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
142
+  //  {PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
143
+  //  {PB_0,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
144
+  {PB_0,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N
145
+  //  {PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
146
+  //  {PB_1,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
147
+  {PB_1,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
148
+  {PB_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
149
+  {PB_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
150
+  {PB_4,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
151
+  {PB_5,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
152
+  {PB_6,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
153
+  {PB_7,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
154
+  {PB_8,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
155
+  //  {PB_8,  TIM10,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
156
+  //  {PB_9,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
157
+  {PB_9,  TIM11,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
158
+  {PB_10, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
159
+  {PB_11, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
160
+  {PB_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
161
+  //  {PB_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
162
+  //  {PB_14, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N
163
+  // {PB_14, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1
164
+  //  {PB_15, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
165
+  //  {PB_15, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
166
+  // {PB_15, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2
167
+  {PC_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
168
+  //  {PC_6,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1
169
+  //  {PC_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
170
+  {PC_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2
171
+  {PC_8,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
172
+  //  {PC_8,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3
173
+  //  {PC_9,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
174
+  {PC_9,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4
175
+  {PD_12, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
176
+  {PD_13, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
177
+  {PD_14, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
178
+  {PD_15, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
179
+  {PE_5,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
180
+  {PE_6,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
181
+  {PE_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
182
+  {PE_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
183
+  {PE_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
184
+  {PE_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
185
+  {PE_12, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
186
+  {PE_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
187
+  {PE_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
188
+  {NC,    NP,    0}
189
+};
190
+#endif
191
+
192
+//*** SERIAL ***
193
+
194
+#ifdef HAL_UART_MODULE_ENABLED
195
+WEAK const PinMap PinMap_UART_TX[] = {
196
+  {PA_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
197
+  {PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
198
+  {PA_9,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
199
+  {PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
200
+  {PB_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
201
+  {PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
202
+  {PC_10, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
203
+  {PC_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
204
+  {PC_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
205
+  {PD_5,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
206
+  {PD_8,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
207
+  {NC,    NP,    0}
208
+};
209
+#endif
210
+
211
+#ifdef HAL_UART_MODULE_ENABLED
212
+WEAK const PinMap PinMap_UART_RX[] = {
213
+  {PA_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
214
+  {PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
215
+  {PA_10, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
216
+  {PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
217
+  {PB_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
218
+  {PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
219
+  //  {PC_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
220
+  {PC_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
221
+  {PD_2,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
222
+  {PD_6,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
223
+  {PD_9,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
224
+  {NC,    NP,    0}
225
+};
226
+#endif
227
+
228
+#ifdef HAL_UART_MODULE_ENABLED
229
+WEAK const PinMap PinMap_UART_RTS[] = {
230
+  {PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
231
+  // {PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
232
+  // {PB_14, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
233
+  {PD_4,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
234
+  {PD_12, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
235
+  {NC,    NP,    0}
236
+};
237
+#endif
238
+
239
+#ifdef HAL_UART_MODULE_ENABLED
240
+WEAK const PinMap PinMap_UART_CTS[] = {
241
+  {PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
242
+  // {PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
243
+  {PB_13, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
244
+  {PD_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
245
+  {PD_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
246
+  {NC,    NP,    0}
247
+};
248
+#endif
249
+
250
+//*** SPI ***
251
+
252
+#ifdef HAL_SPI_MODULE_ENABLED
253
+WEAK const PinMap PinMap_SPI_MOSI[] = {
254
+  {PA_7,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
255
+  //  {PB_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
256
+  {PB_5,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
257
+  // {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
258
+  {PC_3,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
259
+  {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
260
+  {NC,    NP,    0}
261
+};
262
+#endif
263
+
264
+#ifdef HAL_SPI_MODULE_ENABLED
265
+WEAK const PinMap PinMap_SPI_MISO[] = {
266
+  {PA_6,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
267
+  //  {PB_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
268
+  {PB_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
269
+  // {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
270
+  {PC_2,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
271
+  {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
272
+  {NC,    NP,    0}
273
+};
274
+#endif
275
+
276
+#ifdef HAL_SPI_MODULE_ENABLED
277
+WEAK const PinMap PinMap_SPI_SCLK[] = {
278
+  {PA_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
279
+  //  {PB_3,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
280
+  {PB_3,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
281
+  {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
282
+  {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
283
+  {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
284
+  {NC,    NP,    0}
285
+};
286
+#endif
287
+
288
+#ifdef HAL_SPI_MODULE_ENABLED
289
+WEAK const PinMap PinMap_SPI_SSEL[] = {
290
+  {PA_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
291
+  //  {PA_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
292
+  //  {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
293
+  {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
294
+  {PB_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
295
+  {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
296
+  {NC,    NP,    0}
297
+};
298
+#endif
299
+
300
+//*** CAN ***
301
+
302
+#ifdef HAL_CAN_MODULE_ENABLED
303
+WEAK const PinMap PinMap_CAN_RD[] = {
304
+  {PA_11, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
305
+  {PB_5,  CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
306
+  {PB_8,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
307
+  {PB_12, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
308
+  {PD_0,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
309
+  {NC,    NP,    0}
310
+};
311
+#endif
312
+
313
+#ifdef HAL_CAN_MODULE_ENABLED
314
+WEAK const PinMap PinMap_CAN_TD[] = {
315
+  {PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
316
+  {PB_6,  CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
317
+  {PB_9,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
318
+  {PB_13, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
319
+  {PD_1,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
320
+  {NC,    NP,    0}
321
+};
322
+#endif
323
+
324
+//*** ETHERNET ***
325
+
326
+#ifdef HAL_ETH_MODULE_ENABLED
327
+WEAK const PinMap PinMap_Ethernet[] = {
328
+  {PA_0,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS
329
+  {PA_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK|ETH_RX_CLK
330
+  {PA_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO
331
+  {PA_3,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL
332
+  {PA_7,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV|ETH_RX_DV
333
+  {PB_0,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2
334
+  {PB_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3
335
+  {PB_5,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT
336
+  {PB_8,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3
337
+  {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER
338
+  {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN
339
+  {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0
340
+  {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1
341
+  {PC_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC
342
+  {PC_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2
343
+  {PC_3,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK
344
+  {PC_4,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0
345
+  {PC_5,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1
346
+  {PE_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3
347
+  {NC,    NP,    0}
348
+};
349
+#endif
350
+
351
+//*** No QUADSPI ***
352
+
353
+//*** USB ***
354
+
355
+#ifdef HAL_PCD_MODULE_ENABLED
356
+WEAK const PinMap PinMap_USB_OTG_FS[] = {
357
+  // {PA_8,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
358
+  // {PA_9,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
359
+  // {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
360
+  {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
361
+  {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP
362
+  {NC,    NP,    0}
363
+};
364
+#endif
365
+
366
+#ifdef HAL_PCD_MODULE_ENABLED
367
+WEAK const PinMap PinMap_USB_OTG_HS[] = {
368
+#ifdef USE_USB_HS_IN_FS
369
+  // {PA_4,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_SOF
370
+  // {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_ID
371
+  // {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS
372
+  {PB_14, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DM
373
+  {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DP
374
+#else
375
+  {PA_3,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D0
376
+  {PA_5,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_CK
377
+  {PB_0,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D1
378
+  {PB_1,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D2
379
+  {PB_5,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D7
380
+  {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D3
381
+  {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D4
382
+  {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D5
383
+  {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D6
384
+  {PC_0,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_STP
385
+  {PC_2,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_DIR
386
+  {PC_3,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_NXT
387
+#endif /* USE_USB_HS_IN_FS */
388
+  {NC,    NP,    0}
389
+};
390
+#endif
391
+
392
+//*** SD ***
393
+
394
+#ifdef HAL_SD_MODULE_ENABLED
395
+WEAK const PinMap PinMap_SD[] = {
396
+  {PB_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4
397
+  {PB_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5
398
+  {PC_6,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6
399
+  {PC_7,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7
400
+  {PC_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0
401
+  {PC_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1
402
+  {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2
403
+  {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3
404
+  {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK
405
+  {PD_2,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD
406
+  {NC,    NP,    0}
407
+};
408
+#endif

+ 50
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/PinNamesVar.h Zobrazit soubor

@@ -0,0 +1,50 @@
1
+/* SYS_WKUP */
2
+#ifdef PWR_WAKEUP_PIN1
3
+  SYS_WKUP1 = PA_0,
4
+#endif
5
+#ifdef PWR_WAKEUP_PIN2
6
+  SYS_WKUP2 = NC,
7
+#endif
8
+#ifdef PWR_WAKEUP_PIN3
9
+  SYS_WKUP3 = NC,
10
+#endif
11
+#ifdef PWR_WAKEUP_PIN4
12
+  SYS_WKUP4 = NC,
13
+#endif
14
+#ifdef PWR_WAKEUP_PIN5
15
+  SYS_WKUP5 = NC,
16
+#endif
17
+#ifdef PWR_WAKEUP_PIN6
18
+  SYS_WKUP6 = NC,
19
+#endif
20
+#ifdef PWR_WAKEUP_PIN7
21
+  SYS_WKUP7 = NC,
22
+#endif
23
+#ifdef PWR_WAKEUP_PIN8
24
+  SYS_WKUP8 = NC,
25
+#endif
26
+/* USB */
27
+#ifdef USBCON
28
+  USB_OTG_FS_SOF = PA_8,
29
+  USB_OTG_FS_VBUS = PA_9,
30
+  USB_OTG_FS_ID = PA_10,
31
+  USB_OTG_FS_DM = PA_11,
32
+  USB_OTG_FS_DP = PA_12,
33
+  USB_OTG_HS_ULPI_D0 = PA_3,
34
+  USB_OTG_HS_SOF = PA_4,
35
+  USB_OTG_HS_ULPI_CK = PA_5,
36
+  USB_OTG_HS_ULPI_D1 = PB_0,
37
+  USB_OTG_HS_ULPI_D2 = PB_1,
38
+  USB_OTG_HS_ULPI_D7 = PB_5,
39
+  USB_OTG_HS_ULPI_D3 = PB_10,
40
+  USB_OTG_HS_ULPI_D4 = PB_11,
41
+  USB_OTG_HS_ID = PB_12,
42
+  USB_OTG_HS_ULPI_D5 = PB_12,
43
+  USB_OTG_HS_ULPI_D6 = PB_13,
44
+  USB_OTG_HS_VBUS = PB_13,
45
+  USB_OTG_HS_DM = PB_14,
46
+  USB_OTG_HS_DP = PB_15,
47
+  USB_OTG_HS_ULPI_STP = PC_0,
48
+  USB_OTG_HS_ULPI_DIR = PC_2,
49
+  USB_OTG_HS_ULPI_NXT = PC_3,
50
+#endif

+ 495
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/hal_conf_extra.h Zobrazit soubor

@@ -0,0 +1,495 @@
1
+/**
2
+  ******************************************************************************
3
+  * @file    stm32f4xx_hal_conf_template.h
4
+  * @author  MCD Application Team
5
+  * @brief   HAL configuration template file.
6
+  *          This file should be copied to the application folder and renamed
7
+  *          to stm32f4xx_hal_conf.h.
8
+  ******************************************************************************
9
+  * @attention
10
+  *
11
+  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
12
+  * All rights reserved.</center></h2>
13
+  *
14
+  * This software component is licensed by ST under BSD 3-Clause license,
15
+  * the "License"; You may not use this file except in compliance with the
16
+  * License. You may obtain a copy of the License at:
17
+  *                        opensource.org/licenses/BSD-3-Clause
18
+  *
19
+  ******************************************************************************
20
+  */
21
+
22
+/* Define to prevent recursive inclusion -------------------------------------*/
23
+#ifndef __STM32F4xx_HAL_CONF_H
24
+#define __STM32F4xx_HAL_CONF_H
25
+
26
+#ifdef __cplusplus
27
+ extern "C" {
28
+#endif
29
+
30
+/* Exported types ------------------------------------------------------------*/
31
+/* Exported constants --------------------------------------------------------*/
32
+
33
+/* ########################## Module Selection ############################## */
34
+/**
35
+  * @brief This is the list of modules to be used in the HAL driver
36
+  */
37
+#define HAL_MODULE_ENABLED
38
+#define HAL_ADC_MODULE_ENABLED
39
+// #define HAL_CAN_MODULE_ENABLED
40
+/* #define HAL_CAN_LEGACY_MODULE_ENABLED */
41
+#define HAL_CRC_MODULE_ENABLED
42
+// #define HAL_CEC_MODULE_ENABLED
43
+// #define HAL_CRYP_MODULE_ENABLED
44
+#define HAL_DAC_MODULE_ENABLED
45
+// #define HAL_DCMI_MODULE_ENABLED
46
+#define HAL_DMA_MODULE_ENABLED
47
+// #define HAL_DMA2D_MODULE_ENABLED
48
+// #define HAL_ETH_MODULE_ENABLED
49
+// #define HAL_FLASH_MODULE_ENABLED
50
+// #define HAL_NAND_MODULE_ENABLED
51
+// #define HAL_NOR_MODULE_ENABLED
52
+// #define HAL_PCCARD_MODULE_ENABLED
53
+// #define HAL_SRAM_MODULE_ENABLED
54
+// #define HAL_SDRAM_MODULE_ENABLED
55
+// #define HAL_HASH_MODULE_ENABLED
56
+#define HAL_GPIO_MODULE_ENABLED
57
+// #define HAL_EXTI_MODULE_ENABLED
58
+#define HAL_I2C_MODULE_ENABLED
59
+// #define HAL_SMBUS_MODULE_ENABLED
60
+// #define HAL_I2S_MODULE_ENABLED
61
+// #define HAL_IWDG_MODULE_ENABLED
62
+// #define HAL_LTDC_MODULE_ENABLED
63
+// #define HAL_DSI_MODULE_ENABLED
64
+#define HAL_PWR_MODULE_ENABLED
65
+// #define HAL_QSPI_MODULE_ENABLED
66
+#define HAL_RCC_MODULE_ENABLED
67
+// #define HAL_RNG_MODULE_ENABLED
68
+// #define HAL_RTC_MODULE_ENABLED
69
+// #define HAL_SAI_MODULE_ENABLED
70
+// #define HAL_SD_MODULE_ENABLED
71
+#define HAL_SPI_MODULE_ENABLED
72
+#define HAL_TIM_MODULE_ENABLED
73
+// #define HAL_UART_MODULE_ENABLED
74
+#define HAL_USART_MODULE_ENABLED
75
+// #define HAL_IRDA_MODULE_ENABLED
76
+// #define HAL_SMARTCARD_MODULE_ENABLED
77
+// #define HAL_WWDG_MODULE_ENABLED
78
+#define HAL_CORTEX_MODULE_ENABLED
79
+// #define HAL_PCD_MODULE_ENABLED
80
+// #define HAL_HCD_MODULE_ENABLED
81
+// #define HAL_FMPI2C_MODULE_ENABLED
82
+// #define HAL_SPDIFRX_MODULE_ENABLED
83
+// #define HAL_DFSDM_MODULE_ENABLED
84
+// #define HAL_LPTIM_MODULE_ENABLED
85
+// #define HAL_MMC_MODULE_ENABLED
86
+
87
+/* ########################## HSE/HSI Values adaptation ##################### */
88
+/**
89
+  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
90
+  *        This value is used by the RCC HAL module to compute the system frequency
91
+  *        (when HSE is used as system clock source, directly or through the PLL).
92
+  */
93
+#if !defined  (HSE_VALUE)
94
+  #define HSE_VALUE              25000000U /*!< Value of the External oscillator in Hz */
95
+#endif /* HSE_VALUE */
96
+
97
+#if !defined  (HSE_STARTUP_TIMEOUT)
98
+  #define HSE_STARTUP_TIMEOUT    100U      /*!< Time out for HSE start up, in ms */
99
+#endif /* HSE_STARTUP_TIMEOUT */
100
+
101
+/**
102
+  * @brief Internal High Speed oscillator (HSI) value.
103
+  *        This value is used by the RCC HAL module to compute the system frequency
104
+  *        (when HSI is used as system clock source, directly or through the PLL).
105
+  */
106
+#if !defined  (HSI_VALUE)
107
+  #define HSI_VALUE              16000000U /*!< Value of the Internal oscillator in Hz */
108
+#endif /* HSI_VALUE */
109
+
110
+/**
111
+  * @brief Internal Low Speed oscillator (LSI) value.
112
+  */
113
+#if !defined  (LSI_VALUE)
114
+ #define LSI_VALUE               32000U    /*!< LSI Typical Value in Hz */
115
+#endif /* LSI_VALUE */                     /*!< Value of the Internal Low Speed oscillator in Hz
116
+                                                The real value may vary depending on the variations
117
+                                                in voltage and temperature. */
118
+/**
119
+  * @brief External Low Speed oscillator (LSE) value.
120
+  */
121
+#if !defined  (LSE_VALUE)
122
+ #define LSE_VALUE               32768U    /*!< Value of the External Low Speed oscillator in Hz */
123
+#endif /* LSE_VALUE */
124
+
125
+#if !defined  (LSE_STARTUP_TIMEOUT)
126
+  #define LSE_STARTUP_TIMEOUT    5000U     /*!< Time out for LSE start up, in ms */
127
+#endif /* LSE_STARTUP_TIMEOUT */
128
+
129
+/**
130
+  * @brief External clock source for I2S peripheral
131
+  *        This value is used by the I2S HAL module to compute the I2S clock source
132
+  *        frequency, this source is inserted directly through I2S_CKIN pad.
133
+  */
134
+#if !defined  (EXTERNAL_CLOCK_VALUE)
135
+  #define EXTERNAL_CLOCK_VALUE     12288000U /*!< Value of the External oscillator in Hz*/
136
+#endif /* EXTERNAL_CLOCK_VALUE */
137
+
138
+/* Tip: To avoid modifying this file each time you need to use different HSE,
139
+   ===  you can define the HSE value in your toolchain compiler preprocessor. */
140
+
141
+/* ########################### System Configuration ######################### */
142
+/**
143
+  * @brief This is the HAL system configuration section
144
+  */
145
+#define  VDD_VALUE                    3300U /*!< Value of VDD in mv */
146
+#define  TICK_INT_PRIORITY            0x0FU /*!< tick interrupt priority */
147
+#define  USE_RTOS                     0U
148
+#define  PREFETCH_ENABLE              1U
149
+#define  INSTRUCTION_CACHE_ENABLE     1U
150
+#define  DATA_CACHE_ENABLE            1U
151
+
152
+#define  USE_HAL_ADC_REGISTER_CALLBACKS         0U /* ADC register callback disabled       */
153
+#define  USE_HAL_CAN_REGISTER_CALLBACKS         0U /* CAN register callback disabled       */
154
+#define  USE_HAL_CEC_REGISTER_CALLBACKS         0U /* CEC register callback disabled       */
155
+#define  USE_HAL_CRYP_REGISTER_CALLBACKS        0U /* CRYP register callback disabled      */
156
+#define  USE_HAL_DAC_REGISTER_CALLBACKS         0U /* DAC register callback disabled       */
157
+#define  USE_HAL_DCMI_REGISTER_CALLBACKS        0U /* DCMI register callback disabled      */
158
+#define  USE_HAL_DFSDM_REGISTER_CALLBACKS       0U /* DFSDM register callback disabled     */
159
+#define  USE_HAL_DMA2D_REGISTER_CALLBACKS       0U /* DMA2D register callback disabled     */
160
+#define  USE_HAL_DSI_REGISTER_CALLBACKS         0U /* DSI register callback disabled       */
161
+#define  USE_HAL_ETH_REGISTER_CALLBACKS         0U /* ETH register callback disabled       */
162
+#define  USE_HAL_HASH_REGISTER_CALLBACKS        0U /* HASH register callback disabled      */
163
+#define  USE_HAL_HCD_REGISTER_CALLBACKS         0U /* HCD register callback disabled       */
164
+#define  USE_HAL_I2C_REGISTER_CALLBACKS         0U /* I2C register callback disabled       */
165
+#define  USE_HAL_FMPI2C_REGISTER_CALLBACKS      0U /* FMPI2C register callback disabled    */
166
+#define  USE_HAL_I2S_REGISTER_CALLBACKS         0U /* I2S register callback disabled       */
167
+#define  USE_HAL_IRDA_REGISTER_CALLBACKS        0U /* IRDA register callback disabled      */
168
+#define  USE_HAL_LPTIM_REGISTER_CALLBACKS       0U /* LPTIM register callback disabled     */
169
+#define  USE_HAL_LTDC_REGISTER_CALLBACKS        0U /* LTDC register callback disabled      */
170
+#define  USE_HAL_MMC_REGISTER_CALLBACKS         0U /* MMC register callback disabled       */
171
+#define  USE_HAL_NAND_REGISTER_CALLBACKS        0U /* NAND register callback disabled      */
172
+#define  USE_HAL_NOR_REGISTER_CALLBACKS         0U /* NOR register callback disabled       */
173
+#define  USE_HAL_PCCARD_REGISTER_CALLBACKS      0U /* PCCARD register callback disabled    */
174
+#define  USE_HAL_PCD_REGISTER_CALLBACKS         0U /* PCD register callback disabled       */
175
+#define  USE_HAL_QSPI_REGISTER_CALLBACKS        0U /* QSPI register callback disabled      */
176
+#define  USE_HAL_RNG_REGISTER_CALLBACKS         0U /* RNG register callback disabled       */
177
+#define  USE_HAL_RTC_REGISTER_CALLBACKS         0U /* RTC register callback disabled       */
178
+#define  USE_HAL_SAI_REGISTER_CALLBACKS         0U /* SAI register callback disabled       */
179
+#define  USE_HAL_SD_REGISTER_CALLBACKS          0U /* SD register callback disabled        */
180
+#define  USE_HAL_SMARTCARD_REGISTER_CALLBACKS   0U /* SMARTCARD register callback disabled */
181
+#define  USE_HAL_SDRAM_REGISTER_CALLBACKS       0U /* SDRAM register callback disabled     */
182
+#define  USE_HAL_SRAM_REGISTER_CALLBACKS        0U /* SRAM register callback disabled      */
183
+#define  USE_HAL_SPDIFRX_REGISTER_CALLBACKS     0U /* SPDIFRX register callback disabled   */
184
+#define  USE_HAL_SMBUS_REGISTER_CALLBACKS       0U /* SMBUS register callback disabled     */
185
+#define  USE_HAL_SPI_REGISTER_CALLBACKS         0U /* SPI register callback disabled       */
186
+#define  USE_HAL_TIM_REGISTER_CALLBACKS         0U /* TIM register callback disabled       */
187
+#define  USE_HAL_UART_REGISTER_CALLBACKS        0U /* UART register callback disabled      */
188
+#define  USE_HAL_USART_REGISTER_CALLBACKS       0U /* USART register callback disabled     */
189
+#define  USE_HAL_WWDG_REGISTER_CALLBACKS        0U /* WWDG register callback disabled      */
190
+
191
+/* ########################## Assert Selection ############################## */
192
+/**
193
+  * @brief Uncomment the line below to expanse the "assert_param" macro in the
194
+  *        HAL drivers code
195
+  */
196
+// #define USE_FULL_ASSERT    1U
197
+
198
+/* ################## Ethernet peripheral configuration ##################### */
199
+
200
+/* Section 1 : Ethernet peripheral configuration */
201
+
202
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
203
+#define MAC_ADDR0   2U
204
+#define MAC_ADDR1   0U
205
+#define MAC_ADDR2   0U
206
+#define MAC_ADDR3   0U
207
+#define MAC_ADDR4   0U
208
+#define MAC_ADDR5   0U
209
+
210
+/* Definition of the Ethernet driver buffers size and count */
211
+#define ETH_RX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for receive               */
212
+#define ETH_TX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for transmit              */
213
+#define ETH_RXBUFNB                    4U                  /* 4 Rx buffers of size ETH_RX_BUF_SIZE  */
214
+#define ETH_TXBUFNB                    4U                  /* 4 Tx buffers of size ETH_TX_BUF_SIZE  */
215
+
216
+/* Section 2: PHY configuration section */
217
+
218
+/* DP83848 PHY Address*/
219
+#define DP83848_PHY_ADDRESS             0x01U
220
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
221
+#define PHY_RESET_DELAY                 0x000000FFU
222
+/* PHY Configuration delay */
223
+#define PHY_CONFIG_DELAY                0x00000FFFU
224
+
225
+#define PHY_READ_TO                     0x0000FFFFU
226
+#define PHY_WRITE_TO                    0x0000FFFFU
227
+
228
+/* Section 3: Common PHY Registers */
229
+
230
+#define PHY_BCR                         ((uint16_t)0x0000)  /*!< Transceiver Basic Control Register   */
231
+#define PHY_BSR                         ((uint16_t)0x0001)  /*!< Transceiver Basic Status Register    */
232
+
233
+#define PHY_RESET                       ((uint16_t)0x8000)  /*!< PHY Reset */
234
+#define PHY_LOOPBACK                    ((uint16_t)0x4000)  /*!< Select loop-back mode */
235
+#define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100)  /*!< Set the full-duplex mode at 100 Mb/s */
236
+#define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000)  /*!< Set the half-duplex mode at 100 Mb/s */
237
+#define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100)  /*!< Set the full-duplex mode at 10 Mb/s  */
238
+#define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000)  /*!< Set the half-duplex mode at 10 Mb/s  */
239
+#define PHY_AUTONEGOTIATION             ((uint16_t)0x1000)  /*!< Enable auto-negotiation function     */
240
+#define PHY_RESTART_AUTONEGOTIATION     ((uint16_t)0x0200)  /*!< Restart auto-negotiation function    */
241
+#define PHY_POWERDOWN                   ((uint16_t)0x0800)  /*!< Select the power down mode           */
242
+#define PHY_ISOLATE                     ((uint16_t)0x0400)  /*!< Isolate PHY from MII                 */
243
+
244
+#define PHY_AUTONEGO_COMPLETE           ((uint16_t)0x0020)  /*!< Auto-Negotiation process completed   */
245
+#define PHY_LINKED_STATUS               ((uint16_t)0x0004)  /*!< Valid link established               */
246
+#define PHY_JABBER_DETECTION            ((uint16_t)0x0002)  /*!< Jabber condition detected            */
247
+
248
+/* Section 4: Extended PHY Registers */
249
+
250
+#define PHY_SR                          ((uint16_t)0x0010)  /*!< PHY status register Offset                      */
251
+#define PHY_MICR                        ((uint16_t)0x0011)  /*!< MII Interrupt Control Register                  */
252
+#define PHY_MISR                        ((uint16_t)0x0012)  /*!< MII Interrupt Status and Misc. Control Register */
253
+
254
+#define PHY_LINK_STATUS                 ((uint16_t)0x0001)  /*!< PHY Link mask                                   */
255
+#define PHY_SPEED_STATUS                ((uint16_t)0x0002)  /*!< PHY Speed mask                                  */
256
+#define PHY_DUPLEX_STATUS               ((uint16_t)0x0004)  /*!< PHY Duplex mask                                 */
257
+
258
+#define PHY_MICR_INT_EN                 ((uint16_t)0x0002)  /*!< PHY Enable interrupts                           */
259
+#define PHY_MICR_INT_OE                 ((uint16_t)0x0001)  /*!< PHY Enable output interrupt events              */
260
+
261
+#define PHY_MISR_LINK_INT_EN            ((uint16_t)0x0020)  /*!< Enable Interrupt on change of link status       */
262
+#define PHY_LINK_INTERRUPT              ((uint16_t)0x2000)  /*!< PHY link status interrupt mask                  */
263
+
264
+/* ################## SPI peripheral configuration ########################## */
265
+
266
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
267
+* Activated: CRC code is present inside driver
268
+* Deactivated: CRC code cleaned from driver
269
+*/
270
+
271
+#define USE_SPI_CRC                     0U
272
+
273
+/* Includes ------------------------------------------------------------------*/
274
+/**
275
+  * @brief Include module's header file
276
+  */
277
+
278
+#ifdef HAL_RCC_MODULE_ENABLED
279
+  #include "stm32f4xx_hal_rcc.h"
280
+#endif /* HAL_RCC_MODULE_ENABLED */
281
+
282
+#ifdef HAL_GPIO_MODULE_ENABLED
283
+  #include "stm32f4xx_hal_gpio.h"
284
+#endif /* HAL_GPIO_MODULE_ENABLED */
285
+
286
+#ifdef HAL_EXTI_MODULE_ENABLED
287
+  #include "stm32f4xx_hal_exti.h"
288
+#endif /* HAL_EXTI_MODULE_ENABLED */
289
+
290
+#ifdef HAL_DMA_MODULE_ENABLED
291
+  #include "stm32f4xx_hal_dma.h"
292
+#endif /* HAL_DMA_MODULE_ENABLED */
293
+
294
+#ifdef HAL_CORTEX_MODULE_ENABLED
295
+  #include "stm32f4xx_hal_cortex.h"
296
+#endif /* HAL_CORTEX_MODULE_ENABLED */
297
+
298
+#ifdef HAL_ADC_MODULE_ENABLED
299
+  #include "stm32f4xx_hal_adc.h"
300
+#endif /* HAL_ADC_MODULE_ENABLED */
301
+
302
+#ifdef HAL_CAN_MODULE_ENABLED
303
+  #include "stm32f4xx_hal_can.h"
304
+#endif /* HAL_CAN_MODULE_ENABLED */
305
+
306
+#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
307
+  #include "stm32f4xx_hal_can_legacy.h"
308
+#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
309
+
310
+#ifdef HAL_CRC_MODULE_ENABLED
311
+  #include "stm32f4xx_hal_crc.h"
312
+#endif /* HAL_CRC_MODULE_ENABLED */
313
+
314
+#ifdef HAL_CRYP_MODULE_ENABLED
315
+  #include "stm32f4xx_hal_cryp.h"
316
+#endif /* HAL_CRYP_MODULE_ENABLED */
317
+
318
+#ifdef HAL_DMA2D_MODULE_ENABLED
319
+  #include "stm32f4xx_hal_dma2d.h"
320
+#endif /* HAL_DMA2D_MODULE_ENABLED */
321
+
322
+#ifdef HAL_DAC_MODULE_ENABLED
323
+  #include "stm32f4xx_hal_dac.h"
324
+#endif /* HAL_DAC_MODULE_ENABLED */
325
+
326
+#ifdef HAL_DCMI_MODULE_ENABLED
327
+  #include "stm32f4xx_hal_dcmi.h"
328
+#endif /* HAL_DCMI_MODULE_ENABLED */
329
+
330
+#ifdef HAL_ETH_MODULE_ENABLED
331
+  #include "stm32f4xx_hal_eth.h"
332
+#endif /* HAL_ETH_MODULE_ENABLED */
333
+
334
+#ifdef HAL_FLASH_MODULE_ENABLED
335
+  #include "stm32f4xx_hal_flash.h"
336
+#endif /* HAL_FLASH_MODULE_ENABLED */
337
+
338
+#ifdef HAL_SRAM_MODULE_ENABLED
339
+  #include "stm32f4xx_hal_sram.h"
340
+#endif /* HAL_SRAM_MODULE_ENABLED */
341
+
342
+#ifdef HAL_NOR_MODULE_ENABLED
343
+  #include "stm32f4xx_hal_nor.h"
344
+#endif /* HAL_NOR_MODULE_ENABLED */
345
+
346
+#ifdef HAL_NAND_MODULE_ENABLED
347
+  #include "stm32f4xx_hal_nand.h"
348
+#endif /* HAL_NAND_MODULE_ENABLED */
349
+
350
+#ifdef HAL_PCCARD_MODULE_ENABLED
351
+  #include "stm32f4xx_hal_pccard.h"
352
+#endif /* HAL_PCCARD_MODULE_ENABLED */
353
+
354
+#ifdef HAL_SDRAM_MODULE_ENABLED
355
+  #include "stm32f4xx_hal_sdram.h"
356
+#endif /* HAL_SDRAM_MODULE_ENABLED */
357
+
358
+#ifdef HAL_HASH_MODULE_ENABLED
359
+ #include "stm32f4xx_hal_hash.h"
360
+#endif /* HAL_HASH_MODULE_ENABLED */
361
+
362
+#ifdef HAL_I2C_MODULE_ENABLED
363
+ #include "stm32f4xx_hal_i2c.h"
364
+#endif /* HAL_I2C_MODULE_ENABLED */
365
+
366
+#ifdef HAL_SMBUS_MODULE_ENABLED
367
+ #include "stm32f4xx_hal_smbus.h"
368
+#endif /* HAL_SMBUS_MODULE_ENABLED */
369
+
370
+#ifdef HAL_I2S_MODULE_ENABLED
371
+ #include "stm32f4xx_hal_i2s.h"
372
+#endif /* HAL_I2S_MODULE_ENABLED */
373
+
374
+#ifdef HAL_IWDG_MODULE_ENABLED
375
+ #include "stm32f4xx_hal_iwdg.h"
376
+#endif /* HAL_IWDG_MODULE_ENABLED */
377
+
378
+#ifdef HAL_LTDC_MODULE_ENABLED
379
+ #include "stm32f4xx_hal_ltdc.h"
380
+#endif /* HAL_LTDC_MODULE_ENABLED */
381
+
382
+#ifdef HAL_PWR_MODULE_ENABLED
383
+ #include "stm32f4xx_hal_pwr.h"
384
+#endif /* HAL_PWR_MODULE_ENABLED */
385
+
386
+#ifdef HAL_RNG_MODULE_ENABLED
387
+ #include "stm32f4xx_hal_rng.h"
388
+#endif /* HAL_RNG_MODULE_ENABLED */
389
+
390
+#ifdef HAL_RTC_MODULE_ENABLED
391
+ #include "stm32f4xx_hal_rtc.h"
392
+#endif /* HAL_RTC_MODULE_ENABLED */
393
+
394
+#ifdef HAL_SAI_MODULE_ENABLED
395
+ #include "stm32f4xx_hal_sai.h"
396
+#endif /* HAL_SAI_MODULE_ENABLED */
397
+
398
+#ifdef HAL_SD_MODULE_ENABLED
399
+ #include "stm32f4xx_hal_sd.h"
400
+#endif /* HAL_SD_MODULE_ENABLED */
401
+
402
+#ifdef HAL_SPI_MODULE_ENABLED
403
+ #include "stm32f4xx_hal_spi.h"
404
+#endif /* HAL_SPI_MODULE_ENABLED */
405
+
406
+#ifdef HAL_TIM_MODULE_ENABLED
407
+ #include "stm32f4xx_hal_tim.h"
408
+#endif /* HAL_TIM_MODULE_ENABLED */
409
+
410
+#ifdef HAL_UART_MODULE_ENABLED
411
+ #include "stm32f4xx_hal_uart.h"
412
+#endif /* HAL_UART_MODULE_ENABLED */
413
+
414
+#ifdef HAL_USART_MODULE_ENABLED
415
+ #include "stm32f4xx_hal_usart.h"
416
+#endif /* HAL_USART_MODULE_ENABLED */
417
+
418
+#ifdef HAL_IRDA_MODULE_ENABLED
419
+ #include "stm32f4xx_hal_irda.h"
420
+#endif /* HAL_IRDA_MODULE_ENABLED */
421
+
422
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
423
+ #include "stm32f4xx_hal_smartcard.h"
424
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
425
+
426
+#ifdef HAL_WWDG_MODULE_ENABLED
427
+ #include "stm32f4xx_hal_wwdg.h"
428
+#endif /* HAL_WWDG_MODULE_ENABLED */
429
+
430
+#ifdef HAL_PCD_MODULE_ENABLED
431
+ #include "stm32f4xx_hal_pcd.h"
432
+#endif /* HAL_PCD_MODULE_ENABLED */
433
+
434
+#ifdef HAL_HCD_MODULE_ENABLED
435
+ #include "stm32f4xx_hal_hcd.h"
436
+#endif /* HAL_HCD_MODULE_ENABLED */
437
+
438
+#ifdef HAL_DSI_MODULE_ENABLED
439
+ #include "stm32f4xx_hal_dsi.h"
440
+#endif /* HAL_DSI_MODULE_ENABLED */
441
+
442
+#ifdef HAL_QSPI_MODULE_ENABLED
443
+ #include "stm32f4xx_hal_qspi.h"
444
+#endif /* HAL_QSPI_MODULE_ENABLED */
445
+
446
+#ifdef HAL_CEC_MODULE_ENABLED
447
+ #include "stm32f4xx_hal_cec.h"
448
+#endif /* HAL_CEC_MODULE_ENABLED */
449
+
450
+#ifdef HAL_FMPI2C_MODULE_ENABLED
451
+ #include "stm32f4xx_hal_fmpi2c.h"
452
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
453
+
454
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
455
+ #include "stm32f4xx_hal_spdifrx.h"
456
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
457
+
458
+#ifdef HAL_DFSDM_MODULE_ENABLED
459
+ #include "stm32f4xx_hal_dfsdm.h"
460
+#endif /* HAL_DFSDM_MODULE_ENABLED */
461
+
462
+#ifdef HAL_LPTIM_MODULE_ENABLED
463
+ #include "stm32f4xx_hal_lptim.h"
464
+#endif /* HAL_LPTIM_MODULE_ENABLED */
465
+
466
+#ifdef HAL_MMC_MODULE_ENABLED
467
+ #include "stm32f4xx_hal_mmc.h"
468
+#endif /* HAL_MMC_MODULE_ENABLED */
469
+
470
+/* Exported macro ------------------------------------------------------------*/
471
+#ifdef  USE_FULL_ASSERT
472
+/**
473
+  * @brief  The assert_param macro is used for function's parameters check.
474
+  * @param  expr If expr is false, it calls assert_failed function
475
+  *         which reports the name of the source file and the source
476
+  *         line number of the call that failed.
477
+  *         If expr is true, it returns no value.
478
+  * @retval None
479
+  */
480
+  #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
481
+/* Exported functions ------------------------------------------------------- */
482
+  void assert_failed(uint8_t* file, uint32_t line);
483
+#else
484
+  #define assert_param(expr) ((void)0U)
485
+#endif /* USE_FULL_ASSERT */
486
+
487
+
488
+#ifdef __cplusplus
489
+}
490
+#endif
491
+
492
+#endif /* __STM32F4xx_HAL_CONF_H */
493
+
494
+
495
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 203
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/ldscript.ld Zobrazit soubor

@@ -0,0 +1,203 @@
1
+/*
2
+******************************************************************************
3
+**
4
+**  File        : LinkerScript.ld
5
+**
6
+**  Abstract    : Linker script for STM32F4x7Vx Device with
7
+**                512/1024KByte FLASH, 192KByte 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
+**  Target      : STMicroelectronics STM32
15
+**
16
+**  Distribution: The file is distributed “as is,” without any warranty
17
+**                of any kind.
18
+**
19
+*****************************************************************************
20
+** @attention
21
+**
22
+** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
23
+**
24
+** Redistribution and use in source and binary forms, with or without modification,
25
+** are permitted provided that the following conditions are met:
26
+**   1. Redistributions of source code must retain the above copyright notice,
27
+**      this list of conditions and the following disclaimer.
28
+**   2. Redistributions in binary form must reproduce the above copyright notice,
29
+**      this list of conditions and the following disclaimer in the documentation
30
+**      and/or other materials provided with the distribution.
31
+**   3. Neither the name of STMicroelectronics nor the names of its contributors
32
+**      may be used to endorse or promote products derived from this software
33
+**      without specific prior written permission.
34
+**
35
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38
+** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
39
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
41
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
43
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
+**
46
+*****************************************************************************
47
+*/
48
+
49
+/* Entry Point */
50
+ENTRY(Reset_Handler)
51
+
52
+/* Highest address of the user mode stack */
53
+_estack = 0x20000000 + LD_MAX_DATA_SIZE;    /* end of RAM */
54
+/* Generate a link error if heap and stack don't fit into RAM */
55
+_Min_Heap_Size = 0x200;  /* required amount of heap  */
56
+_Min_Stack_Size = 0x400; /* required amount of stack */
57
+
58
+/* Specify the memory areas */
59
+MEMORY
60
+{
61
+RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
62
+CCMRAM (rw)      : ORIGIN = 0x10000000, LENGTH = 64K
63
+FLASH (rx)     : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
64
+}
65
+
66
+/* Define output sections */
67
+SECTIONS
68
+{
69
+  /* The startup code goes first into FLASH */
70
+  .isr_vector :
71
+  {
72
+    . = ALIGN(4);
73
+    KEEP(*(.isr_vector)) /* Startup code */
74
+    . = ALIGN(4);
75
+  } >FLASH
76
+
77
+  /* The program code and other data goes into FLASH */
78
+  .text :
79
+  {
80
+    . = ALIGN(4);
81
+    *(.text)           /* .text sections (code) */
82
+    *(.text*)          /* .text* sections (code) */
83
+    *(.glue_7)         /* glue arm to thumb code */
84
+    *(.glue_7t)        /* glue thumb to arm code */
85
+    *(.eh_frame)
86
+
87
+    KEEP (*(.init))
88
+    KEEP (*(.fini))
89
+
90
+    . = ALIGN(4);
91
+    _etext = .;        /* define a global symbols at end of code */
92
+  } >FLASH
93
+
94
+  /* Constant data goes into FLASH */
95
+  .rodata :
96
+  {
97
+    . = ALIGN(4);
98
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
99
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
100
+    . = ALIGN(4);
101
+  } >FLASH
102
+
103
+  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
104
+  .ARM : {
105
+    __exidx_start = .;
106
+    *(.ARM.exidx*)
107
+    __exidx_end = .;
108
+  } >FLASH
109
+
110
+  .preinit_array     :
111
+  {
112
+    PROVIDE_HIDDEN (__preinit_array_start = .);
113
+    KEEP (*(.preinit_array*))
114
+    PROVIDE_HIDDEN (__preinit_array_end = .);
115
+  } >FLASH
116
+  .init_array :
117
+  {
118
+    PROVIDE_HIDDEN (__init_array_start = .);
119
+    KEEP (*(SORT(.init_array.*)))
120
+    KEEP (*(.init_array*))
121
+    PROVIDE_HIDDEN (__init_array_end = .);
122
+  } >FLASH
123
+  .fini_array :
124
+  {
125
+    PROVIDE_HIDDEN (__fini_array_start = .);
126
+    KEEP (*(SORT(.fini_array.*)))
127
+    KEEP (*(.fini_array*))
128
+    PROVIDE_HIDDEN (__fini_array_end = .);
129
+  } >FLASH
130
+
131
+  /* used by the startup to initialize data */
132
+  _sidata = LOADADDR(.data);
133
+
134
+  /* Initialized data sections goes into RAM, load LMA copy after code */
135
+  .data :
136
+  {
137
+    . = ALIGN(4);
138
+    _sdata = .;        /* create a global symbol at data start */
139
+    *(.data)           /* .data sections */
140
+    *(.data*)          /* .data* sections */
141
+
142
+    . = ALIGN(4);
143
+    _edata = .;        /* define a global symbol at data end */
144
+  } >RAM AT> FLASH
145
+
146
+  _siccmram = LOADADDR(.ccmram);
147
+
148
+  /* CCM-RAM section
149
+  *
150
+  * IMPORTANT NOTE!
151
+  * If initialized variables will be placed in this section,
152
+  * the startup code needs to be modified to copy the init-values.
153
+  */
154
+  .ccmram :
155
+  {
156
+    . = ALIGN(4);
157
+    _sccmram = .;       /* create a global symbol at ccmram start */
158
+    *(.ccmram)
159
+    *(.ccmram*)
160
+
161
+    . = ALIGN(4);
162
+    _eccmram = .;       /* create a global symbol at ccmram end */
163
+  } >CCMRAM AT> FLASH
164
+
165
+
166
+  /* Uninitialized data section */
167
+  . = ALIGN(4);
168
+  .bss :
169
+  {
170
+    /* This is used by the startup in order to initialize the .bss secion */
171
+    _sbss = .;         /* define a global symbol at bss start */
172
+    __bss_start__ = _sbss;
173
+    *(.bss)
174
+    *(.bss*)
175
+    *(COMMON)
176
+
177
+    . = ALIGN(4);
178
+    _ebss = .;         /* define a global symbol at bss end */
179
+    __bss_end__ = _ebss;
180
+  } >RAM
181
+
182
+  /* User_heap_stack section, used to check that there is enough RAM left */
183
+  ._user_heap_stack :
184
+  {
185
+    . = ALIGN(8);
186
+    PROVIDE ( end = . );
187
+    PROVIDE ( _end = . );
188
+    . = . + _Min_Heap_Size;
189
+    . = . + _Min_Stack_Size;
190
+    . = ALIGN(8);
191
+  } >RAM
192
+
193
+
194
+  /* Remove information from the standard libraries */
195
+  /DISCARD/ :
196
+  {
197
+    libc.a ( * )
198
+    libm.a ( * )
199
+    libgcc.a ( * )
200
+  }
201
+
202
+  .ARM.attributes 0 : { *(.ARM.attributes) }
203
+}

+ 275
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/variant.cpp Zobrazit soubor

@@ -0,0 +1,275 @@
1
+/*
2
+  Copyright (c) 2011 Arduino.  All right reserved.
3
+
4
+  This library is free software; you can redistribute it and/or
5
+  modify it under the terms of the GNU Lesser General Public
6
+  License as published by the Free Software Foundation; either
7
+  version 2.1 of the License, or (at your option) any later version.
8
+
9
+  This library is distributed in the hope that it will be useful,
10
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+  See the GNU Lesser General Public License for more details.
13
+
14
+  You should have received a copy of the GNU Lesser General Public
15
+  License along with this library; if not, write to the Free Software
16
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
+*/
18
+
19
+#include "pins_arduino.h"
20
+
21
+#ifdef __cplusplus
22
+extern "C" {
23
+#endif
24
+
25
+// Digital PinName array
26
+const PinName digitalPin[] = {
27
+  PA_0,  // Digital pin 0
28
+  PA_1,  // Digital pin 1
29
+  PA_2,  // Digital pin 2
30
+  PA_3,  // Digital pin 3
31
+  PA_4,  // Digital pin 4
32
+  PA_5,  // Digital pin 5
33
+  PA_6,  // Digital pin 6
34
+  PA_7,  // Digital pin 7
35
+  PA_8,  // Digital pin 8
36
+  PA_9,  // Digital pin 9
37
+  PA_10, // Digital pin 10
38
+  PA_11, // Digital pin 11
39
+  PA_12, // Digital pin 12
40
+  PA_13, // Digital pin 13
41
+  PA_14, // Digital pin 14
42
+  PA_15, // Digital pin 15
43
+
44
+  PB_0,  // Digital pin 16
45
+  PB_1,  // Digital pin 17
46
+  PB_2,  // Digital pin 18
47
+  PB_3,  // Digital pin 19
48
+  PB_4,  // Digital pin 20
49
+  PB_5,  // Digital pin 21
50
+  PB_6,  // Digital pin 22
51
+  PB_7,  // Digital pin 23
52
+  PB_8,  // Digital pin 24
53
+  PB_9,  // Digital pin 25
54
+  PB_10, // Digital pin 26
55
+  PB_11, // Digital pin 27
56
+  PB_12, // Digital pin 28
57
+  PB_13, // Digital pin 29
58
+  PB_14, // Digital pin 30
59
+  PB_15, // Digital pin 31
60
+
61
+  PC_0,  // Digital pin 32
62
+  PC_1,  // Digital pin 33
63
+  PC_2,  // Digital pin 34
64
+  PC_3,  // Digital pin 35
65
+  PC_4,  // Digital pin 36
66
+  PC_5,  // Digital pin 37
67
+  PC_6,  // Digital pin 38
68
+  PC_7,  // Digital pin 39
69
+  PC_8,  // Digital pin 40
70
+  PC_9,  // Digital pin 41
71
+  PC_10, // Digital pin 42
72
+  PC_11, // Digital pin 43
73
+  PC_12, // Digital pin 44
74
+  PC_13, // Digital pin 45
75
+  PC_14, // Digital pin 46
76
+  PC_15, // Digital pin 47
77
+
78
+  PD_0,  // Digital pin 48
79
+  PD_1,  // Digital pin 49
80
+  PD_2,  // Digital pin 50
81
+  PD_3,  // Digital pin 51
82
+  PD_4,  // Digital pin 52
83
+  PD_5,  // Digital pin 53
84
+  PD_6,  // Digital pin 54
85
+  PD_7,  // Digital pin 55
86
+  PD_8,  // Digital pin 56
87
+  PD_9,  // Digital pin 57
88
+  PD_10, // Digital pin 58
89
+  PD_11, // Digital pin 59
90
+  PD_12, // Digital pin 60
91
+  PD_13, // Digital pin 61
92
+  PD_14, // Digital pin 62
93
+  PD_15, // Digital pin 63
94
+
95
+  PE_0,  // Digital pin 64
96
+  PE_1,  // Digital pin 65
97
+  PE_2,  // Digital pin 66
98
+  PE_3,  // Digital pin 67
99
+  PE_4,  // Digital pin 68
100
+  PE_5,  // Digital pin 69
101
+  PE_6,  // Digital pin 70
102
+  PE_7,  // Digital pin 71
103
+  PE_8,  // Digital pin 72
104
+  PE_9,  // Digital pin 73
105
+  PE_10, // Digital pin 74
106
+  PE_11, // Digital pin 75
107
+  PE_12, // Digital pin 76
108
+  PE_13, // Digital pin 77
109
+  PE_14, // Digital pin 78
110
+  PE_15, // Digital pin 79
111
+
112
+  PH_0,  // Digital pin 80, used by the external oscillator
113
+  PH_1   // Digital pin 81, used by the external oscillator
114
+};
115
+
116
+// Analog (Ax) pin number array
117
+const uint32_t analogInputPin[] = {
118
+  0,  // A0,  PA0
119
+  1,  // A1,  PA1
120
+  2,  // A2,  PA2
121
+  3,  // A3,  PA3
122
+  4,  // A4,  PA4
123
+  5,  // A5,  PA5
124
+  6,  // A6,  PA6
125
+  7,  // A7,  PA7
126
+  16, // A8,  PB0
127
+  17, // A9,  PB1
128
+  32, // A10, PC0
129
+  33, // A11, PC1
130
+  34, // A12, PC2
131
+  35, // A13, PC3
132
+  36, // A14, PC4
133
+  37  // A15, PC5
134
+};
135
+
136
+#ifdef __cplusplus
137
+}
138
+#endif
139
+
140
+// ----------------------------------------------------------------------------
141
+
142
+#ifdef __cplusplus
143
+extern "C" {
144
+#endif
145
+
146
+/*
147
+ * @brief  Configures the System clock source, PLL Multiplier and Divider factors,
148
+ *               AHB/APBx prescalers and Flash settings
149
+ * @note   This function should be called only once the RCC clock configuration
150
+ *         is reset to the default reset state (done in SystemInit() function).
151
+ * @param  None
152
+ * @retval None
153
+ */
154
+
155
+/******************************************************************************/
156
+/*            PLL (clocked by HSE) used as System clock source                */
157
+/******************************************************************************/
158
+static uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
159
+{
160
+  RCC_OscInitTypeDef RCC_OscInitStruct;
161
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
162
+
163
+  /* The voltage scaling allows optimizing the power consumption when the device is
164
+  clocked below the maximum system frequency, to update the voltage scaling value
165
+  regarding system frequency refer to product datasheet. */
166
+  __HAL_RCC_PWR_CLK_ENABLE();
167
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
168
+
169
+  // Enable HSE oscillator and activate PLL with HSE as source
170
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSE;
171
+  if (bypass == 0) {
172
+    RCC_OscInitStruct.HSEState          = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT
173
+  } else {
174
+    RCC_OscInitStruct.HSEState          = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN
175
+  }
176
+
177
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
178
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSE;
179
+  RCC_OscInitStruct.PLL.PLLM            = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not
180
+  RCC_OscInitStruct.PLL.PLLN            = 336;                  // VCO output clock = 336 MHz (1 MHz * 336)
181
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV2;        // PLLCLK = 168 MHz (336 MHz / 2)
182
+  RCC_OscInitStruct.PLL.PLLQ            = 7;
183
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
184
+    return 0; // FAIL
185
+  }
186
+
187
+  // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers
188
+  RCC_ClkInitStruct.ClockType      = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
189
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK;
190
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 168 MHz
191
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;           // 42 MHz
192
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;           // 84 MHz
193
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
194
+    return 0; // FAIL
195
+  }
196
+
197
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
198
+  /*
199
+  if (bypass == 0)
200
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz
201
+  else
202
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz
203
+  */
204
+
205
+  return 1; // OK
206
+}
207
+
208
+/******************************************************************************/
209
+/*            PLL (clocked by HSI) used as System clock source                */
210
+/******************************************************************************/
211
+uint8_t SetSysClock_PLL_HSI(void)
212
+{
213
+  RCC_OscInitTypeDef RCC_OscInitStruct;
214
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
215
+
216
+  /* The voltage scaling allows optimizing the power consumption when the device is
217
+    clocked below the maximum system frequency, to update the voltage scaling value
218
+    regarding system frequency refer to product datasheet. */
219
+  __HAL_RCC_PWR_CLK_ENABLE();
220
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
221
+
222
+  // Enable HSI oscillator and activate PLL with HSI as source
223
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
224
+  RCC_OscInitStruct.HSIState            = RCC_HSI_ON;
225
+  RCC_OscInitStruct.HSEState            = RCC_HSE_OFF;
226
+  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
227
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
228
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSI;
229
+  RCC_OscInitStruct.PLL.PLLM            = 16;            // VCO input clock = 1 MHz (16 MHz / 16)
230
+  RCC_OscInitStruct.PLL.PLLN            = 336;           // VCO output clock = 336 MHz (1 MHz * 336)
231
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV2; // PLLCLK = 168 MHz (336 MHz / 2)
232
+  RCC_OscInitStruct.PLL.PLLQ            = 7;
233
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
234
+    return 0; // FAIL
235
+  }
236
+
237
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
238
+  RCC_ClkInitStruct.ClockType      = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
239
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK;
240
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 168 MHz
241
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;           // 42 MHz
242
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;           // 84 MHz
243
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
244
+    return 0; // FAIL
245
+  }
246
+
247
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
248
+  //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
249
+
250
+  return 1; // OK
251
+}
252
+
253
+WEAK void SystemClock_Config(void)
254
+{
255
+  /* 1- If fail try to start with HSE and external xtal */
256
+  if (SetSysClock_PLL_HSE(0) == 0) {
257
+    /* 2- Try to start with HSE and external clock */
258
+    if (SetSysClock_PLL_HSE(1) == 0) {
259
+      /* 3- If fail start with HSI clock */
260
+      if (SetSysClock_PLL_HSI() == 0) {
261
+        Error_Handler();
262
+      }
263
+    }
264
+  }
265
+
266
+  /* Ensure CCM RAM clock is enabled */
267
+  __HAL_RCC_CCMDATARAMEN_CLK_ENABLE();
268
+
269
+  /* Output clock on MCO2 pin(PC9) for debugging purpose */
270
+  //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4);
271
+}
272
+
273
+#ifdef __cplusplus
274
+}
275
+#endif

+ 199
- 0
buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/variant.h Zobrazit soubor

@@ -0,0 +1,199 @@
1
+/*
2
+  Copyright (c) 2011 Arduino.  All right reserved.
3
+
4
+  This library is free software; you can redistribute it and/or
5
+  modify it under the terms of the GNU Lesser General Public
6
+  License as published by the Free Software Foundation; either
7
+  version 2.1 of the License, or (at your option) any later version.
8
+
9
+  This library is distributed in the hope that it will be useful,
10
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+  See the GNU Lesser General Public License for more details.
13
+
14
+  You should have received a copy of the GNU Lesser General Public
15
+  License along with this library; if not, write to the Free Software
16
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
+*/
18
+
19
+#ifndef _VARIANT_ARDUINO_STM32_
20
+#define _VARIANT_ARDUINO_STM32_
21
+
22
+#ifdef __cplusplus
23
+extern "C" {
24
+#endif // __cplusplus
25
+
26
+/*----------------------------------------------------------------------------
27
+ *        Pins
28
+ *----------------------------------------------------------------------------*/
29
+
30
+//                  | DIGITAL | ANALOG IN  | ANALOG OUT | UART/USART            | TWI                  | SPI                               | SPECIAL   |
31
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
32
+#define PA0  PIN_A0  // | 0       | A0 (ADC1)  |            | UART4_TX              |                      |                                   |           |
33
+#define PA1  PIN_A1  // | 1       | A1 (ADC1)  |            | UART4_RX              |                      |                                   |           |
34
+#define PA2  PIN_A2  // | 2       | A2 (ADC1)  |            | USART2_TX             |                      |                                   |           |
35
+#define PA3  PIN_A3  // | 3       | A3 (ADC1)  |            | USART2_RX             |                      |                                   |           |
36
+#define PA4  PIN_A4  // | 4       | A4 (ADC1)  | DAC_OUT1   |                       |                      | SPI1_SS, (SPI3_SS)                |           |
37
+#define PA5  PIN_A5  // | 5       | A5 (ADC1)  | DAC_OUT2   |                       |                      | SPI1_SCK                          |           |
38
+#define PA6  PIN_A6  // | 6       | A6 (ADC1)  |            |                       |                      | SPI1_MISO                         |           |
39
+#define PA7  PIN_A7  // | 7       | A7 (ADC1)  |            |                       |                      | SPI1_MOSI                         |           |
40
+#define PA8  8   // | 8       |            |            |                       | TWI3_SCL             |                                   |           |
41
+#define PA9  9   // | 9       |            |            | USART1_TX             |                      |                                   |           |
42
+#define PA10 10  // | 10      |            |            | USART1_RX             |                      |                                   |           |
43
+#define PA11 11  // | 11      |            |            |                       |                      |                                   |           |
44
+#define PA12 12  // | 12      |            |            |                       |                      |                                   |           |
45
+#define PA13 13  // | 13      |            |            |                       |                      |                                   | SWD_SWDIO |
46
+#define PA14 14  // | 14      |            |            |                       |                      |                                   | SWD_SWCLK |
47
+#define PA15 15  // | 15      |            |            |                       |                      | SPI3_SS, (SPI1_SS)                |           |
48
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
49
+#define PB0  PIN_A8  // | 16      | A8 (ADC1)  |            |                       |                      |                                   |           |
50
+#define PB1  PIN_A9  // | 17      | A9 (ADC1)  |            |                       |                      |                                   |           |
51
+#define PB2  18  // | 18      |            |            |                       |                      |                                   | BOOT1     |
52
+#define PB3  19  // | 19      |            |            |                       |                      | SPI3_SCK,  (SPI1_SCK)             |           |
53
+#define PB4  20  // | 20      |            |            |                       |                      | SPI3_MISO, (SPI1_MISO)            |           |
54
+#define PB5  21  // | 21      |            |            |                       |                      | SPI3_MOSI, (SPI1_MOSI)            |           |
55
+#define PB6  22  // | 22      |            |            | USART1_TX             | TWI1_SCL             |                                   |           |
56
+#define PB7  23  // | 23      |            |            | USART1_RX             | TWI1_SDA             |                                   |           |
57
+#define PB8  24  // | 24      |            |            |                       | TWI1_SCL             |                                   |           |
58
+#define PB9  25  // | 25      |            |            |                       | TWI1_SDA             | SPI2_SS                           |           |
59
+#define PB10 26  // | 26      |            |            | USART3_TX, (UART4_TX) | TWI2_SCL             | SPI2_SCK                          |           |
60
+#define PB11 27  // | 27      |            |            | USART3_RX             | TWI2_SDA             |                                   |           |
61
+#define PB12 28  // | 28      |            |            |                       |                      | SPI2_SS                           |           |
62
+#define PB13 29  // | 29      |            |            |                       |                      | SPI2_SCK                          |           |
63
+#define PB14 30  // | 30      |            |            |                       |                      | SPI2_MISO                         |           |
64
+#define PB15 31  // | 31      |            |            |                       |                      | SPI2_MOSI                         |           |
65
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
66
+#define PC0  PIN_A10 // | 32      | A10 (ADC1) |            |                       |                      |                                   |           |
67
+#define PC1  PIN_A11 // | 33      | A11 (ADC1) |            |                       |                      |                                   |           |
68
+#define PC2  PIN_A12 // | 34      | A12 (ADC1) |            |                       |                      | SPI2_MISO                         |           |
69
+#define PC3  PIN_A13 // | 35      | A13 (ADC1) |            |                       |                      | SPI2_MOSI                         |           |
70
+#define PC4  PIN_A14 // | 36      | A14 (ADC1) |            |                       |                      |                                   |           |
71
+#define PC5  PIN_A15 // | 37      | A15 (ADC1) |            | USART3_RX             |                      |                                   |           |
72
+#define PC6  38  // | 38      |            |            | USART6_TX             |                      |                                   |           |
73
+#define PC7  39  // | 39      |            |            | USART6_RX             |                      |                                   |           |
74
+#define PC8  40  // | 40      |            |            |                       |                      |                                   |           |
75
+#define PC9  41  // | 41      |            |            | USART3_TX             | TWI3_SDA             |                                   |           |
76
+#define PC10 42  // | 42      |            |            |                       |                      | SPI3_SCK                          |           |
77
+#define PC11 43  // | 43      |            |            | USART3_RX, (UART4_RX) |                      | SPI3_MISO                         |           |
78
+#define PC12 44  // | 44      |            |            | UART5_TX              |                      | SPI3_MOSI                         |           |
79
+#define PC13 45  // | 45      |            |            |                       |                      |                                   |           |
80
+#define PC14 46  // | 46      |            |            |                       |                      |                                   | OSC32_IN  |
81
+#define PC15 47  // | 47      |            |            |                       |                      |                                   | OSC32_OUT |
82
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
83
+#define PD0  48  // | 48      |            |            |                       |                      |                                   |           |
84
+#define PD1  49  // | 49      |            |            |                       |                      |                                   |           |
85
+#define PD2  50  // | 50      |            |            | UART5_RX              |                      |                                   |           |
86
+#define PD3  51  // | 51      |            |            |                       |                      |                                   |           |
87
+#define PD4  52  // | 52      |            |            |                       |                      |                                   |           |
88
+#define PD5  53  // | 53      |            |            | USART2_TX             |                      |                                   |           |
89
+#define PD6  54  // | 54      |            |            | USART2_RX             |                      |                                   |           |
90
+#define PD7  55  // | 55      |            |            |                       |                      |                                   |           |
91
+#define PD8  56  // | 56      |            |            | USART3_TX             |                      |                                   |           |
92
+#define PD9  57  // | 57      |            |            | USART3_RX             |                      |                                   |           |
93
+#define PD10 58  // | 58      |            |            |                       |                      |                                   |           |
94
+#define PD11 59  // | 59      |            |            |                       |                      |                                   |           |
95
+#define PD12 60  // | 60      |            |            |                       |                      |                                   |           |
96
+#define PD13 61  // | 61      |            |            |                       |                      |                                   |           |
97
+#define PD14 62  // | 62      |            |            |                       |                      |                                   |           |
98
+#define PD15 63  // | 63      |            |            |                       |                      |                                   |           |
99
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
100
+#define PE0  64  // | 64      |            |            |                       |                      |                                   |           |
101
+#define PE1  65  // | 65      |            |            |                       |                      |                                   |           |
102
+#define PE2  66  // | 66      |            |            |                       |                      |                                   |           |
103
+#define PE3  67  // | 67      |            |            |                       |                      |                                   |           |
104
+#define PE4  68  // | 68      |            |            |                       |                      |                                   |           |
105
+#define PE5  69  // | 69      |            |            |                       |                      |                                   |           |
106
+#define PE6  70  // | 70      |            |            |                       |                      |                                   |           |
107
+#define PE7  71  // | 71      |            |            |                       |                      |                                   |           |
108
+#define PE8  72  // | 72      |            |            |                       |                      |                                   |           |
109
+#define PE9  73  // | 73      |            |            |                       |                      |                                   |           |
110
+#define PE10 74  // | 74      |            |            |                       |                      |                                   |           |
111
+#define PE11 75  // | 75      |            |            |                       |                      |                                   |           |
112
+#define PE12 76  // | 76      |            |            |                       |                      |                                   |           |
113
+#define PE13 77  // | 77      |            |            |                       |                      |                                   |           |
114
+#define PE14 78  // | 78      |            |            |                       |                      |                                   |           |
115
+#define PE15 79  // | 79      |            |            |                       |                      |                                   |           |
116
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
117
+#define PH0  80  // | 80      |            |            |                       |                      |                                   | OSC_IN    |
118
+#define PH1  81  // | 81      |            |            |                       |                      |                                   | OSC_OUT   |
119
+//                  |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
120
+
121
+/// This must be a literal
122
+#define NUM_DIGITAL_PINS        82
123
+#define NUM_ANALOG_INPUTS       16
124
+
125
+// On-board LED pin number
126
+#ifndef LED_BUILTIN
127
+#define LED_BUILTIN             PA5
128
+#endif
129
+#define LED_GREEN               LED_BUILTIN
130
+
131
+// On-board user button
132
+#ifndef USER_BTN
133
+#define USER_BTN                PC13
134
+#endif
135
+
136
+// SPI definitions
137
+#define PIN_SPI_SS              PA4
138
+#define PIN_SPI_SS1             PA4
139
+#define PIN_SPI_SS2             PB12
140
+#define PIN_SPI_SS3             PA15
141
+#define PIN_SPI_MOSI            PA7
142
+#define PIN_SPI_MISO            PA6
143
+#define PIN_SPI_SCK             PA5
144
+
145
+// I2C definitions
146
+#define PIN_WIRE_SDA            PB9
147
+#define PIN_WIRE_SCL            PB8
148
+
149
+// Timer Definitions
150
+// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
151
+#ifndef TIMER_TONE
152
+  #define TIMER_TONE            TIM6
153
+#endif
154
+#ifndef TIMER_SERVO
155
+  #define TIMER_SERVO           TIM7
156
+#endif
157
+#ifndef TIMER_SERIAL
158
+  #define TIMER_SERIAL          TIM5
159
+#endif
160
+
161
+// UART Definitions
162
+#define SERIAL_UART_INSTANCE    2
163
+
164
+// Default pin used for 'Serial' instance
165
+// Mandatory for Firmata
166
+#define PIN_SERIAL_RX           PA3
167
+#define PIN_SERIAL_TX           PA2
168
+
169
+/* Extra HAL modules */
170
+#define HAL_DAC_MODULE_ENABLED
171
+
172
+#ifdef __cplusplus
173
+} // extern "C"
174
+#endif
175
+/*----------------------------------------------------------------------------
176
+ *        Arduino objects - C++ only
177
+ *----------------------------------------------------------------------------*/
178
+
179
+#ifdef __cplusplus
180
+  // These serial port names are intended to allow libraries and architecture-neutral
181
+  // sketches to automatically default to the correct port name for a particular type
182
+  // of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
183
+  // the first hardware serial port whose RX/TX pins are not dedicated to another use.
184
+  //
185
+  // SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
186
+  //
187
+  // SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
188
+  //
189
+  // SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
190
+  //
191
+  // SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
192
+  //
193
+  // SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
194
+  //                            pins are NOT connected to anything by default.
195
+  #define SERIAL_PORT_MONITOR     Serial
196
+  #define SERIAL_PORT_HARDWARE    Serial1
197
+#endif
198
+
199
+#endif /* _VARIANT_ARDUINO_STM32_ */

+ 22
- 0
platformio.ini Zobrazit soubor

@@ -1377,6 +1377,28 @@ extra_scripts        = ${common.extra_scripts}
1377 1377
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
1378 1378
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
1379 1379
 
1380
+#
1381
+# MKS Robin Nano V3
1382
+#
1383
+[env:mks_robin_nano_v3]
1384
+platform             = ${common_stm32.platform}
1385
+extends              = common_stm32
1386
+build_flags          = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED -DUSBCON -DUSBD_USE_CDC
1387
+board                = genericSTM32F407VGT6
1388
+board_build.core     = stm32
1389
+board_build.variant  = MARLIN_F4x7Vx
1390
+board_build.ldscript = ldscript.ld
1391
+board_build.firmware = Robin_nano_v3.bin
1392
+board_build.offset   = 0xC000
1393
+board_upload.offset_address = 0x0800C000
1394
+build_unflags        = ${common_stm32.build_unflags}
1395
+debug_tool           = jlink
1396
+upload_protocol      = jlink
1397
+extra_scripts        = ${common.extra_scripts}
1398
+  pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
1399
+  buildroot/share/PlatformIO/scripts/stm32_bootloader.py
1400
+  buildroot/share/PlatformIO/scripts/mks_encrypt.py
1401
+
1380 1402
 #################################
1381 1403
 #                               #
1382 1404
 #      Other Architectures      #

Loading…
Zrušit
Uložit