From cbcc6ef9c4b9d0952b4ddc777bdf9d1986b5c70d Mon Sep 17 00:00:00 2001
From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date: Wed, 5 May 2021 18:11:54 -0700
Subject: [PATCH] Split up SKR V2 Rev A / B (#21805)
---
Marlin/src/core/boards.h | 33 ++++++++++---------
Marlin/src/pins/pins.h | 10 ++++--
.../pins/stm32f4/pins_BTT_SKR_V2_0_REV_A.h | 29 ++++++++++++++++
.../pins/stm32f4/pins_BTT_SKR_V2_0_REV_B.h | 26 +++++++++++++++
..._SKR_V2_0.h => pins_BTT_SKR_V2_0_common.h} | 2 --
5 files changed, 80 insertions(+), 20 deletions(-)
create mode 100644 Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_A.h
create mode 100644 Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_B.h
rename Marlin/src/pins/stm32f4/{pins_BTT_SKR_V2_0.h => pins_BTT_SKR_V2_0_common.h} (99%)
diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index 614a3b6e9e..e32789e744 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -367,22 +367,23 @@
#define BOARD_BTT_SKR_PRO_V1_2 4208 // BigTreeTech SKR Pro v1.2 (STM32F407ZGT6)
#define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VGT6)
#define BOARD_BTT_E3_RRF 4210 // BigTreeTech E3 RRF (STM32F407VGT6)
-#define BOARD_BTT_SKR_V2_0 4211 // BigTreeTech SKR v2.0 (STM32F407VGT6)
-#define BOARD_BTT_GTR_V1_0 4212 // BigTreeTech GTR v1.0 (STM32F407IGT)
-#define BOARD_LERDGE_K 4213 // Lerdge K (STM32F407ZG)
-#define BOARD_LERDGE_S 4214 // Lerdge S (STM32F407VE)
-#define BOARD_LERDGE_X 4215 // Lerdge X (STM32F407VE)
-#define BOARD_VAKE403D 4216 // VAkE 403D (STM32F446VET6)
-#define BOARD_FYSETC_S6 4217 // FYSETC S6 (STM32F446VET6)
-#define BOARD_FYSETC_S6_V2_0 4218 // FYSETC S6 v2.0 (STM32F446VET6)
-#define BOARD_FYSETC_SPIDER 4219 // FYSETC Spider (STM32F446VET6)
-#define BOARD_FLYF407ZG 4220 // FLYF407ZG (STM32F407ZG)
-#define BOARD_MKS_ROBIN2 4221 // MKS_ROBIN2 (STM32F407ZE)
-#define BOARD_MKS_ROBIN_PRO_V2 4222 // MKS Robin Pro V2 (STM32F407VE)
-#define BOARD_MKS_ROBIN_NANO_V3 4223 // MKS Robin Nano V3 (STM32F407VG)
-#define BOARD_ANET_ET4 4224 // ANET ET4 V1.x (STM32F407VGT6)
-#define BOARD_ANET_ET4P 4225 // ANET ET4P V1.x (STM32F407VGT6)
-#define BOARD_FYSETC_CHEETAH_V20 4226 // FYSETC Cheetah V2.0
+#define BOARD_BTT_SKR_V2_0_REV_A 4211 // BigTreeTech SKR v2.0 Rev A (STM32F407VGT6)
+#define BOARD_BTT_SKR_V2_0_REV_B 4212 // BigTreeTech SKR v2.0 Rev B (STM32F407VGT6)
+#define BOARD_BTT_GTR_V1_0 4213 // BigTreeTech GTR v1.0 (STM32F407IGT)
+#define BOARD_LERDGE_K 4214 // Lerdge K (STM32F407ZG)
+#define BOARD_LERDGE_S 4215 // Lerdge S (STM32F407VE)
+#define BOARD_LERDGE_X 4216 // Lerdge X (STM32F407VE)
+#define BOARD_VAKE403D 4217 // VAkE 403D (STM32F446VET6)
+#define BOARD_FYSETC_S6 4218 // FYSETC S6 (STM32F446VET6)
+#define BOARD_FYSETC_S6_V2_0 4219 // FYSETC S6 v2.0 (STM32F446VET6)
+#define BOARD_FYSETC_SPIDER 4220 // FYSETC Spider (STM32F446VET6)
+#define BOARD_FLYF407ZG 4221 // FLYF407ZG (STM32F407ZG)
+#define BOARD_MKS_ROBIN2 4222 // MKS_ROBIN2 (STM32F407ZE)
+#define BOARD_MKS_ROBIN_PRO_V2 4223 // MKS Robin Pro V2 (STM32F407VE)
+#define BOARD_MKS_ROBIN_NANO_V3 4224 // MKS Robin Nano V3 (STM32F407VG)
+#define BOARD_ANET_ET4 4225 // ANET ET4 V1.x (STM32F407VGT6)
+#define BOARD_ANET_ET4P 4226 // ANET ET4P V1.x (STM32F407VGT6)
+#define BOARD_FYSETC_CHEETAH_V20 4227 // FYSETC Cheetah V2.0
//
// ARM Cortex M7
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index adcf29e5c6..70e6836a32 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -596,8 +596,10 @@
#include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002
#elif MB(BTT_E3_RRF)
#include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF
-#elif MB(BTT_SKR_V2_0)
- #include "stm32f4/pins_BTT_SKR_V2_0.h" // STM32F4 env:BIGTREE_SKR_2
+#elif MB(BTT_SKR_V2_0_REV_A)
+ #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2
+#elif MB(BTT_SKR_V2_0_REV_B)
+ #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2
#elif MB(LERDGE_K)
#include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive
#elif MB(LERDGE_S)
@@ -706,6 +708,7 @@
#define BOARD_RUMBA32_AUS3D -1019
#define BOARD_RAMPS_DAGOMA -1020
#define BOARD_RAMPS_LONGER3D_LK4PRO -1021
+ #define BOARD_BTT_SKR_V2_0 -1022
#if MB(MKS_13)
#error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
@@ -753,6 +756,8 @@
#error "BOARD_RAMPS_DAGOMA is now BOARD_DAGOMA_F5. Please update your configuration."
#elif MB(RAMPS_LONGER3D_LK4PRO)
#error "BOARD_RAMPS_LONGER3D_LK4PRO is now BOARD_LONGER3D_LKx_PRO. Please update your configuration."
+ #elif MB(BTT_SKR_V2_0)
+ #error "BTT_SKR_V2_0 is now BTT_SKR_V2_0_REV_A or BTT_SKR_V2_0_REV_B. Please update your configuration."
#else
#error "Unknown MOTHERBOARD value set in Configuration.h"
#endif
@@ -779,6 +784,7 @@
#undef BOARD_RUMBA32_AUS3D
#undef BOARD_RAMPS_DAGOMA
#undef BOARD_RAMPS_LONGER3D_LK4PRO
+ #undef BOARD_BTT_SKR_V2_0
#endif
diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_A.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_A.h
new file mode 100644
index 0000000000..be9580ee66
--- /dev/null
+++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_A.h
@@ -0,0 +1,29 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+
+#define BOARD_INFO_NAME "BTT SKR V2 Rev.A"
+
+#error "SKR V2 Rev.A requires modification or drivers may be damaged. See https://bit.ly/3t5d9JQ for more information. Comment out this line to continue."
+#define DISABLE_DRIVER_SAFE_POWER_PROTECT
+
+#include "pins_BTT_SKR_V2_0_common.h"
diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_B.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_B.h
new file mode 100644
index 0000000000..b83f41b26a
--- /dev/null
+++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_REV_B.h
@@ -0,0 +1,26 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+
+#define BOARD_INFO_NAME "BTT SKR V2 Rev.B"
+
+#include "pins_BTT_SKR_V2_0_common.h"
diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h
similarity index 99%
rename from Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0.h
rename to Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h
index 11f954c400..b88e598e6f 100644
--- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0.h
+++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h
@@ -23,8 +23,6 @@
#include "env_validate.h"
-#define BOARD_INFO_NAME "BTT SKR V2.0"
-
// Use one of these or SDCard-based Emulation will be used
#if NO_EEPROM_SELECTED
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation