BTT SKR Mini E3 V3.0.1 (#24722)

This commit is contained in:
ellensp 2022-09-14 05:27:16 +12:00 committed by Scott Lahteine
parent 38b3105900
commit aabd3e9e19
12 changed files with 1378 additions and 70 deletions

View File

@ -329,45 +329,46 @@
#define BOARD_BTT_SKR_MINI_E3_V1_2 4025 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC) #define BOARD_BTT_SKR_MINI_E3_V1_2 4025 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V2_0 4026 // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC / STM32F103RE) #define BOARD_BTT_SKR_MINI_E3_V2_0 4026 // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC / STM32F103RE)
#define BOARD_BTT_SKR_MINI_E3_V3_0 4027 // BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RE) #define BOARD_BTT_SKR_MINI_E3_V3_0 4027 // BigTreeTech SKR Mini E3 V3.0 (STM32G0B1RE)
#define BOARD_BTT_SKR_MINI_MZ_V1_0 4028 // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC) #define BOARD_BTT_SKR_MINI_E3_V3_0_1 4028 // BigTreeTech SKR Mini E3 V3.0.1 (STM32F401RC)
#define BOARD_BTT_SKR_E3_DIP 4029 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) #define BOARD_BTT_SKR_MINI_MZ_V1_0 4029 // BigTreeTech SKR Mini MZ V1.0 (STM32F103RC)
#define BOARD_BTT_SKR_CR6 4030 // BigTreeTech SKR CR6 v1.0 (STM32F103RE) #define BOARD_BTT_SKR_E3_DIP 4030 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
#define BOARD_JGAURORA_A5S_A1 4031 // JGAurora A5S A1 (STM32F103ZE) #define BOARD_BTT_SKR_CR6 4031 // BigTreeTech SKR CR6 v1.0 (STM32F103RE)
#define BOARD_FYSETC_AIO_II 4032 // FYSETC AIO_II (STM32F103RC) #define BOARD_JGAURORA_A5S_A1 4032 // JGAurora A5S A1 (STM32F103ZE)
#define BOARD_FYSETC_CHEETAH 4033 // FYSETC Cheetah (STM32F103RC) #define BOARD_FYSETC_AIO_II 4033 // FYSETC AIO_II (STM32F103RC)
#define BOARD_FYSETC_CHEETAH_V12 4034 // FYSETC Cheetah V1.2 (STM32F103RC) #define BOARD_FYSETC_CHEETAH 4034 // FYSETC Cheetah (STM32F103RC)
#define BOARD_LONGER3D_LK 4035 // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE) #define BOARD_FYSETC_CHEETAH_V12 4035 // FYSETC Cheetah V1.2 (STM32F103RC)
#define BOARD_CCROBOT_MEEB_3DP 4036 // ccrobot-online.com MEEB_3DP (STM32F103RC) #define BOARD_LONGER3D_LK 4036 // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE)
#define BOARD_CHITU3D_V5 4037 // Chitu3D TronXY X5SA V5 Board (STM32F103ZE) #define BOARD_CCROBOT_MEEB_3DP 4037 // ccrobot-online.com MEEB_3DP (STM32F103RC)
#define BOARD_CHITU3D_V6 4038 // Chitu3D TronXY X5SA V6 Board (STM32F103ZE) #define BOARD_CHITU3D_V5 4038 // Chitu3D TronXY X5SA V5 Board (STM32F103ZE)
#define BOARD_CHITU3D_V9 4039 // Chitu3D TronXY X5SA V9 Board (STM32F103ZE) #define BOARD_CHITU3D_V6 4039 // Chitu3D TronXY X5SA V6 Board (STM32F103ZE)
#define BOARD_CREALITY_V4 4040 // Creality v4.x (STM32F103RC / STM32F103RE) #define BOARD_CHITU3D_V9 4040 // Chitu3D TronXY X5SA V9 Board (STM32F103ZE)
#define BOARD_CREALITY_V422 4041 // Creality v4.2.2 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V4 4041 // Creality v4.x (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V423 4042 // Creality v4.2.3 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V422 4042 // Creality v4.2.2 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V425 4043 // Creality v4.2.5 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V423 4043 // Creality v4.2.3 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V427 4044 // Creality v4.2.7 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V425 4044 // Creality v4.2.5 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V4210 4045 // Creality v4.2.10 (STM32F103RC / STM32F103RE) as found in the CR-30 #define BOARD_CREALITY_V427 4045 // Creality v4.2.7 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V431 4046 // Creality v4.3.1 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V4210 4046 // Creality v4.2.10 (STM32F103RC / STM32F103RE) as found in the CR-30
#define BOARD_CREALITY_V431_A 4047 // Creality v4.3.1a (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431 4047 // Creality v4.3.1 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V431_B 4048 // Creality v4.3.1b (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431_A 4048 // Creality v4.3.1a (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V431_C 4049 // Creality v4.3.1c (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431_B 4049 // Creality v4.3.1b (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V431_D 4050 // Creality v4.3.1d (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431_C 4050 // Creality v4.3.1c (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V452 4051 // Creality v4.5.2 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431_D 4051 // Creality v4.3.1d (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V453 4052 // Creality v4.5.3 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V452 4052 // Creality v4.5.2 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V24S1 4053 // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender-7 #define BOARD_CREALITY_V453 4053 // Creality v4.5.3 (STM32F103RC / STM32F103RE)
#define BOARD_CREALITY_V24S1_301 4054 // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) v301 as found in the Ender-3 S1 #define BOARD_CREALITY_V24S1 4054 // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender-7
#define BOARD_CREALITY_V25S1 4055 // Creality v2.5.S1 (STM32F103RE) as found in the CR-10 Smart Pro #define BOARD_CREALITY_V24S1_301 4055 // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) v301 as found in the Ender-3 S1
#define BOARD_TRIGORILLA_PRO 4056 // Trigorilla Pro (STM32F103ZE) #define BOARD_CREALITY_V25S1 4056 // Creality v2.5.S1 (STM32F103RE) as found in the CR-10 Smart Pro
#define BOARD_FLY_MINI 4057 // FLYmaker FLY MINI (STM32F103RC) #define BOARD_TRIGORILLA_PRO 4057 // Trigorilla Pro (STM32F103ZE)
#define BOARD_FLSUN_HISPEED 4058 // FLSUN HiSpeedV1 (STM32F103VE) #define BOARD_FLY_MINI 4058 // FLYmaker FLY MINI (STM32F103RC)
#define BOARD_BEAST 4059 // STM32F103RE Libmaple-based controller #define BOARD_FLSUN_HISPEED 4059 // FLSUN HiSpeedV1 (STM32F103VE)
#define BOARD_MINGDA_MPX_ARM_MINI 4060 // STM32F103ZE Mingda MD-16 #define BOARD_BEAST 4060 // STM32F103RE Libmaple-based controller
#define BOARD_GTM32_PRO_VD 4061 // STM32F103VE controller #define BOARD_MINGDA_MPX_ARM_MINI 4061 // STM32F103ZE Mingda MD-16
#define BOARD_ZONESTAR_ZM3E2 4062 // Zonestar ZM3E2 (STM32F103RC) #define BOARD_GTM32_PRO_VD 4062 // STM32F103VE controller
#define BOARD_ZONESTAR_ZM3E4 4063 // Zonestar ZM3E4 V1 (STM32F103VC) #define BOARD_ZONESTAR_ZM3E2 4063 // Zonestar ZM3E2 (STM32F103RC)
#define BOARD_ZONESTAR_ZM3E4V2 4064 // Zonestar ZM3E4 V2 (STM32F103VC) #define BOARD_ZONESTAR_ZM3E4 4064 // Zonestar ZM3E4 V1 (STM32F103VC)
#define BOARD_ERYONE_ERY32_MINI 4065 // Eryone Ery32 mini (STM32F103VE) #define BOARD_ZONESTAR_ZM3E4V2 4065 // Zonestar ZM3E4 V2 (STM32F103VC)
#define BOARD_PANDA_PI_V29 4066 // Panda Pi V2.9 - Standalone (STM32F103RC) #define BOARD_ERYONE_ERY32_MINI 4066 // Eryone Ery32 mini (STM32F103VE)
#define BOARD_PANDA_PI_V29 4067 // Panda Pi V2.9 - Standalone (STM32F103RC)
// //
// ARM Cortex-M4F // ARM Cortex-M4F

View File

@ -541,6 +541,8 @@
#include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple #include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple
#elif MB(BTT_SKR_MINI_E3_V3_0) #elif MB(BTT_SKR_MINI_E3_V3_0)
#include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer
#elif MB(BTT_SKR_MINI_E3_V3_0_1)
#include "stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h"// STM32F4 env:STM32F401RC_btt
#elif MB(BTT_SKR_MINI_MZ_V1_0) #elif MB(BTT_SKR_MINI_MZ_V1_0)
#include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple
#elif MB(BTT_SKR_E3_DIP) #elif MB(BTT_SKR_E3_DIP)

View File

@ -135,6 +135,12 @@
#define EXP1_02_PIN PB6 #define EXP1_02_PIN PB6
#define EXP1_08_PIN PB7 #define EXP1_08_PIN PB7
#endif #endif
#define EXP1_01_PIN PB5
#define EXP1_03_PIN PA9
#define EXP1_04_PIN -1 // RESET
#define EXP1_05_PIN PA10
#define EXP1_06_PIN PB9
#define EXP1_07_PIN PB8
#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
/** /**
@ -156,22 +162,22 @@
#define BEEPER_PIN EXP1_02_PIN #define BEEPER_PIN EXP1_02_PIN
#define BTN_EN1 EXP1_08_PIN #define BTN_EN1 EXP1_08_PIN
#define BTN_EN2 PB8 #define BTN_EN2 EXP1_07_PIN
#define BTN_ENC PB5 #define BTN_ENC EXP1_01_PIN
#elif HAS_WIRED_LCD #elif HAS_WIRED_LCD
#if ENABLED(CR10_STOCKDISPLAY) #if ENABLED(CR10_STOCKDISPLAY)
#define BEEPER_PIN PB5 #define BEEPER_PIN EXP1_01_PIN
#define BTN_ENC EXP1_02_PIN #define BTN_ENC EXP1_02_PIN
#define BTN_EN1 PA9 #define BTN_EN1 EXP1_03_PIN
#define BTN_EN2 PA10 #define BTN_EN2 EXP1_05_PIN
#define LCD_PINS_RS PB8 #define LCD_PINS_RS EXP1_07_PIN
#define LCD_PINS_ENABLE EXP1_08_PIN #define LCD_PINS_ENABLE EXP1_08_PIN
#define LCD_PINS_D4 PB9 #define LCD_PINS_D4 EXP1_06_PIN
#elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD!
@ -179,23 +185,23 @@
#error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
#endif #endif
#define LCD_PINS_RS PB9 #define LCD_PINS_RS EXP1_06_PIN
#define LCD_PINS_ENABLE EXP1_02_PIN #define LCD_PINS_ENABLE EXP1_02_PIN
#define LCD_PINS_D4 PB8 #define LCD_PINS_D4 EXP1_07_PIN
#define LCD_PINS_D5 PA10 #define LCD_PINS_D5 EXP1_05_PIN
#define LCD_PINS_D6 PA9 #define LCD_PINS_D6 EXP1_03_PIN
#define LCD_PINS_D7 PB5 #define LCD_PINS_D7 EXP1_01_PIN
#define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD!
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
#define BTN_ENC EXP1_02_PIN #define BTN_ENC EXP1_02_PIN
#define BTN_EN1 PA9 #define BTN_EN1 EXP1_03_PIN
#define BTN_EN2 PA10 #define BTN_EN2 EXP1_05_PIN
#define DOGLCD_CS PB8 #define DOGLCD_CS EXP1_07_PIN
#define DOGLCD_A0 PB9 #define DOGLCD_A0 EXP1_06_PIN
#define DOGLCD_SCK PB5 #define DOGLCD_SCK EXP1_01_PIN
#define DOGLCD_MOSI EXP1_08_PIN #define DOGLCD_MOSI EXP1_08_PIN
#define FORCE_SOFT_SPI #define FORCE_SOFT_SPI
@ -238,7 +244,7 @@
* EXP1-1 ----------- EXP1-7 SD_DET * EXP1-1 ----------- EXP1-7 SD_DET
*/ */
#define TFTGLCD_CS PA9 #define TFTGLCD_CS EXP1_03_PIN
#endif #endif
@ -291,20 +297,20 @@
* for backlight configuration see steps 2 (V2.1) and 3 in https://wiki.fysetc.com/Mini12864_Panel/ * for backlight configuration see steps 2 (V2.1) and 3 in https://wiki.fysetc.com/Mini12864_Panel/
*/ */
#define LCD_PINS_RS PA9 // CS #define LCD_PINS_RS EXP1_03_PIN // CS
#define LCD_PINS_ENABLE PA3 // MOSI #define LCD_PINS_ENABLE PA3 // MOSI
#define LCD_BACKLIGHT_PIN -1 #define LCD_BACKLIGHT_PIN -1
#define NEOPIXEL_PIN PB8 #define NEOPIXEL_PIN EXP1_07_PIN
#define LCD_CONTRAST 255 #define LCD_CONTRAST 255
#define LCD_RESET_PIN PA10 #define LCD_RESET_PIN EXP1_05_PIN
#define DOGLCD_CS PA9 #define DOGLCD_CS EXP1_03_PIN
#define DOGLCD_A0 PB5 #define DOGLCD_A0 EXP1_01_PIN
#define DOGLCD_SCK PA2 #define DOGLCD_SCK PA2
#define DOGLCD_MOSI PA3 #define DOGLCD_MOSI PA3
#define BTN_ENC PA15 #define BTN_ENC PA15
#define BTN_EN1 PB9 #define BTN_EN1 EXP1_06_PIN
#define BTN_EN2 PB15 #define BTN_EN2 PB15
#define FORCE_SOFT_SPI #define FORCE_SOFT_SPI
@ -354,8 +360,8 @@
#define BEEPER_PIN EXP1_02_PIN #define BEEPER_PIN EXP1_02_PIN
#define CLCD_MOD_RESET PA9 #define CLCD_MOD_RESET EXP1_03_PIN
#define CLCD_SPI_CS PB8 #define CLCD_SPI_CS EXP1_07_PIN
#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050
@ -370,8 +376,8 @@
#if SD_CONNECTION_IS(ONBOARD) #if SD_CONNECTION_IS(ONBOARD)
#define SD_DETECT_PIN PC4 #define SD_DETECT_PIN PC4
#elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
#define SD_DETECT_PIN PB5 #define SD_DETECT_PIN EXP1_01_PIN
#define SD_SS_PIN PA10 #define SD_SS_PIN EXP1_05_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE) #elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "SD CUSTOM_CABLE is not compatible with SKR Mini E3." #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
#endif #endif

View File

@ -19,11 +19,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#pragma once
// https://github.com/ktand/Armed // https://github.com/ktand/Armed
#pragma once
#include "env_validate.h" #include "env_validate.h"
#if HOTENDS > 2 || E_STEPPERS > 2 #if HOTENDS > 2 || E_STEPPERS > 2

View File

@ -0,0 +1,350 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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 <https://www.gnu.org/licenses/>.
*
*/
#pragma once
//#define BOARD_CUSTOM_BUILD_FLAGS -DTONE_CHANNEL=4 -DTONE_TIMER=4 -DTIMER_TONE=4
#include "env_validate.h"
#if HOTENDS > 1 || E_STEPPERS > 1
#error "BTT SKR Mini E3 V3.0.1 supports up to 1 hotend / E stepper."
#endif
#ifndef BOARD_INFO_NAME
#define BOARD_INFO_NAME "BTT SKR Mini E3 V3.0.1"
#endif
#define USES_DIAG_JUMPERS
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#ifndef NEOPIXEL_LED
#define LED_PIN PA14
#endif
// Onboard I2C EEPROM
#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
#undef NO_EEPROM_SELECTED
#define I2C_EEPROM
#define SOFT_I2C_EEPROM // Force the use of Software I2C
#define I2C_SCL_PIN PB8
#define I2C_SDA_PIN PB9
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
//
// Servos
//
#define SERVO0_PIN PA0 // SERVOS
//
// Limit Switches
//
#define X_STOP_PIN PB5 // X-STOP
#define Y_STOP_PIN PB6 // Y-STOP
#define Z_STOP_PIN PB7 // Z-STOP
//
// Z Probe must be this pin
//
#define Z_MIN_PROBE_PIN PA1 // PROBE
//
// Filament Runout Sensor
//
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN PC15 // E0-STOP
#endif
//
// Power-loss Detection
//
#ifndef POWER_LOSS_PIN
#define POWER_LOSS_PIN PC13 // Power Loss Detection: PWR-DET
#endif
#ifndef NEOPIXEL_PIN
#define NEOPIXEL_PIN PA14 // LED driving pin
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PC14 // Power Supply Control
#endif
//
// Steppers
//
#define X_ENABLE_PIN PC10
#define X_STEP_PIN PC11
#define X_DIR_PIN PC12
#define Y_ENABLE_PIN PB13
#define Y_STEP_PIN PB12
#define Y_DIR_PIN PB10
#define Z_ENABLE_PIN PB2
#define Z_STEP_PIN PB1
#define Z_DIR_PIN PB0
#define E0_ENABLE_PIN PC3
#define E0_STEP_PIN PC2
#define E0_DIR_PIN PC1
#if HAS_TMC_UART
/**
* TMC220x stepper drivers
* Hardware serial communication ports
*/
#define X_HARDWARE_SERIAL MSerial6
#define Y_HARDWARE_SERIAL MSerial6
#define Z_HARDWARE_SERIAL MSerial6
#define E0_HARDWARE_SERIAL MSerial6
// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#endif
//
// Temperature Sensors
//
#define TEMP_0_PIN PC5 // Analog Input "TH0"
#define TEMP_BED_PIN PC4 // Analog Input "TB0"
//
// Heaters / Fans
//
#define HEATER_0_PIN PA15 // "HE"
#define HEATER_BED_PIN PB3 // "HB"
#define FAN_PIN PC9 // "FAN0"
#define FAN1_PIN PA8 // "FAN1"
#define FAN2_PIN PC8 // "FAN2"
/**
* SKR Mini E3 V3.0.1
* ------
* (BEEPER) PB15 | 1 2 | PB14 (BTN_ENC)
* (BTN_EN1) PA9 | 3 4 | RESET
* (BTN_EN2) PA10 5 6 | PB4 (LCD_D4)
* (LCD_RS) PD2 | 7 8 | PC0 (LCD_EN)
* GND | 9 10 | 5V
* ------
* EXP1
*/
#define EXP1_01_PIN PB15
#define EXP1_02_PIN PB14
#define EXP1_03_PIN PA9
#define EXP1_04_PIN -1 // RESET
#define EXP1_05_PIN PA10
#define EXP1_06_PIN PB4
#define EXP1_07_PIN PD2
#define EXP1_08_PIN PC0
#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
/**
* ------ ------ ------
* (ENT) | 1 2 | (BEEP) |10 9 | |10 9 |
* (RX) | 3 4 | (RX) | 8 7 | (TX) RX | 8 7 | TX
* (TX) 5 6 | (ENT) 6 5 | (BEEP) ENT | 6 5 | BEEP
* (B) | 7 8 | (A) (B) | 4 3 | (A) B | 4 3 | A
* GND | 9 10 | (VCC) GND | 2 1 | VCC GND | 2 1 | VCC
* ------ ------ ------
* EXP1 DWIN DWIN (plug)
*
* All pins are labeled as printed on DWIN PCB. Connect TX-TX, A-A and so on.
*/
#error "DWIN_CREALITY_LCD requires a custom cable, see diagram above this line. Comment out this line to continue."
#define BEEPER_PIN EXP1_02_PIN
#define BTN_EN1 EXP1_08_PIN
#define BTN_EN2 EXP1_07_PIN
#define BTN_ENC EXP1_01_PIN
#elif HAS_WIRED_LCD
#if ENABLED(CR10_STOCKDISPLAY)
#define BEEPER_PIN EXP1_01_PIN
#define BTN_ENC EXP1_02_PIN
#define BTN_EN1 EXP1_03_PIN
#define BTN_EN2 EXP1_05_PIN
#define LCD_PINS_RS EXP1_07_PIN
#define LCD_PINS_ENABLE EXP1_08_PIN
#define LCD_PINS_D4 EXP1_06_PIN
#elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD!
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
#error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
#endif
#define LCD_PINS_RS EXP1_06_PIN
#define LCD_PINS_ENABLE EXP1_02_PIN
#define LCD_PINS_D4 EXP1_07_PIN
#define LCD_PINS_D5 EXP1_05_PIN
#define LCD_PINS_D6 EXP1_03_PIN
#define LCD_PINS_D7 EXP1_01_PIN
#define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD!
#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
#define BTN_ENC EXP1_02_PIN
#define BTN_EN1 EXP1_03_PIN
#define BTN_EN2 EXP1_05_PIN
#define DOGLCD_CS EXP1_07_PIN
#define DOGLCD_A0 EXP1_06_PIN
#define DOGLCD_SCK EXP1_01_PIN
#define DOGLCD_MOSI EXP1_08_PIN
#define FORCE_SOFT_SPI
#define LCD_BACKLIGHT_PIN -1
#elif IS_TFTGLCD_PANEL
#if ENABLED(TFTGLCD_PANEL_SPI)
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
#error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
#endif
/**
* TFTGLCD_PANEL_SPI display pinout
*
* Board Display
* ------ ------
* (BEEPER) PB6 | 1 2 | PB15 (SD_DET) 5V |10 9 | GND
* RESET | 3 4 | PA9 (MOD_RESET) -- | 8 7 | (SD_DET)
* PB4 5 6 | PA10 (SD_CS) (MOSI) | 6 5 | --
* PB7 | 7 8 | PD2 (LCD_CS) (SD_CS) | 4 3 | (LCD_CS)
* GND | 9 10 | 5V (SCK) | 2 1 | (MISO)
* ------ ------
* EXP1 EXP1
*
* Needs custom cable:
*
* Board Display
*
* EXP1-10 ---------- EXP1-10
* EXP1-9 ----------- EXP1-9
* SPI1-4 ----------- EXP1-6
* EXP1-7 ----------- FREE
* SPI1-3 ----------- EXP1-2
* EXP1-5 ----------- EXP1-4
* EXP1-4 ----------- FREE
* EXP1-3 ----------- EXP1-3
* SPI1-1 ----------- EXP1-1
* EXP1-1 ----------- EXP1-7
*/
#define TFTGLCD_CS EXP1_03_PIN
#endif
#else
#error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BIGTREE_SKR_MINI_E3."
#endif
#endif // HAS_WIRED_LCD
#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050)
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
#error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
#endif
/**
* FYSETC TFT TFT81050 display pinout
*
* Board Display
* ------ ------
* (SD_DET) PB15 | 1 2 | PB6 (BEEPER) 5V |10 9 | GND
* (MOD_RESET) PA9 | 3 4 | RESET (RESET) | 8 7 | (SD_DET)
* (SD_CS) PA10 5 6 | PB4 (FREE) (MOSI) | 6 5 | (LCD_CS)
* (LCD_CS) PD2 | 7 8 | PB7 (FREE) (SD_CS) | 4 3 | (MOD_RESET)
* 5V | 9 10 | GND (SCK) | 2 1 | (MISO)
* ------ ------
* EXP1 EXP1
*
* Needs custom cable:
*
* Board Adapter Display
* _________
* EXP1-10 ---------- EXP1-10
* EXP1-9 ----------- EXP1-9
* SPI1-4 ----------- EXP1-6
* EXP1-7 ----------- EXP1-5
* SPI1-3 ----------- EXP1-2
* EXP1-5 ----------- EXP1-4
* EXP1-4 ----------- EXP1-8
* EXP1-3 ----------- EXP1-3
* SPI1-1 ----------- EXP1-1
* EXP1-1 ----------- EXP1-7
*/
#define CLCD_SPI_BUS 1 // SPI1 connector
#define BEEPER_PIN EXP1_02_PIN
#define CLCD_MOD_RESET EXP1_03_PIN
#define CLCD_SPI_CS EXP1_07_PIN
#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050
//
// SD Support
//
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#if SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
#define SD_DETECT_PIN EXP1_01_PIN
#define SD_SS_PIN EXP1_05_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
#endif
#define ONBOARD_SPI_DEVICE 1 // SPI1 -> used only by HAL/STM32F1...
#define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card
#define ENABLE_SPI1
#define SDSS ONBOARD_SD_CS_PIN
#define SD_SS_PIN ONBOARD_SD_CS_PIN
#define SD_SCK_PIN PA5
#define SD_MISO_PIN PA6
#define SD_MOSI_PIN PA7

View File

@ -0,0 +1,38 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xC -DSTM32F4xx",
"f_cpu": "84000000L",
"mcu": "stm32f401rct6",
"product_line": "STM32F401xC",
"variant": "MARLIN_F401RC"
},
"debug": {
"jlink_device": "STM32F401RC",
"openocd_target": "stm32f4x",
"svd_path": "STM32F401x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"spl",
"stm32cube",
"libopencm3"
],
"name": "STM32F401RC (64k RAM. 256k Flash)",
"upload": {
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "serial",
"protocols": [
"blackmagic",
"dfu",
"jlink",
"serial",
"stlink"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401rc.html",
"vendor": "Generic"
}

View File

@ -0,0 +1,256 @@
/*
*******************************************************************************
* Copyright (c) 2020-2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
/*
* Automatically generated from STM32F401R(B-C)Tx.xml, STM32F401R(D-E)Tx.xml
* CubeMX DB release 6.0.30
*/
#if !defined(CUSTOM_PERIPHERAL_PINS)
#include "Arduino.h"
#include "PeripheralPins.h"
/* =====
* Notes:
* - The pins mentioned Px_y_ALTz are alternative possibilities which use other
* HW peripheral instances. You can use them the same way as any other "normal"
* pin (i.e. analogWrite(PA7_ALT1, 128);).
*
* - Commented lines are alternative possibilities which are not used per default.
* If you change them, you will have to know what you do
* =====
*/
//*** ADC ***
#ifdef HAL_ADC_MODULE_ENABLED
WEAK const PinMap PinMap_ADC[] = {
{PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
{PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
{PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
{PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
{PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
{PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
{PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
{PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
{PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
{PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
{PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
{PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
{PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
{PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
{PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
{NC, NP, 0}
};
#endif
//*** No DAC ***
//*** I2C ***
#ifdef HAL_I2C_MODULE_ENABLED
WEAK const PinMap PinMap_I2C_SDA[] = {
{PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)},
{PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)},
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{NC, NP, 0}
};
#endif
#ifdef HAL_I2C_MODULE_ENABLED
WEAK const PinMap PinMap_I2C_SCL[] = {
{PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{NC, NP, 0}
};
#endif
//*** TIM ***
#ifdef HAL_TIM_MODULE_ENABLED
WEAK const PinMap PinMap_TIM[] = {
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
{PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
{PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
{PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
{PA_2_ALT2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
{PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
{PA_3_ALT2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
{PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
{PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
{PA_7_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
{PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
{PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
{PB_8_ALT1, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
{PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
{PB_9_ALT1, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
{PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
{PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
{PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
{PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
{PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
{PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
{PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
{NC, NP, 0}
};
#endif
//*** UART ***
#ifdef HAL_UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_TX[] = {
{PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PA_11, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{NC, NP, 0}
};
#endif
#ifdef HAL_UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_RX[] = {
{PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PA_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{NC, NP, 0}
};
#endif
#ifdef HAL_UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_RTS[] = {
{PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{NC, NP, 0}
};
#endif
#ifdef HAL_UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_CTS[] = {
{PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{NC, NP, 0}
};
#endif
//*** SPI ***
#ifdef HAL_SPI_MODULE_ENABLED
WEAK const PinMap PinMap_SPI_MOSI[] = {
{PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{NC, NP, 0}
};
#endif
#ifdef HAL_SPI_MODULE_ENABLED
WEAK const PinMap PinMap_SPI_MISO[] = {
{PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{NC, NP, 0}
};
#endif
#ifdef HAL_SPI_MODULE_ENABLED
WEAK const PinMap PinMap_SPI_SCLK[] = {
{PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{NC, NP, 0}
};
#endif
#ifdef HAL_SPI_MODULE_ENABLED
WEAK const PinMap PinMap_SPI_SSEL[] = {
{PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PA_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
{PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
{NC, NP, 0}
};
#endif
//*** No CAN ***
//*** No ETHERNET ***
//*** No QUADSPI ***
//*** USB ***
#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED)
WEAK const PinMap PinMap_USB_OTG_FS[] = {
{PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
{PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
{PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
{PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
{PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP
{NC, NP, 0}
};
#endif
//*** SD ***
#ifdef HAL_SD_MODULE_ENABLED
WEAK const PinMap PinMap_SD[] = {
{PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4
{PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5
{PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6
{PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7
{PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0
{PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1
{PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2
{PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3
{PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK
{PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD
{NC, NP, 0}
};
#endif
#endif /* !CUSTOM_PERIPHERAL_PINS */

View File

@ -0,0 +1,52 @@
/* Alternate pin name */
PA_0_ALT1 = PA_0 | ALT1,
PA_1_ALT1 = PA_1 | ALT1,
PA_2_ALT1 = PA_2 | ALT1,
PA_2_ALT2 = PA_2 | ALT2,
PA_3_ALT1 = PA_3 | ALT1,
PA_3_ALT2 = PA_3 | ALT2,
PA_4_ALT1 = PA_4 | ALT1,
PA_7_ALT1 = PA_7 | ALT1,
PA_15_ALT1 = PA_15 | ALT1,
PB_0_ALT1 = PB_0 | ALT1,
PB_1_ALT1 = PB_1 | ALT1,
PB_3_ALT1 = PB_3 | ALT1,
PB_4_ALT1 = PB_4 | ALT1,
PB_5_ALT1 = PB_5 | ALT1,
PB_8_ALT1 = PB_8 | ALT1,
PB_9_ALT1 = PB_9 | ALT1,
/* SYS_WKUP */
#ifdef PWR_WAKEUP_PIN1
SYS_WKUP1 = PA_0,
#endif
#ifdef PWR_WAKEUP_PIN2
SYS_WKUP2 = NC,
#endif
#ifdef PWR_WAKEUP_PIN3
SYS_WKUP3 = NC,
#endif
#ifdef PWR_WAKEUP_PIN4
SYS_WKUP4 = NC,
#endif
#ifdef PWR_WAKEUP_PIN5
SYS_WKUP5 = NC,
#endif
#ifdef PWR_WAKEUP_PIN6
SYS_WKUP6 = NC,
#endif
#ifdef PWR_WAKEUP_PIN7
SYS_WKUP7 = NC,
#endif
#ifdef PWR_WAKEUP_PIN8
SYS_WKUP8 = NC,
#endif
/* USB */
#ifdef USBCON
USB_OTG_FS_DM = PA_11,
USB_OTG_FS_DP = PA_12,
USB_OTG_FS_ID = PA_10,
USB_OTG_FS_SOF = PA_8,
USB_OTG_FS_VBUS = PA_9,
#endif

View File

@ -0,0 +1,177 @@
/**
******************************************************************************
* @file LinkerScript.ld
* @author Auto-generated by STM32CubeIDE
* @brief Linker script for STM32F401RBTx Device from STM32F4 series
* 128Kbytes FLASH
* 64Kbytes RAM
*
* Set heap size, stack size and stack location according
* to application requirements.
*
* Set memory bank area and size if external memory is used
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
}
/* Sections */
SECTIONS
{
/* The startup code into "FLASH" Rom type memory */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data into "FLASH" Rom type memory */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data into "FLASH" Rom type memory */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH
.ARM : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH
.preinit_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
} >FLASH
.init_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
} >FLASH
.fini_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(4);
} >FLASH
/* Used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections into "RAM" Ram type memory */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.RamFunc) /* .RamFunc sections */
*(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
/* Uninitialized data section into "RAM" Ram type memory */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
/* Remove information from the compiler libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}

View File

@ -0,0 +1,223 @@
/*
*******************************************************************************
* Copyright (c) 2020-2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#if defined(STM32F401xC)
#include "pins_arduino.h"
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // D0/A0
PA_1, // D1/A1
PA_2, // D2/A2
PA_3, // D3/A3
PA_4, // D4/A4
PA_5, // D5/A5
PA_6, // D6/A6
PA_7, // D7/A7
PA_8, // D8
PA_9, // D9
PA_10, // D10
PA_11, // D11
PA_12, // D12
PA_13, // D13
PA_14, // D14
PA_15, // D15
PB_0, // D16/A8
PB_1, // D17/A9
PB_2, // D18
PB_3, // D19
PB_4, // D20
PB_5, // D21
PB_6, // D22
PB_7, // D23
PB_8, // D24
PB_9, // D25
PB_10, // D26
PB_12, // D27
PB_13, // D28
PB_14, // D29
PB_15, // D30
PC_0, // D31/A10
PC_1, // D32/A11
PC_2, // D33/A12
PC_3, // D34/A13
PC_4, // D35/A14
PC_5, // D36/A15
PC_6, // D37
PC_7, // D38
PC_8, // D39
PC_9, // D40
PC_10, // D41
PC_11, // D42
PC_12, // D43
PC_13, // D44
PC_14, // D45
PC_15, // D46
PD_2, // D47
PH_0, // D48
PH_1 // D49
};
// Analog (Ax) pin number array
const uint32_t analogInputPin[] = {
0, // A0, PA0
1, // A1, PA1
2, // A2, PA2
3, // A3, PA3
4, // A4, PA4
5, // A5, PA5
6, // A6, PA6
7, // A7, PA7
16, // A8, PB0
17, // A9, PB1
31, // A10, PC0
32, // A11, PC1
33, // A12, PC2
34, // A13, PC3
35, // A14, PC4
36 // A15, PC5
};
// ----------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
/*
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
* AHB/APBx prescalers and Flash settings
* @note This function should be called only once the RCC clock configuration
* is reset to the default reset state (done in SystemInit() function).
* @param None
* @retval None
*/
/******************************************************************************/
/* PLL (clocked by HSE) used as System clock source */
/******************************************************************************/
static uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
/* The voltage scaling allows optimizing the power consumption when the device is
clocked below the maximum system frequency, to update the voltage scaling value
regarding system frequency refer to product datasheet. */
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
// Enable HSE oscillator and activate PLL with HSE as source
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
if (bypass == 0) {
RCC_OscInitStruct.HSEState = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT
} else {
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN
}
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not
RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336)
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> OK for USB
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
return 0; // FAIL
}
// Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
return 0; // FAIL
}
/* Output clock on MCO1 pin(PA8) for debugging purpose */
/*
if (bypass == 0)
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz
else
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz
*/
return 1; // OK
}
/******************************************************************************/
/* PLL (clocked by HSI) used as System clock source */
/******************************************************************************/
uint8_t SetSysClock_PLL_HSI(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
/* The voltage scaling allows optimizing the power consumption when the device is
clocked below the maximum system frequency, to update the voltage scaling value
regarding system frequency refer to product datasheet. */
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
// Enable HSI oscillator and activate PLL with HSI as source
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 16; // VCO input clock = 1 MHz (16 MHz / 16)
RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336)
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> freq is ok but not precise enough
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
return 0; // FAIL
}
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
return 0; // FAIL
}
/* Output clock on MCO1 pin(PA8) for debugging purpose */
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
return 1; // OK
}
WEAK void SystemClock_Config(void)
{
/* 1- If fail try to start with HSE and external xtal */
if (SetSysClock_PLL_HSE(0) == 0) {
/* 2- Try to start with HSE and external clock */
if (SetSysClock_PLL_HSE(1) == 0) {
/* 3- If fail start with HSI clock */
if (SetSysClock_PLL_HSI() == 0) {
Error_Handler();
}
}
}
/* Output clock on MCO2 pin(PC9) for debugging purpose */
//HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4);
}
#ifdef __cplusplus
}
#endif
#endif /* STM32F401xC */

View File

@ -0,0 +1,186 @@
/*
*******************************************************************************
* Copyright (c) 2020-2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#pragma once
/*----------------------------------------------------------------------------
* STM32 pins number
*----------------------------------------------------------------------------*/
#define PA0 PIN_A0
#define PA1 PIN_A1
#define PA2 PIN_A2
#define PA3 PIN_A3
#define PA4 PIN_A4
#define PA5 PIN_A5
#define PA6 PIN_A6
#define PA7 PIN_A7
#define PA8 8
#define PA9 9
#define PA10 10
#define PA11 11
#define PA12 12
#define PA13 13
#define PA14 14
#define PA15 15
#define PB0 PIN_A8
#define PB1 PIN_A9
#define PB2 18
#define PB3 19
#define PB4 20
#define PB5 21
#define PB6 22
#define PB7 23
#define PB8 24
#define PB9 25
#define PB10 26
#define PB12 27
#define PB13 28
#define PB14 29
#define PB15 30
#define PC0 PIN_A10
#define PC1 PIN_A11
#define PC2 PIN_A12
#define PC3 PIN_A13
#define PC4 PIN_A14
#define PC5 PIN_A15
#define PC6 37
#define PC7 38
#define PC8 39
#define PC9 40
#define PC10 41
#define PC11 42
#define PC12 43
#define PC13 44
#define PC14 45
#define PC15 46
#define PD2 47
#define PH0 48
#define PH1 49
// Alternate pins number
#define PA0_ALT1 (PA0 | ALT1)
#define PA1_ALT1 (PA1 | ALT1)
#define PA2_ALT1 (PA2 | ALT1)
#define PA2_ALT2 (PA2 | ALT2)
#define PA3_ALT1 (PA3 | ALT1)
#define PA3_ALT2 (PA3 | ALT2)
#define PA4_ALT1 (PA4 | ALT1)
#define PA7_ALT1 (PA7 | ALT1)
#define PA15_ALT1 (PA15 | ALT1)
#define PB0_ALT1 (PB0 | ALT1)
#define PB1_ALT1 (PB1 | ALT1)
#define PB3_ALT1 (PB3 | ALT1)
#define PB4_ALT1 (PB4 | ALT1)
#define PB5_ALT1 (PB5 | ALT1)
#define PB8_ALT1 (PB8 | ALT1)
#define PB9_ALT1 (PB9 | ALT1)
#define NUM_DIGITAL_PINS 50
#define NUM_ANALOG_INPUTS 16
#define NUM_ANALOG_FIRST 192
// On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PNUM_NOT_DEFINED
#endif
// On-board user button
#ifndef USER_BTN
#define USER_BTN PNUM_NOT_DEFINED
#endif
// SPI definitions
#ifndef PIN_SPI_SS
#define PIN_SPI_SS PA4
#endif
#ifndef PIN_SPI_SS1
#define PIN_SPI_SS1 PA15
#endif
#ifndef PIN_SPI_SS2
#define PIN_SPI_SS2 PNUM_NOT_DEFINED
#endif
#ifndef PIN_SPI_SS3
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
#endif
#ifndef PIN_SPI_MOSI
#define PIN_SPI_MOSI PA7
#endif
#ifndef PIN_SPI_MISO
#define PIN_SPI_MISO PA6
#endif
#ifndef PIN_SPI_SCK
#define PIN_SPI_SCK PA5
#endif
// I2C definitions
#ifndef PIN_WIRE_SDA
#define PIN_WIRE_SDA PB3
#endif
#ifndef PIN_WIRE_SCL
#define PIN_WIRE_SCL PB10
#endif
// Timer Definitions
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
#ifndef TIMER_TONE
#define TIMER_TONE TIM10
#endif
#ifndef TIMER_SERVO
#define TIMER_SERVO TIM11
#endif
// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 2
#endif
// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX PA3
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PA2
#endif
// Extra HAL modules
#if !defined(HAL_SD_MODULE_DISABLED)
#define HAL_SD_MODULE_ENABLED
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#ifndef SERIAL_PORT_MONITOR
#define SERIAL_PORT_MONITOR Serial
#endif
#ifndef SERIAL_PORT_HARDWARE
#define SERIAL_PORT_HARDWARE Serial
#endif
#endif

View File

@ -656,3 +656,21 @@ upload_protocol = jlink
extends = env:STM32F401RC_creality extends = env:STM32F401RC_creality
debug_tool = stlink debug_tool = stlink
upload_protocol = stlink upload_protocol = stlink
#
# BigTree SKR mini E3 V3.0.1 (STM32F401RCT6 ARM Cortex-M4)
#
[env:STM32F401RC_btt]
extends = stm32_variant
platform = ststm32@~14.1.0
platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip
board = marlin_STM32F401RC
board_build.offset = 0x4000
board_upload.offset_address = 0x08004000
build_flags = ${stm32_variant.build_flags}
-DPIN_SERIAL6_RX=PC_7 -DPIN_SERIAL6_TX=PC_6
-DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024
-DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4
-DSTEP_TIMER_IRQ_PRIO=0
upload_protocol = stlink
debug_tool = stlink