Browse Source

✨ Tronxy v10 (#24787)

ellensp 1 year ago
parent
commit
1aa0ece8a4
No account linked to committer's email address

+ 1
- 1
Marlin/Configuration.h View File

@@ -3059,7 +3059,7 @@
3059 3059
 //#define MKS_ROBIN_TFT_V1_1R
3060 3060
 
3061 3061
 //
3062
-// 480x320, 3.5", FSMC Stock Display from TronxXY
3062
+// 480x320, 3.5", FSMC Stock Display from Tronxy
3063 3063
 //
3064 3064
 //#define TFT_TRONXY_X5SA
3065 3065
 

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

@@ -426,6 +426,7 @@
426 426
 #define BOARD_OPULO_LUMEN_REV4        4241  // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG)
427 427
 #define BOARD_FYSETC_SPIDER_KING407   4242  // FYSETC Spider King407 (STM32F407ZG)
428 428
 #define BOARD_MKS_SKIPR_V1            4243  // MKS SKIPR v1.0 all-in-one board (STM32F407VE)
429
+#define BOARD_TRONXY_V10              4244  // TRONXY V10 (STM32F446ZE)
429 430
 
430 431
 //
431 432
 // ARM Cortex M7

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

@@ -711,6 +711,8 @@
711 711
   #include "stm32f4/pins_FYSETC_SPIDER_KING407.h" // STM32F4                              env:FYSETC_SPIDER_KING407
712 712
 #elif MB(MKS_SKIPR_V1)
713 713
   #include "stm32f4/pins_MKS_SKIPR_V1_0.h"      // STM32F4                                env:mks_skipr_v1 env:mks_skipr_v1_nobootloader
714
+#elif MB(TRONXY_V10)
715
+  #include "stm32f4/pins_TRONXY_V10.h"          // STM32F4                                env:STM32F446_tronxy
714 716
 
715 717
 //
716 718
 // ARM Cortex M7

+ 4
- 0
Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h View File

@@ -24,6 +24,10 @@
24 24
 #define ALLOW_STM32DUINO
25 25
 #include "env_validate.h"
26 26
 
27
+#if HOTENDS > 1 || E_STEPPERS > 1
28
+  #error "TH3D EZBoard only supports 1 hotend / E stepper."
29
+#endif
30
+
27 31
 #define BOARD_INFO_NAME   "TH3D EZBoard V2"
28 32
 #define BOARD_WEBSITE_URL "th3dstudio.com"
29 33
 

+ 266
- 0
Marlin/src/pins/stm32f4/pins_TRONXY_V10.h View File

@@ -0,0 +1,266 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include "env_validate.h"
25
+
26
+#if HOTENDS > 3 || E_STEPPERS > 3
27
+  #error "Tronxy V10 supports up to 3 hotends / E steppers."
28
+#endif
29
+
30
+#define BOARD_INFO_NAME      "Tronxy V10"
31
+#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
32
+
33
+#define STEP_TIMER                             6
34
+#define TEMP_TIMER                            14
35
+
36
+//
37
+// Servos
38
+//
39
+//#define SERVO0_PIN                        PB10
40
+
41
+//
42
+// EEPROM
43
+//
44
+#if NO_EEPROM_SELECTED
45
+  #undef NO_EEPROM_SELECTED
46
+  #if TRONXY_UI > 0
47
+    #define EEPROM_AT24CXX
48
+  #else
49
+    #define FLASH_EEPROM_EMULATION
50
+  #endif
51
+#endif
52
+
53
+#if ENABLED(FLASH_EEPROM_EMULATION)
54
+  // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
55
+  #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
56
+  #define EEPROM_PAGE_SIZE     (0x800U)           // 2KB, but will use 2x more (4KB)
57
+  #define MARLIN_EEPROM_SIZE    EEPROM_PAGE_SIZE
58
+#else
59
+  #if ENABLED(EEPROM_AT24CXX)
60
+    #define AT24CXX_SCL                     PB8
61
+    #define AT24CXX_SDA                     PB9
62
+    #define AT24CXX_WP                      PB7
63
+  #else
64
+    #define I2C_EEPROM                            // AT24C32
65
+  #endif
66
+  #define MARLIN_EEPROM_SIZE              0x1000  // 4K
67
+#endif
68
+
69
+//
70
+// SPI Flash
71
+//
72
+//#define SPI_FLASH
73
+#if ENABLED(SPI_FLASH)
74
+  #define SPI_FLASH_SIZE                0x200000  // 2MB
75
+  #define W25QXX_CS_PIN                     PG15  // SPI2
76
+  #define W25QXX_MOSI_PIN                   PB5
77
+  #define W25QXX_MISO_PIN                   PB4
78
+  #define W25QXX_SCK_PIN                    PB3
79
+#endif
80
+
81
+//
82
+// Limit Switches
83
+//
84
+#define X_MIN_PIN                           PC15
85
+#define X_MAX_PIN                           PB0
86
+#define Y_STOP_PIN                          PC14
87
+
88
+#ifndef Z_MIN_PROBE_PIN
89
+  #define Z_MIN_PROBE_PIN                   PE3
90
+#endif
91
+
92
+#if ENABLED(DUAL_Z_ENDSTOP_PROBE)
93
+  #if NUM_Z_STEPPERS > 1 && Z_HOME_TO_MAX         // Swap Z1/Z2 for dual Z with max homing
94
+    #define Z_MIN_PIN                       PF11
95
+    #define Z_MAX_PIN                       PC13
96
+  #else
97
+    #define Z_MIN_PIN                       PC13
98
+    #define Z_MAX_PIN                       PF11
99
+  #endif
100
+#else
101
+  #ifndef Z_STOP_PIN
102
+    #define Z_STOP_PIN                      PC13
103
+  #endif
104
+#endif
105
+//
106
+// Filament Sensors
107
+//
108
+#ifndef FIL_RUNOUT_PIN
109
+  #define FIL_RUNOUT_PIN                    PE6   // MT_DET
110
+#endif
111
+#ifndef FIL_RUNOUT2_PIN
112
+  #define FIL_RUNOUT2_PIN                   PF12
113
+#endif
114
+
115
+//
116
+// Steppers
117
+//
118
+#define X_ENABLE_PIN                        PF0
119
+#define X_STEP_PIN                          PE5
120
+#define X_DIR_PIN                           PF1
121
+
122
+#define Y_ENABLE_PIN                        PF5
123
+#define Y_STEP_PIN                          PF9
124
+#define Y_DIR_PIN                           PF3
125
+
126
+#define Z_ENABLE_PIN                        PA5
127
+#define Z_STEP_PIN                          PA6
128
+#define Z_DIR_PIN                           PF15
129
+
130
+#define E0_ENABLE_PIN                       PF14
131
+#define E0_STEP_PIN                         PB1
132
+#define E0_DIR_PIN                          PF13
133
+
134
+#define E1_ENABLE_PIN                       PG5
135
+#define E1_STEP_PIN                         PD12
136
+#define E1_DIR_PIN                          PG4
137
+
138
+#define E2_ENABLE_PIN                       PF7
139
+#define E2_STEP_PIN                         PF6
140
+#define E2_DIR_PIN                          PF4
141
+
142
+//
143
+// Temperature Sensors
144
+//
145
+#define TEMP_0_PIN                          PC3   // TH1
146
+#define TEMP_BED_PIN                        PC2   // TB1
147
+
148
+//
149
+// Heaters / Fans
150
+//
151
+#define HEATER_0_PIN                        PG7   // HEATER1
152
+#define HEATER_BED_PIN                      PE2   // HOT BED
153
+//#define HEATER_BED_INVERTING              true
154
+
155
+#define FAN_PIN                             PG0   // FAN0
156
+#define FAN1_PIN                            PB6   // FAN1
157
+#define FAN2_PIN                            PG9   // FAN2
158
+#define FAN3_PIN                            PF10  // FAN3
159
+#define CONTROLLER_FAN_PIN                  PD7   // BOARD FAN
160
+#define FAN_SOFT_PWM
161
+
162
+//
163
+// Laser / Spindle
164
+//
165
+#if HAS_CUTTER
166
+  #define SPINDLE_LASER_ENA_PIN             PB11  // wifi:TX
167
+  #if ENABLED(SPINDLE_LASER_USE_PWM)
168
+    #define SPINDLE_LASER_PWM_PIN           PB10  // wifi:RX-TIM2_CH3
169
+    // The PWM pin definition const PinMap PinMap_PWM[] in PeripheralPins.c must be compounded here
170
+    // See PWM_PIN(x) definition for details
171
+  #endif
172
+#endif
173
+
174
+//
175
+// Misc
176
+//
177
+#define BEEPER_PIN                          PA8
178
+
179
+//#define LED_PIN                           PG10
180
+#define PS_ON_PIN                           PG10  // Temporarily switch the machine with LED simulation
181
+
182
+#if ENABLED(TRONXY_BACKUP_POWER)
183
+  #define POWER_LOSS_PIN                    PF11  // Configure as drop-down input
184
+#else
185
+  #define POWER_LOSS_PIN                    PE1   // Output of LM393 comparator, configured as pullup
186
+#endif
187
+//#define POWER_LM393_PIN                   PE0   // +V for the LM393 comparator, configured as output high
188
+
189
+#if ENABLED(TFT_TRONXY_X5SA)
190
+  #error "TFT_TRONXY_X5SA is not yet supported."
191
+#endif
192
+
193
+#if 0
194
+
195
+//
196
+// TFT with FSMC interface
197
+//
198
+#if HAS_FSMC_TFT
199
+  #define TFT_RESET_PIN                     PB12
200
+  #define TFT_BACKLIGHT_PIN                 PG8
201
+
202
+  #define LCD_USE_DMA_FSMC                        // Use DMA transfers to send data to the TFT
203
+  #define FSMC_DMA_DEV                      DMA2
204
+  #define FSMC_DMA_CHANNEL               DMA_CH5
205
+
206
+  #define TFT_CS_PIN                        PG12
207
+  #define TFT_RS_PIN                        PG2
208
+
209
+  //#define TFT_WIDTH                        480
210
+  //#define TFT_HEIGHT                       320
211
+  //#define TFT_PIXEL_OFFSET_X                48
212
+  //#define TFT_PIXEL_OFFSET_Y                32
213
+  //#define TFT_DRIVER                   ILI9488
214
+  //#define TFT_BUFFER_SIZE                14400
215
+
216
+  #if NEED_TOUCH_PINS
217
+    #define TOUCH_CS_PIN                    PD11  // SPI1_NSS
218
+    #define TOUCH_SCK_PIN                   PB13  // SPI1_SCK
219
+    #define TOUCH_MISO_PIN                  PB14  // SPI1_MISO
220
+    #define TOUCH_MOSI_PIN                  PB15  // SPI1_MOSI
221
+  #endif
222
+
223
+  #if (LCD_CHIP_INDEX == 1 && (TRONXY_UI == 1 || TRONXY_UI == 2)) || LCD_CHIP_INDEX == 3
224
+    #define TOUCH_CALIBRATION_X           -17181
225
+    #define TOUCH_CALIBRATION_Y            11434
226
+    #define TOUCH_OFFSET_X                   501
227
+    #define TOUCH_OFFSET_Y                    -9
228
+  #elif LCD_CHIP_INDEX == 1 && TRONXY_UI == 4
229
+    #define TOUCH_CALIBRATION_X            11166
230
+    #define TOUCH_CALIBRATION_Y            17162
231
+    #define TOUCH_OFFSET_X                   -10
232
+    #define TOUCH_OFFSET_Y                   -16
233
+  #elif LCD_CHIP_INDEX == 4 && TRONXY_UI == 3
234
+    //#define TOUCH_CALIBRATION_X           8781
235
+    //#define TOUCH_CALIBRATION_Y          11773
236
+    //#define TOUCH_OFFSET_X                 -17
237
+    //#define TOUCH_OFFSET_Y                 -16
238
+    // Upside-down
239
+    #define TOUCH_CALIBRATION_X            -8553
240
+    #define TOUCH_CALIBRATION_Y           -11667
241
+    #define TOUCH_OFFSET_X                   253
242
+    #define TOUCH_OFFSET_Y                   331
243
+  #elif LCD_CHIP_INDEX == 2
244
+    #define TOUCH_CALIBRATION_X            17184
245
+    #define TOUCH_CALIBRATION_Y            10604
246
+    #define TOUCH_OFFSET_X                   -31
247
+    #define TOUCH_OFFSET_Y                   -29
248
+  #endif
249
+#endif
250
+
251
+#endif
252
+
253
+//
254
+// SD Card
255
+//
256
+#define SDIO_SUPPORT
257
+#define SD_DETECT_PIN                       -1    // PF0, but not connected
258
+#define SDIO_CLOCK                       4500000
259
+#define SDIO_READ_RETRIES                     16
260
+
261
+#define SDIO_D0_PIN                         PC8
262
+#define SDIO_D1_PIN                         PC9
263
+#define SDIO_D2_PIN                         PC10
264
+#define SDIO_D3_PIN                         PC11
265
+#define SDIO_CK_PIN                         PC12
266
+#define SDIO_CMD_PIN                        PD2

+ 35
- 0
buildroot/share/PlatformIO/boards/marlin_STM32F446ZET_tronxy.json View File

@@ -0,0 +1,35 @@
1
+{
2
+  "build": {
3
+    "cpu": "cortex-m4",
4
+    "extra_flags": "-DSTM32F446xx",
5
+    "f_cpu": "180000000L",
6
+    "mcu": "stm32f446zet6",
7
+    "variant": "MARLIN_F446Zx_TRONXY"
8
+  },
9
+  "connectivity": [
10
+    "can"
11
+  ],
12
+  "debug": {
13
+    "jlink_device": "STM32F446ZE",
14
+    "openocd_target": "stm32f4x",
15
+    "svd_path": "STM32F446x.svd"
16
+  },
17
+  "frameworks": [
18
+    "arduino",
19
+    "stm32cube"
20
+  ],
21
+  "name": "STM32F446ZE (128k RAM. 512k Flash)",
22
+  "upload": {
23
+    "maximum_ram_size": 131072,
24
+    "maximum_size": 524288,
25
+    "protocol": "stlink",
26
+    "protocols": [
27
+      "jlink",
28
+      "stlink",
29
+      "blackmagic",
30
+      "serial"
31
+    ]
32
+  },
33
+  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html",
34
+  "vendor": "Generic"
35
+}

+ 359
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PeripheralPins.c View File

@@ -0,0 +1,359 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2016, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ *    this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ *    this list of conditions and the following disclaimer in the documentation
13
+ *    and/or other materials provided with the distribution.
14
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
15
+ *    may be used to endorse or promote products derived from this software
16
+ *    without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *******************************************************************************
29
+ */
30
+#include "Arduino.h"
31
+#include "PeripheralPins.h"
32
+
33
+// =====
34
+// Note: Commented lines are alternative possibilities which are not used per default.
35
+//       If you change them, you will have to know what you do
36
+// =====
37
+
38
+
39
+//*** ADC ***
40
+
41
+#ifdef HAL_ADC_MODULE_ENABLED
42
+const PinMap PinMap_ADC[] = {
43
+  //  {PA_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
44
+  //  {PA_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0
45
+  //  {PA_0,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_IN0
46
+  //  {PA_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
47
+  //  {PA_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1
48
+  //  {PA_1,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_IN1
49
+  //  {PA_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
50
+  //  {PA_2,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2
51
+  //  {PA_2,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_IN2
52
+  {PA_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
53
+  //  {PA_3,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3
54
+  //  {PA_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_IN3
55
+  {PA_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
56
+  //  {PA_4,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4
57
+  //  {PA_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
58
+  //  {PA_5,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5
59
+  //  {PA_6,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
60
+  //  {PA_6,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6
61
+  //  {PA_7,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
62
+  //  {PA_7,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7
63
+  //  {PB_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
64
+  //  {PB_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8
65
+  //  {PB_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
66
+  //  {PB_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9
67
+  {PC_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
68
+  //  {PC_0,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_IN10
69
+  //  {PC_0,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_IN10
70
+  {PC_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
71
+  //  {PC_1,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_IN11
72
+  //  {PC_1,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_IN11
73
+  {PC_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
74
+  //  {PC_2,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC2_IN12
75
+  //  {PC_2,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC3_IN12
76
+  {PC_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
77
+  //  {PC_3,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC2_IN13
78
+  //  {PC_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC3_IN13
79
+  {PC_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
80
+  //  {PC_4,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_IN14
81
+  //  {PC_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
82
+  //  {PC_5,  ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_IN15
83
+  {NC,    NP,    0}
84
+};
85
+#endif
86
+
87
+//*** DAC ***
88
+
89
+#ifdef HAL_DAC_MODULE_ENABLED
90
+const PinMap PinMap_DAC[] = {
91
+  //  {PA_4,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1
92
+  //  {PA_5,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 - LD2
93
+  {NC,   NP,    0}
94
+};
95
+#endif
96
+
97
+//*** I2C ***
98
+
99
+#ifdef HAL_I2C_MODULE_ENABLED
100
+const PinMap PinMap_I2C_SDA[] = {
101
+  //  {PB_3,  I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
102
+  //  {PB_4,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
103
+  //  {PB_7,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
104
+  {PB_9,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
105
+  //  {PC_7,  FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)},
106
+  //  {PC_9,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
107
+  //  {PC_12, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
108
+  {NC,    NP,    0}
109
+};
110
+#endif
111
+
112
+#ifdef HAL_I2C_MODULE_ENABLED
113
+const PinMap PinMap_I2C_SCL[] = {
114
+  //  {PA_8,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
115
+  //  {PB_6,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
116
+  {PB_8,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
117
+  //  {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
118
+  //  {PC_6,  FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)},
119
+  {NC,    NP,    0}
120
+};
121
+#endif
122
+
123
+//*** PWM ***
124
+
125
+#ifdef HAL_TIM_MODULE_ENABLED
126
+const PinMap PinMap_PWM[] = {
127
+  {PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)},  // TIM2_CH1
128
+  //  {PA_0,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)},  // TIM5_CH1
129
+  //  {PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)},  // TIM2_CH2
130
+  {PA_1,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)},  // TIM5_CH2
131
+  //  {PA_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)},  // TIM2_CH3 - STLink Tx
132
+  //  {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)},  // TIM5_CH3 - STLink Tx
133
+  //  {PA_2,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)},  // TIM9_CH1 - STLink Tx
134
+  //  {PA_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)},  // TIM2_CH4 - STLink Rx
135
+  //  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)},  // TIM5_CH4 - STLink Rx
136
+  //  {PA_3,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)},  // TIM9_CH2 - STLink Rx
137
+  {PA_5,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)},  // TIM2_CH1
138
+  //  {PA_5,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)},  // TIM8_CH1N
139
+  {PA_6,  TIM13,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)},  // TIM13_CH1
140
+  //  {PA_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)},  // TIM3_CH1
141
+  //{PA_7,  TIM14,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)},  // TIM14_CH1
142
+  //  {PA_7,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)},  // TIM1_CH1N
143
+  //  {PA_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)},  // TIM3_CH2
144
+  //  {PA_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)},  // TIM8_CH1N
145
+  //  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)},  // TIM1_CH1
146
+  {PA_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)},  // TIM1_CH2
147
+  {PA_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)},  // TIM1_CH3
148
+  {PA_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)},  // TIM1_CH4
149
+  {PA_15, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)},  // TIM2_CH1
150
+  //  {PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)},  // TIM1_CH2N
151
+  //  {PB_0,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)},  // TIM3_CH3
152
+  {PB_0,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)},  // Fan0, TIM8_CH2N
153
+  //  {PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)},  // TIM1_CH3N
154
+  //  {PB_1,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)},  // TIM3_CH4
155
+  {PB_1,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)},  // Fan1, TIM8_CH3N
156
+  {PB_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)},  // Fan2, TIM2_CH4
157
+  {PB_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)},  // E0 Heater, TIM2_CH2
158
+  {PB_4,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)},  // E1 Heater, TIM3_CH1
159
+  {PB_5,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)},  // LED G, TIM3_CH2
160
+  {PB_6,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)},  // LED R, TIM4_CH1
161
+  {PB_7,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)},  // LED B, TIM4_CH2
162
+  //  {PB_8,  TIM10,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)},  // TIM10_CH1
163
+  //  {PB_8,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)},  // TIM2_CH1
164
+  {PB_8,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)},  // TIM4_CH3
165
+  {PB_9,  TIM11,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)},  // TIM11_CH1
166
+  //  {PB_9,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)},  // TIM2_CH2
167
+  //  {PB_9,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)},  // TIM4_CH4
168
+  {PB_10, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)},  // TIM2_CH3
169
+  {PB_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)},  // TIM1_CH1N
170
+  {PB_14, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)},  // TIM12_CH1
171
+  //  {PB_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)},  // TIM1_CH2N
172
+  //  {PB_14, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)},  // TIM8_CH2N
173
+  {PB_15, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)},  // TIM12_CH2
174
+  //  {PB_15, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)},  // TIM1_CH3N
175
+  //  {PB_15, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)},  // TIM8_CH3N
176
+  {PC_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)},  // TIM3_CH1
177
+  //  {PC_6,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)},  // TIM8_CH1
178
+  //  {PC_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)},  // TIM3_CH2
179
+  {PC_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)},  // TIM8_CH2
180
+  {PC_8,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)},  // TIM3_CH3
181
+  //  {PC_8,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)},  // TIM8_CH3
182
+  //  {PC_9,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)},  // TIM3_CH4
183
+  {PC_9,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)},  // TIM8_CH4
184
+  {PD_15, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)},  // TIM4_CH4
185
+  {PE_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)},  // TIM1_CH1
186
+  {PE_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)},  // TIM1_CH2N
187
+  {NC,    NP,    0}
188
+};
189
+#endif
190
+
191
+//*** SERIAL ***
192
+
193
+#ifdef HAL_UART_MODULE_ENABLED
194
+const PinMap PinMap_UART_TX[] = {
195
+  //  {PA_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
196
+  //  {PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
197
+  {PA_9,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
198
+  //  {PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
199
+  //  {PB_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
200
+  //  {PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
201
+  //  {PC_10, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
202
+  {PC_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
203
+  //  {PC_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
204
+  {NC,    NP,    0}
205
+};
206
+#endif
207
+
208
+#ifdef HAL_UART_MODULE_ENABLED
209
+const PinMap PinMap_UART_RX[] = {
210
+  //  {PA_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
211
+  //  {PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
212
+  {PA_10, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
213
+  //  {PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
214
+  //  {PC_5,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
215
+  //  {PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
216
+  //  {PC_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
217
+  {PC_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
218
+  //  {PD_2,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
219
+  {NC,    NP,    0}
220
+};
221
+#endif
222
+
223
+#ifdef HAL_UART_MODULE_ENABLED
224
+const PinMap PinMap_UART_RTS[] = {
225
+  //  {PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
226
+  //  {PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
227
+  //  {PA_15, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
228
+  //  {PB_14, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
229
+  //  {PC_8,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
230
+  {NC,    NP,    0}
231
+};
232
+#endif
233
+
234
+#ifdef HAL_UART_MODULE_ENABLED
235
+const PinMap PinMap_UART_CTS[] = {
236
+  //  {PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
237
+  //  {PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
238
+  //  {PB_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
239
+  //  {PB_13, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
240
+  //  {PC_9,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)},
241
+  {NC,    NP,    0}
242
+};
243
+#endif
244
+
245
+//*** SPI ***
246
+
247
+#ifdef HAL_SPI_MODULE_ENABLED
248
+const PinMap PinMap_SPI_MOSI[] = {
249
+  {PA_7,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
250
+  //  {PB_0,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)},
251
+  //  {PB_2,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)},
252
+  //  {PB_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
253
+  //  {PB_5,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
254
+  //  {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
255
+  //  {PC_1,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)},
256
+  //  {PC_1,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)},
257
+  //  {PC_3,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
258
+  //  {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
259
+  {NC,    NP,    0}
260
+};
261
+#endif
262
+
263
+#ifdef HAL_SPI_MODULE_ENABLED
264
+const PinMap PinMap_SPI_MISO[] = {
265
+  {PA_6,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
266
+  //  {PB_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
267
+  //  {PB_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
268
+  //  {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
269
+  //  {PC_2,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
270
+  //  {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
271
+  {NC,    NP,    0}
272
+};
273
+#endif
274
+
275
+#ifdef HAL_SPI_MODULE_ENABLED
276
+const PinMap PinMap_SPI_SCLK[] = {
277
+  {PA_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
278
+  //  {PA_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
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_7,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
284
+  //  {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
285
+  {NC,    NP,    0}
286
+};
287
+#endif
288
+
289
+#ifdef HAL_SPI_MODULE_ENABLED
290
+const PinMap PinMap_SPI_SSEL[] = {
291
+  {PA_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
292
+  //  {PA_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
293
+  //  {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
294
+  //  {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
295
+  //  {PB_4,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)},
296
+  //  {PB_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
297
+  //  {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
298
+  {NC,    NP,    0}
299
+};
300
+#endif
301
+
302
+//*** CAN ***
303
+
304
+#ifdef HAL_CAN_MODULE_ENABLED
305
+const PinMap PinMap_CAN_RD[] = {
306
+  //  {PA_11, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
307
+  //  {PB_5,  CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
308
+  //  {PB_8,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
309
+  //  {PB_12, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
310
+  {NC,    NP,    0}
311
+};
312
+#endif
313
+
314
+#ifdef HAL_CAN_MODULE_ENABLED
315
+const PinMap PinMap_CAN_TD[] = {
316
+  //  {PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
317
+  //  {PB_6,  CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
318
+  //  {PB_9,  CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
319
+  //  {PB_13, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
320
+  {NC,    NP,    0}
321
+};
322
+#endif
323
+
324
+//*** ETHERNET ***
325
+
326
+//*** No Ethernet ***
327
+
328
+//*** QUADSPI ***
329
+
330
+#ifdef HAL_QSPI_MODULE_ENABLED
331
+const PinMap PinMap_QUADSPI[] = {
332
+  //  {PA_1,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)},  // QUADSPI_BK1_IO3
333
+  //  {PB_2,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)},  // QUADSPI_CLK
334
+  //  {PB_6,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QSPI)},  // QUADSPI_BK1_NCS
335
+  //  {PC_9,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)},  // QUADSPI_BK1_IO0
336
+  //  {PC_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)},  // QUADSPI_BK1_IO1
337
+  //  {PC_11, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)},  // QUADSPI_BK2_NCS
338
+  {NC,    NP,    0}
339
+};
340
+#endif
341
+
342
+//*** USB ***
343
+
344
+#ifdef HAL_PCD_MODULE_ENABLED
345
+const PinMap PinMap_USB_OTG_FS[] = {
346
+  //  {PA_8,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
347
+  //  {PA_9,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)}, // USB_OTG_FS_VBUS
348
+  //  {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
349
+  {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
350
+  {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP
351
+  {NC,    NP,    0}
352
+};
353
+#endif
354
+
355
+#ifdef HAL_PCD_MODULE_ENABLED
356
+const PinMap PinMap_USB_OTG_HS[] = {
357
+  {NC,    NP,    0}
358
+};
359
+#endif

+ 30
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PinNamesVar.h View File

@@ -0,0 +1,30 @@
1
+/* SYS_WKUP */
2
+#ifdef PWR_WAKEUP_PIN1
3
+  SYS_WKUP1 = PA_0, /* SYS_WKUP0 */
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_DM = PA_11,
29
+  USB_OTG_FS_DP = PA_12,
30
+#endif

+ 505
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h View File

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

+ 188
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/ldscript.ld View File

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

+ 322
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp View File

@@ -0,0 +1,322 @@
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
+// Pin number
26
+const PinName digitalPin[] = {
27
+  PA_0,  //D0
28
+  PA_1,  //D1
29
+  PA_2,  //D2
30
+  PA_3,  //D3
31
+  PA_4,  //D4
32
+  PA_5,  //D5
33
+  PA_6,  //D6
34
+  PA_7,  //D7
35
+  PA_8,  //D8
36
+  PA_9,  //D9
37
+  PA_10, //D10
38
+  PA_11, //D11
39
+  PA_12, //D12
40
+  PA_13, //D13
41
+  PA_14, //D14
42
+  PA_15, //D15
43
+  PB_0,  //D16
44
+  PB_1,  //D17
45
+  PB_2,  //D18
46
+  PB_3,  //D19
47
+  PB_4,  //D20
48
+  PB_5,  //D21
49
+  PB_6,  //D22
50
+  PB_7,  //D23
51
+  PB_8,  //D24
52
+  PB_9,  //D25
53
+  PB_10, //D26
54
+  PB_11, //D27
55
+  PB_12, //D28
56
+  PB_13, //D29
57
+  PB_14, //D30
58
+  PB_15, //D31
59
+  PC_0,  //D32
60
+  PC_1,  //D33
61
+  PC_2,  //D34
62
+  PC_3,  //D35
63
+  PC_4,  //D36
64
+  PC_5,  //D37
65
+  PC_6,  //D38
66
+  PC_7,  //D39
67
+  PC_8,  //D40
68
+  PC_9,  //D41
69
+  PC_10, //D42
70
+  PC_11, //D43
71
+  PC_12, //D44
72
+  PC_13, //D45
73
+  PC_14, //D46
74
+  PC_15, //D47
75
+  PD_0,  //D48
76
+  PD_1,  //D49
77
+  PD_2,  //D50
78
+  PD_3,  //D51
79
+  PD_4,  //D52
80
+  PD_5,  //D53
81
+  PD_6,  //D54
82
+  PD_7,  //D55
83
+  PD_8,  //D56
84
+  PD_9,  //D57
85
+  PD_10, //D58
86
+  PD_11, //D59
87
+  PD_12, //D60
88
+  PD_13, //D61
89
+  PD_14, //D62
90
+  PD_15, //D63
91
+  PE_0,  //D64
92
+  PE_1,  //D65
93
+  PE_2,  //D66
94
+  PE_3,  //D67
95
+  PE_4,  //D68
96
+  PE_5,  //D69
97
+  PE_6,  //D70
98
+  PE_7,  //D71
99
+  PE_8,  //D72
100
+  PE_9,  //D73
101
+  PE_10, //D74
102
+  PE_11, //D75
103
+  PE_12, //D76
104
+  PE_13, //D77
105
+  PE_14, //D78
106
+  PE_15, //D79
107
+  PF_0,  //D80
108
+  PF_1,  //D81
109
+  PF_2,  //D82
110
+  PF_3,  //D83
111
+  PF_4,  //D84
112
+  PF_5,  //D85
113
+  PF_6,  //D86
114
+  PF_7,  //D87
115
+  PF_8,  //D88
116
+  PF_9,  //D89
117
+  PF_10, //D90
118
+  PF_11, //D91
119
+  PF_12, //D92
120
+  PF_13, //D93
121
+  PF_14, //D94
122
+  PF_15, //D95
123
+  PG_0,  //D96
124
+  PG_1,  //D97
125
+  PG_2,  //D98
126
+  PG_3,  //D99
127
+  PG_4,  //D100
128
+  PG_5,  //D101
129
+  PG_6,  //D102
130
+  PG_7,  //D103
131
+  PG_8,  //D104
132
+  PG_9,  //D105
133
+  PG_10, //D106
134
+  PG_11, //D107
135
+  PG_12, //D108
136
+  PG_13, //D109
137
+  PG_14, //D110
138
+  PG_15, //D111
139
+  PH_0,  //D112
140
+  PH_1,  //D113
141
+  PH_2,  //D114
142
+  PH_3,  //D115
143
+  PH_4,  //D116
144
+  PH_5,  //D117
145
+  PH_6,  //D118
146
+  PH_7,  //D119
147
+  PH_8,  //D120
148
+  PH_9,  //D121
149
+  PH_10, //D122
150
+  PH_11, //D123
151
+  PH_12, //D124
152
+  PH_13, //D125
153
+  PH_14, //D126
154
+  PH_15, //D127
155
+
156
+  //Duplicated ADC Pins
157
+  PC_3,  //A0 T0 D128
158
+  PC_0,  //A1 T1 D129
159
+  PC_2,  //A2 BED D130
160
+};
161
+
162
+#ifdef __cplusplus
163
+}
164
+#endif
165
+
166
+// ----------------------------------------------------------------------------
167
+
168
+#ifdef __cplusplus
169
+extern "C" {
170
+#endif
171
+
172
+uint32_t myvar[] = {1,2,3,4,5,6,7,8};
173
+void myshow(int fre,int times)//YSZ-WORK
174
+{
175
+  uint32_t index = 10;
176
+  RCC->AHB1ENR |= 1 << 6;//端口G时钟
177
+  GPIOG->MODER &= ~(3UL << 2 * index);//清除旧模式
178
+  GPIOG->MODER |= 1 << 2 * index;//模式为输出
179
+  GPIOG->OSPEEDR &= ~(3UL << 2 * index); //清除旧输出速度
180
+  GPIOG->OSPEEDR |= 2 << 2 * index;//设置输出速度
181
+  GPIOG->OTYPER &= ~(1UL << index);//清除旧输出方式
182
+  GPIOG->OTYPER |= 0 << index;//设置输出方式为推挽
183
+  GPIOG->PUPDR &= ~(3 << 2 * index);//先清除原来的设置
184
+  GPIOG->PUPDR |= 1 << 2 * index;//设置新的上下拉
185
+  while(times != 0) {
186
+    GPIOG->BSRR = 1UL << index;
187
+    for(int i = 0;i < fre; i++)
188
+    for(int j = 0; j < 1000000; j++)__NOP();
189
+    GPIOG->BSRR = 1UL << (index + 16);
190
+    for(int i = 0;i < fre; i++)
191
+    for(int j = 0; j < 1000000; j++)__NOP();
192
+    if(times > 0)times--;
193
+  }
194
+}
195
+
196
+HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA)
197
+{
198
+  HAL_SD_CardStateTypeDef CardState;
199
+  volatile uint32_t respR1 = 0, status = 0; 
200
+  SDIO_CmdInitTypeDef  sdmmc_cmdinit;
201
+  do {
202
+    sdmmc_cmdinit.Argument         = RCA << 16;
203
+    sdmmc_cmdinit.CmdIndex         = SDMMC_CMD_SEND_STATUS;
204
+    sdmmc_cmdinit.Response         = SDIO_RESPONSE_SHORT;
205
+    sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO;
206
+    sdmmc_cmdinit.CPSM             = SDIO_CPSM_ENABLE;
207
+    SDIO_SendCommand(SDIOx,&sdmmc_cmdinit);//发送CMD13  
208
+    do status = SDIOx->STA;
209
+    while(!(status & ((1 << 0) | (1 << 6) | (1 << 2))));//等待操作完成
210
+    if(status & (1 << 0)) //CRC检测失败
211
+    {
212
+      SDIOx->ICR |= 1 << 0;		//清除错误标记
213
+      return HAL_ERROR;
214
+    }
215
+    if(status & (1 << 2)) //命令超时 
216
+    {
217
+      SDIOx->ICR |= 1 << 2; //清除错误标记
218
+      return HAL_ERROR;
219
+    }
220
+    if(SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS)return HAL_ERROR;
221
+    SDIOx->ICR = 0X5FF;	 		//清除所有标记
222
+    respR1 = SDIOx->RESP1;
223
+    CardState = (respR1 >> 9) & 0x0000000F;
224
+  }while((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING));
225
+  return HAL_OK;
226
+}
227
+void debugStr(const char*str) {
228
+	while(*str) {
229
+		while((USART1->SR & 0x40) == 0); 
230
+		USART1->DR = *str++;
231
+	}
232
+}
233
+/**
234
+  * @brief  System Clock Configuration
235
+  *         The system Clock is configured as follow :
236
+  *            System Clock source            = PLL (HSE)
237
+  *            SYSCLK(Hz)                     = 168000000/120000000/180000000
238
+  *            HCLK(Hz)                       = 168000000/120000000/180000000
239
+  *            AHB Prescaler                  = 1
240
+  *            APB1 Prescaler                 = 4
241
+  *            APB2 Prescaler                 = 2
242
+  *            HSE Frequency(Hz)              = 8000000
243
+  *            PLL_M                          = 8/4/8
244
+  *            PLL_N                          = 336/120/360
245
+  *            PLL_P                          = 2
246
+  *            PLL_Q                          = 7/5/7
247
+  *            VDD(V)                         = 3.3
248
+  *            Main regulator output voltage  = Scale1 mode
249
+  *            Flash Latency(WS)              = 5
250
+  * @param  None
251
+  * @retval None
252
+  */
253
+WEAK void SystemClock_Config(void)
254
+{
255
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
256
+  RCC_OscInitTypeDef RCC_OscInitStruct;
257
+  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
258
+  HAL_StatusTypeDef ret = HAL_OK;
259
+
260
+  __HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
261
+  __HAL_FLASH_DATA_CACHE_ENABLE();
262
+  __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
263
+  HAL_RCC_DeInit();
264
+
265
+  /* Enable Power Control clock */
266
+  __HAL_RCC_PWR_CLK_ENABLE();
267
+
268
+  /* The voltage scaling allows optimizing the power consumption when the device is 
269
+     clocked below the maximum system frequency, to update the voltage scaling value 
270
+     regarding system frequency refer to product datasheet.  */
271
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
272
+
273
+  /* Enable HSE Oscillator and activate PLL with HSE as source */
274
+  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
275
+  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
276
+  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
277
+  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
278
+  RCC_OscInitStruct.PLL.PLLM = 8;
279
+  RCC_OscInitStruct.PLL.PLLN = 336;
280
+  RCC_OscInitStruct.PLL.PLLP = 2;
281
+  RCC_OscInitStruct.PLL.PLLQ = 7;
282
+  RCC_OscInitStruct.PLL.PLLR = 2;
283
+  ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
284
+  
285
+  if(ret != HAL_OK)myshow(10,-1);
286
+  HAL_PWREx_EnableOverDrive();
287
+ 
288
+  /* Select PLLSAI output as USB clock source */
289
+  PeriphClkInitStruct.PLLSAI.PLLSAIM = 8;
290
+  PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
291
+  PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
292
+  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO;
293
+  PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP;
294
+  PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;//SDIO Clock Mux
295
+  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
296
+
297
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 
298
+     clocks dividers */
299
+  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
300
+  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
301
+  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
302
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;  
303
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;  
304
+  ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
305
+  if(ret != HAL_OK)myshow(10,-1);
306
+
307
+  SystemCoreClockUpdate();//更新系统时钟SystemCoreClock
308
+  /**Configure the Systick interrupt time
309
+  */
310
+  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
311
+
312
+  /**Configure the Systick
313
+  */
314
+  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
315
+
316
+  /* SysTick_IRQn interrupt configuration */
317
+  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
318
+  __enable_irq();//打开中断,因为在bootloader中关闭了,所以这里要打开
319
+}
320
+#ifdef __cplusplus
321
+}
322
+#endif

+ 242
- 0
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h View File

@@ -0,0 +1,242 @@
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
+extern unsigned long myvar[];
27
+void myshow(int fre,int times);
28
+void debugStr(const char*str);
29
+/*----------------------------------------------------------------------------
30
+ *        Pins
31
+ *----------------------------------------------------------------------------*/
32
+
33
+#define PA0  0x00
34
+#define PA1  0x01
35
+#define PA2  0x02
36
+#define PA3  0x03
37
+#define PA4  0x04
38
+#define PA5  0x05
39
+#define PA6  0x06
40
+#define PA7  0x07
41
+#define PA8  0x08
42
+#define PA9  0x09
43
+#define PA10 0x0A
44
+#define PA11 0x0B
45
+#define PA12 0x0C
46
+#define PA13 0x0D
47
+#define PA14 0x0E
48
+#define PA15 0x0F
49
+
50
+#define PB0  0x10
51
+#define PB1  0x11
52
+#define PB2  0x12
53
+#define PB3  0x13
54
+#define PB4  0x14
55
+#define PB5  0x15
56
+#define PB6  0x16
57
+#define PB7  0x17 // 36 pins (F103T)
58
+#define PB8  0x18
59
+#define PB9  0x19
60
+#define PB10 0x1A
61
+#define PB11 0x1B
62
+#define PB12 0x1C
63
+#define PB13 0x1D
64
+#define PB14 0x1E
65
+#define PB15 0x1F
66
+
67
+#define PC0  0x20
68
+#define PC1  0x21
69
+#define PC2  0x22
70
+#define PC3  0x23
71
+#define PC4  0x24
72
+#define PC5  0x25
73
+#define PC6  0x26
74
+#define PC7  0x27
75
+#define PC8  0x28
76
+#define PC9  0x29
77
+#define PC10 0x2A
78
+#define PC11 0x2B
79
+#define PC12 0x2C
80
+#define PC13 0x2D
81
+#define PC14 0x2E
82
+#define PC15 0x2F
83
+
84
+#define PD0  0x30
85
+#define PD1  0x31
86
+#define PD2  0x32 // 64 pins (F103R)
87
+#define PD3  0x33
88
+#define PD4  0x34
89
+#define PD5  0x35
90
+#define PD6  0x36
91
+#define PD7  0x37
92
+#define PD8  0x38
93
+#define PD9  0x39
94
+#define PD10 0x3A
95
+#define PD11 0x3B
96
+#define PD12 0x3C
97
+#define PD13 0x3D
98
+#define PD14 0x3E
99
+#define PD15 0x3F
100
+
101
+#define PE0  0x40
102
+#define PE1  0x41
103
+#define PE2  0x42
104
+#define PE3  0x43
105
+#define PE4  0x44
106
+#define PE5  0x45
107
+#define PE6  0x46
108
+#define PE7  0x47
109
+#define PE8  0x48
110
+#define PE9  0x49
111
+#define PE10 0x4A
112
+#define PE11 0x4B
113
+#define PE12 0x4C
114
+#define PE13 0x4D
115
+#define PE14 0x4E
116
+#define PE15 0x4F // 100 pins (F446V)
117
+
118
+#define PF0  0x50
119
+#define PF1  0x51
120
+#define PF2  0x52
121
+#define PF3  0x53
122
+#define PF4  0x54
123
+#define PF5  0x55
124
+#define PF6  0x56
125
+#define PF7  0x57
126
+#define PF8  0x58
127
+#define PF9  0x59
128
+#define PF10 0x5A
129
+#define PF11 0x5B
130
+#define PF12 0x5C
131
+#define PF13 0x5D
132
+#define PF14 0x5E
133
+#define PF15 0x5F
134
+
135
+#define PG0  0x60
136
+#define PG1  0x61
137
+#define PG2  0x62
138
+#define PG3  0x63
139
+#define PG4  0x64
140
+#define PG5  0x65
141
+#define PG6  0x66
142
+#define PG7  0x67
143
+#define PG8  0x68
144
+#define PG9  0x69
145
+#define PG10 0x6A
146
+#define PG11 0x6B
147
+#define PG12 0x6C
148
+#define PG13 0x6D
149
+#define PG14 0x6E
150
+#define PG15 0x6F
151
+
152
+#define PH0  0x70
153
+#define PH1  0x71
154
+#define PH2  0x72
155
+#define PH3  0x73
156
+#define PH4  0x74
157
+#define PH5  0x75
158
+#define PH6  0x76
159
+#define PH7  0x77
160
+#define PH8  0x78
161
+#define PH9  0x79
162
+#define PH10 0x7A
163
+#define PH11 0x7B
164
+#define PH12 0x7C
165
+#define PH13 0x7D
166
+#define PH14 0x7E
167
+#define PH15 0x7F // 144 pins (F446Z)
168
+
169
+// This must be a literal with the same value as PEND
170
+#define NUM_DIGITAL_PINS        0x80
171
+// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
172
+#define NUM_ANALOG_INPUTS       3
173
+#define NUM_ANALOG_FIRST        128
174
+
175
+// PWM resolution
176
+// #define PWM_RESOLUTION          12
177
+#define PWM_FREQUENCY           20000 // >= 20 Khz => inaudible noise for fans
178
+#define PWM_MAX_DUTY_CYCLE      255
179
+
180
+// SPI Definitions
181
+// #define PIN_SPI_SS              PG15
182
+// #define PIN_SPI_MOSI            PB5
183
+// #define PIN_SPI_MISO            PB4
184
+// #define PIN_SPI_SCK             PB3
185
+
186
+// I2C Definitions
187
+#define PIN_WIRE_SDA            PB9
188
+#define PIN_WIRE_SCL            PB8
189
+#define PIN_I2C_WP              PB7
190
+#define EEPROM_DEVICE_ADDRESS   0x50
191
+
192
+// Timer Definitions
193
+// Do not use timer used by PWM pin. See PinMap_PWM.
194
+#define TIMER_TONE              TIM8
195
+#define TIMER_SERVO             TIM5
196
+#define TIMER_SERIAL            TIM7
197
+
198
+// UART Definitions
199
+//#define SERIAL_UART_INSTANCE    1 // Connected to EXP3 header
200
+/* Enable Serial 3 */
201
+#define HAVE_HWSERIAL1
202
+// #define HAVE_HWSERIAL3
203
+
204
+// Default pin used for 'Serial' instance (ex: ST-Link)
205
+// Mandatory for Firmata
206
+#define PIN_SERIAL_RX           PA10
207
+#define PIN_SERIAL_TX           PA9
208
+
209
+/* HAL configuration */
210
+#define HSE_VALUE               8000000U
211
+
212
+#define FLASH_PAGE_SIZE         (4U * 1024U)
213
+
214
+#ifdef __cplusplus
215
+} // extern "C"
216
+#endif
217
+
218
+/*----------------------------------------------------------------------------
219
+ *        Arduino objects - C++ only
220
+ *----------------------------------------------------------------------------*/
221
+
222
+#ifdef __cplusplus
223
+// These serial port names are intended to allow libraries and architecture-neutral
224
+// sketches to automatically default to the correct port name for a particular type
225
+// of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
226
+// the first hardware serial port whose RX/TX pins are not dedicated to another use.
227
+//
228
+// SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
229
+//
230
+// SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
231
+//
232
+// SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
233
+//
234
+// SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
235
+//
236
+// SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
237
+//                            pins are NOT connected to anything by default.
238
+#define SERIAL_PORT_MONITOR     Serial
239
+#define SERIAL_PORT_HARDWARE_OPEN  Serial
240
+#endif
241
+
242
+#endif /* _VARIANT_ARDUINO_STM32_ */

+ 15
- 0
ini/stm32f4.ini View File

@@ -699,3 +699,18 @@ board_build.offset          = 0x0000
699 699
 board_upload.offset_address = 0x08000000
700 700
 upload_protocol             = dfu
701 701
 upload_command              = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE"
702
+
703
+#
704
+# STM32F446ZET6 ARM Cortex-M4
705
+#
706
+[env:STM32F446_tronxy]
707
+platform                    = ${common_stm32.platform}
708
+extends                     = stm32_variant
709
+board                       = marlin_STM32F446ZET_tronxy
710
+board_build.offset          = 0x10000
711
+board_build.rename          = fmw_tronxy.bin
712
+build_src_filter            = ${common_stm32.build_src_filter}
713
+build_flags                 = ${stm32_variant.build_flags}
714
+                              -DSTM32F4xx
715
+build_unflags               = ${stm32_variant.build_unflags} -fno-rtti
716
+                              -DUSBCON -DUSBD_USE_CDC

Loading…
Cancel
Save