Преглед изворни кода

Fix serials available on SKR Pro 1.1 (#16439)

Lino Barreca пре 4 година
родитељ
комит
07509febcd

+ 43
- 37
buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/PeripheralPins.c Прегледај датотеку

@@ -123,12 +123,18 @@ const PinMap PinMap_PWM[] = {
123 123
   {PE_6,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2    FAN2
124 124
   {PC_9,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4    EXTENSION1-4
125 125
 
126
-  //probably unused on SKR-Pro. confirmation needed, please.
126
+  /**
127
+   * Unused by specifications on SKR-Pro.
128
+   * Uncomment the corresponding line if you want to have HardwarePWM on some pins.
129
+   * WARNING: check timers' usage first to avoid conflicts.
130
+   * If you don't know what you're doing leave things as they are or you WILL break something (including hardware)
131
+   * If you alter this section DO NOT report bugs to Marlin team since they are most likely caused by you. Thank you.
132
+   */
127 133
   //{PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
128 134
   //{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 is bltouch analog?
135
+  //{PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
130 136
   //{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 is bltouch analog?
137
+  //{PA_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
132 138
   //{PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
133 139
   //{PA_2,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
134 140
   //{PA_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
@@ -198,63 +204,63 @@ const PinMap PinMap_PWM[] = {
198 204
 
199 205
 #ifdef HAL_UART_MODULE_ENABLED
200 206
 const PinMap PinMap_UART_TX[] = {
201
-  {PA_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
202
-  {PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
203 207
   {PA_9,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
204
-  {PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
205
-  {PB_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
206
-  {PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
207
-  {PC_10, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
208
-  {PC_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
209
-  {PC_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
210
-  {PD_5,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
211 208
   {PD_8,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
209
+  {PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
212 210
   #if STM32F4X_PIN_NUM >= 144  //144 pins mcu, 114 gpio
213
-    {PG_14, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
211
+    //{PG_14, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
214 212
   #endif
213
+  //{PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
214
+  //{PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
215
+  //{PD_5,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
216
+  //{PB_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
217
+  //{PC_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
218
+  //{PA_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
219
+  //{PC_10, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
220
+  //{PC_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
215 221
   {NC,    NP,    0}
216 222
 };
217 223
 
218 224
 const PinMap PinMap_UART_RX[] = {
219
-  {PA_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
220
-  {PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
221 225
   {PA_10, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
222
-  {PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
223
-  {PB_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
224
-  {PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
225
-  {PC_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
226
-  {PC_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
227
-  {PD_2,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
228
-  {PD_6,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
229 226
   {PD_9,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
227
+  {PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
228
+  //{PA_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
229
+  //{PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
230
+  //{PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
231
+  //{PB_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
232
+  //{PC_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
233
+  //{PC_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
234
+  //{PD_2,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
235
+  //{PD_6,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
230 236
   #if STM32F4X_PIN_NUM >= 144  //144 pins mcu, 114 gpio
231
-    {PG_9,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
237
+    //{PG_9,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
232 238
   #endif
233 239
   {NC,    NP,    0}
234 240
 };
235 241
 
236 242
 const PinMap PinMap_UART_RTS[] = {
237
-  {PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
238
-  {PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
239
-  {PB_14, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
240
-  {PD_4,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
241
-  {PD_12, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
243
+  //{PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
244
+  //{PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
245
+  //{PB_14, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
246
+  //{PD_4,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
247
+  //{PD_12, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
242 248
   #if STM32F4X_PIN_NUM >= 144  //144 pins mcu, 114 gpio
243
-    {PG_8,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
244
-    {PG_12, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
249
+    //{PG_8,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
250
+    //{PG_12, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
245 251
   #endif
246 252
   {NC,    NP,    0}
247 253
 };
248 254
 
249 255
 const PinMap PinMap_UART_CTS[] = {
250
-  {PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
251
-  {PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
252
-  {PB_13, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
253
-  {PD_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
254
-  {PD_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
256
+  //{PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
257
+  //{PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
258
+  //{PB_13, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
259
+  //{PD_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
260
+  //{PD_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
255 261
   #if STM32F4X_PIN_NUM >= 144  //144 pins mcu, 114 gpio
256
-    {PG_13, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
257
-    {PG_15, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
262
+    //{PG_13, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
263
+    //{PG_15, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
258 264
   #endif
259 265
   {NC,    NP,    0}
260 266
 };

+ 28
- 4
buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/variant.h Прегледај датотеку

@@ -232,6 +232,10 @@ extern "C" {
232 232
 //#define PWM_RESOLUTION          8
233 233
 //#define PWM_MAX_DUTY_CYCLE      255
234 234
 
235
+// On-board LED pin number
236
+#define LED_BUILTIN             PA7
237
+//#define LED_GREEN             LED_BUILTIN   should be defined here but omitted to avoid redefinition in SailfishRGB_LED
238
+
235 239
 // Below SPI and I2C definitions already done in the core
236 240
 // Could be redefined here if differs from the default one
237 241
 // SPI Definitions
@@ -253,8 +257,13 @@ extern "C" {
253 257
 #define TIMER_SERVO             TIM6  //TODO: advanced-control timers don't work
254 258
 
255 259
 // UART Definitions
256
-// Define here Serial instance number to map on Serial generic name
257
-#define SERIAL_UART_INSTANCE    1 //ex: 2 for Serial2 (USART2)
260
+//#define ENABLE_HWSERIAL1        done automatically by the #define SERIAL_UART_INSTANCE below
261
+#define ENABLE_HWSERIAL3
262
+#define ENABLE_HWSERIAL6
263
+
264
+// Define here Serial instance number to map on Serial generic name (if not already used by SerialUSB)
265
+#define SERIAL_UART_INSTANCE    1 //1 for Serial = Serial1 (USART1)
266
+
258 267
 // DEBUG_UART could be redefined to print on another instance than 'Serial'
259 268
 //#define DEBUG_UART              ((USART_TypeDef *) U(S)ARTX) // ex: USART3
260 269
 // DEBUG_UART baudrate, default: 9600 if not defined
@@ -267,6 +276,19 @@ extern "C" {
267 276
 #define PIN_SERIAL_RX           PA10
268 277
 #define PIN_SERIAL_TX           PA9
269 278
 
279
+// Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number
280
+// Used when user instanciate a hardware Serial using its peripheral name.
281
+// Example: HardwareSerial mySerial(USART3);
282
+// will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined.
283
+#define PIN_SERIAL1_RX          PA10
284
+#define PIN_SERIAL1_TX          PA9
285
+#define PIN_SERIAL3_RX          PD9
286
+#define PIN_SERIAL3_TX          PD8
287
+#define PIN_SERIAL6_RX          PC7
288
+#define PIN_SERIAL6_TX          PC6
289
+//#define PIN_SERIALLP1_RX        x // For LPUART1 RX
290
+//#define PIN_SERIALLP1_TX        x // For LPUART1 TX
291
+
270 292
 #ifdef __cplusplus
271 293
 } // extern "C"
272 294
 #endif
@@ -290,6 +312,8 @@ extern "C" {
290 312
 //
291 313
 // SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
292 314
 //                            pins are NOT connected to anything by default.
293
-#define SERIAL_PORT_MONITOR     Serial
294
-#define SERIAL_PORT_HARDWARE    Serial1
315
+#define SERIAL_PORT_MONITOR         Serial
316
+#define SERIAL_PORT_HARDWARE        Serial1
317
+#define SERIAL_PORT_HARDWARE_OPEN   Serial3
318
+#define SERIAL_PORT_HARDWARE_OPEN1  Serial6
295 319
 #endif

+ 7
- 11
platformio.ini Прегледај датотеку

@@ -25,10 +25,10 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
25 25
 extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
26 26
 build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants
27 27
 lib_deps =
28
+  LiquidCrystal
29
+  TMCStepper@>=0.6.1,<1.0.0
30
+  Adafruit NeoPixel
28 31
   U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
29
-  LiquidCrystal@1.3.4
30
-  TMCStepper@>=0.5.2,<1.0.0
31
-  Adafruit NeoPixel@1.2.5
32 32
   Adafruit_MAX31865=https://github.com/adafruit/Adafruit_MAX31865/archive/master.zip
33 33
   LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip
34 34
   Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip
@@ -651,19 +651,15 @@ platform_packages = framework-arduinoststm32@>=3.107,<4
651 651
 build_flags       = ${common.build_flags}
652 652
   -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\"
653 653
   -DTARGET_STM32F4 -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000
654
-  -DHAVE_HWSERIAL6
655 654
   -IMarlin/src/HAL/HAL_STM32
656 655
 build_unflags     = -std=gnu++11
657 656
 extra_scripts     = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
658
-lib_deps          =
659
-  U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
660
-  LiquidCrystal
661
-  TMCStepper@>=0.5.2,<1.0.0
662
-  Adafruit NeoPixel
663
-  LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip
664
-  Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip
665 657
 lib_ignore        = SoftwareSerial, SoftwareSerialM
666 658
 src_filter        = ${common.default_src_filter} +<src/HAL/HAL_STM32>
659
+#upload_protocol   = stlink
660
+#upload_command    = "$PROJECT_PACKAGES_DIR/tool-stm32duino/stlink/ST-LINK_CLI.exe" -c SWD -P "$BUILD_DIR/firmware.bin" 0x8008000 -Rst -Run
661
+debug_tool        = stlink
662
+debug_init_break  =
667 663
 
668 664
 #
669 665
 # BigTreeTech BTT002 (STM32F407VET6 ARM Cortex-M4)

Loading…
Откажи
Сачувај