From 747b2b9bf45b4882c2b8c9c1186b399bf53b0421 Mon Sep 17 00:00:00 2001 From: Bob Kuhn Date: Wed, 1 Jan 2020 20:52:56 -0600 Subject: [PATCH] Improve STEVAL_3DP001V1 and future STEVAL_* support (#16404) --- Marlin/src/core/boards.h | 2 +- Marlin/src/inc/SanityCheck.h | 38 -- Marlin/src/pins/pins.h | 56 +- Marlin/src/pins/stm32/pins_STEVAL.h | 150 ------ Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h | 349 ++++++++++++ .../PlatformIO/boards/STEVAL_STM32F401VE.json | 65 +++ .../PlatformIO/scripts/STEVAL__F401XX.py | 11 + .../variants/STEVAL_F401VE/PeripheralPins.c | 274 ++++++++++ .../variants/STEVAL_F401VE/PinNamesVar.h | 33 ++ .../variants/STEVAL_F401VE/hal_conf_custom.h | 496 ++++++++++++++++++ .../variants/STEVAL_F401VE/ldscript.ld | 187 +++++++ .../variants/STEVAL_F401VE/variant.h | 315 +++++++++++ platformio.ini | 19 + 13 files changed, 1803 insertions(+), 192 deletions(-) delete mode 100644 Marlin/src/pins/stm32/pins_STEVAL.h create mode 100644 Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h create mode 100644 buildroot/share/PlatformIO/boards/STEVAL_STM32F401VE.json create mode 100644 buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py create mode 100644 buildroot/share/PlatformIO/variants/STEVAL_F401VE/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/STEVAL_F401VE/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/STEVAL_F401VE/hal_conf_custom.h create mode 100644 buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 5efa2dff2..0180268d7 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -303,7 +303,7 @@ #define BOARD_RUMBA32 4203 // RUMBA32 STM32F4-based controller #define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE #define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE -#define BOARD_STEVAL 4206 // STEVAL-3DP001V1 3D PRINTER BOARD +#define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD #define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG) #define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE) #define BOARD_LERDGE_K 4209 // Lerdge K (STM32F407ZG) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 04cd808f5..c43b6698b 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -426,44 +426,6 @@ #error "HOME_USING_SPREADCYCLE is now obsolete. Please remove it from Configuration_adv.h." #endif -#define BOARD_MKS_13 -1000 -#define BOARD_TRIGORILLA -1001 -#define BOARD_RURAMPS4D -1002 -#define BOARD_FORMBOT_TREX2 -1003 -#define BOARD_BIQU_SKR_V1_1 -1004 -#define BOARD_STM32F1R -1005 -#define BOARD_STM32F103R -1006 -#define BOARD_ESP32 -1007 -#define BOARD_BIGTREE_SKR_MINI_E3 -1008 -#if MB(MKS_13) - #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." -#elif MB(TRIGORILLA) - #error "BOARD_TRIGORILLA has been renamed BOARD_TRIGORILLA_13. Please update your configuration." -#elif MB(RURAMPS4D) - #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration." -#elif MB(FORMBOT_TREX2) - #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration." -#elif MB(BIQU_SKR_V1_1) - #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." -#elif MB(STM32F1R) - #error "BOARD_STM32F1R has been renamed BOARD_STM32F103RE. Please update your configuration." -#elif MB(STM32F103R) - #error "BOARD_STM32F103R has been renamed BOARD_STM32F103RE. Please update your configuration." -#elif MOTHERBOARD == BOARD_ESP32 - #error "BOARD_ESP32 has been renamed BOARD_ESPRESSIF_ESP32. Please update your configuration." -#elif MOTHERBOARD == BOARD_BIGTREE_SKR_MINI_E3 - #error "BOARD_BIGTREE_SKR_MINI_E3 has been renamed BOARD_BTT_SKR_MINI_E3_V1_0. Please update your configuration." -#endif -#undef BOARD_MKS_13 -#undef BOARD_TRIGORILLA -#undef BOARD_RURAMPS4D -#undef BOARD_FORMBOT_TREX2 -#undef BOARD_BIQU_SKR_V1_1 -#undef BOARD_STM32F1R -#undef BOARD_STM32F103R -#undef BOARD_ESP32 -#undef BOARD_BIGTREE_SKR_MINI_E3 - /** * Marlin release, version and default string */ diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 481bb1403..8f42f6bda 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -523,8 +523,8 @@ #include "stm32/pins_RUMBA32.h" // STM32F4 env:RUMBA32 #elif MB(BLACK_STM32F407VE) #include "stm32/pins_BLACK_STM32F407VE.h" // STM32F4 env:STM32F407VE_black -#elif MB(STEVAL) - #include "stm32/pins_STEVAL.h" // STM32F4 env:STM32F4 +#elif MB(STEVAL_3DP001V1) + #include "stm32/pins_STEVAL_3DP001V1.h" // STM32F4 env:STM32F401VE_STEVAL #elif MB(BIGTREE_SKR_PRO_V1_1) #include "stm32/pins_BTT_SKR_PRO_V1_1.h" // STM32F4 env:BIGTREE_SKR_PRO #elif MB(BIGTREE_BTT002_V1_0) @@ -571,7 +571,57 @@ #include "linux/pins_RAMPS_LINUX.h" // Linux env:linux_native #else - #error "Unknown MOTHERBOARD value set in Configuration.h" + + // + // Obsolete or unknown board + // + + #define BOARD_MKS_13 -1000 + #define BOARD_TRIGORILLA -1001 + #define BOARD_RURAMPS4D -1002 + #define BOARD_FORMBOT_TREX2 -1003 + #define BOARD_BIQU_SKR_V1_1 -1004 + #define BOARD_STM32F1R -1005 + #define BOARD_STM32F103R -1006 + #define BOARD_ESP32 -1007 + #define BOARD_BIGTREE_SKR_MINI_E3 -1008 + #define BOARD_STEVAL -1009 + + #if MB(MKS_13) + #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." + #elif MB(TRIGORILLA) + #error "BOARD_TRIGORILLA has been renamed BOARD_TRIGORILLA_13. Please update your configuration." + #elif MB(RURAMPS4D) + #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration." + #elif MB(FORMBOT_TREX2) + #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration." + #elif MB(BIQU_SKR_V1_1) + #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." + #elif MB(STM32F1R) + #error "BOARD_STM32F1R has been renamed BOARD_STM32F103RE. Please update your configuration." + #elif MB(STM32F103R) + #error "BOARD_STM32F103R has been renamed BOARD_STM32F103RE. Please update your configuration." + #elif MOTHERBOARD == BOARD_ESP32 + #error "BOARD_ESP32 has been renamed BOARD_ESPRESSIF_ESP32. Please update your configuration." + #elif MB(BIGTREE_SKR_MINI_E3) + #error "BOARD_BIGTREE_SKR_MINI_E3 has been renamed BOARD_BTT_SKR_MINI_E3_V1_0. Please update your configuration." + #elif MB(STEVAL) + #error "BOARD_STEVAL has been renamed BOARD_STEVAL_3DP001V1. Please update your configuration." + #else + #error "Unknown MOTHERBOARD value set in Configuration.h" + #endif + + #undef BOARD_MKS_13 + #undef BOARD_TRIGORILLA + #undef BOARD_RURAMPS4D + #undef BOARD_FORMBOT_TREX2 + #undef BOARD_BIQU_SKR_V1_1 + #undef BOARD_STM32F1R + #undef BOARD_STM32F103R + #undef BOARD_ESP32 + #undef BOARD_BIGTREE_SKR_MINI_E3 + #undef BOARD_STEVAL + #endif // Define certain undefined pins diff --git a/Marlin/src/pins/stm32/pins_STEVAL.h b/Marlin/src/pins/stm32/pins_STEVAL.h deleted file mode 100644 index 062981a1e..000000000 --- a/Marlin/src/pins/stm32/pins_STEVAL.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2019 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 - -#ifndef STM32F4 - #error "Oops! Select an STM32F4 board in 'Tools > Board.'" -#endif - -#ifndef MACHINE_NAME - #define MACHINE_NAME "STEVAL-3DP001V1" -#endif - -#undef TEMP_TIMER -#define TEMP_TIMER 9 // the Marlin default of timer 7 doesn't exist on the STM32MF401 series - -// -// Limit Switches -// -#define X_MIN_PIN 38 // PD8 X_STOP -#define X_MAX_PIN -1 -#define Y_MIN_PIN 39 // PD9 Y_STOP -#define Y_MAX_PIN -1 -#define Z_MIN_PIN 40 // PD10 Z_STOP -#define Z_MAX_PIN -1 - -// -// Z Probe (when not Z_MIN_PIN) -// -// #ifndef Z_MIN_PROBE_PIN -// #define Z_MIN_PROBE_PIN 11 // PA4 -// #endif - -#define SCK_PIN 16 // PB13 SPI_S -#define MISO_PIN 17 // PB14 SPI_M -#define MOSI_PIN 18 // PB15 SPI_M - -// -// Steppers -// - -#define X_STEP_PIN 60 // PE14 X_PWM -#define X_DIR_PIN 61 // PE15 X_DIR -#define X_ENABLE_PIN 59 // PE13 X_RES -#define X_CS_PIN 11 // PA4 SPI_CS - -#define Y_STEP_PIN 62 // PB10 Y_PWM -#define Y_DIR_PIN 63 // PE9 Y_DIR -#define Y_ENABLE_PIN 64 // PE10 Y_RES -#define Y_CS_PIN 11 // PA4 SPI_CS - -#define Z_STEP_PIN 66 // PC6 Z_PWM -#define Z_DIR_PIN 67 // PC0 Z_DIR -#define Z_ENABLE_PIN 65 // PC15 Z_RES -#define Z_CS_PIN 11 // PA4 SPI_CS - -#define E0_STEP_PIN 70 // PD12 E1_PW -#define E0_DIR_PIN 68 // PC13 E1_DIR -#define E0_ENABLE_PIN 69 // PC14 E1_RE -#define E0_CS_PIN 11 // PA4 SPI_CS - -#define E1_STEP_PIN 72 // PE5 E2_PWM -#define E1_DIR_PIN 73 // PE6 E2_DIR -#define E1_ENABLE_PIN 71 // PE4 E2_RESE -#define E1_CS_PIN 11 // PA4 SPI_CS - -#define E2_STEP_PIN 76 // PB8 E3_PWM -#define E2_DIR_PIN 74 // PE2 E3_DIR -#define E2_ENABLE_PIN 75 // PE3 E3_RESE -#define E2_CS_PIN 11 // PA4 SPI_CS - - -// -// Temperature Sensors -// -#define TEMP_0_PIN 52 // PA0 E1_THER -#define TEMP_1_PIN 53 // PA1 E2_THER -#define TEMP_BED_PIN 50 // PC2 BED_THE - -// -// Heaters / Fans -// -#define HEATER_0_PIN 52 // PA0 E1_THER -#define HEATER_1_PIN 53 // PA1 E2_THER -#define HEATER_BED_PIN 50 // PC2 BED_THE - -#define FAN_PIN 56 // PC4 E1_FAN PWM pin, Part cooling fan -#define FAN1_PIN 57 // PC5 E2_FAN PWM pin, Extruder fan -#define FAN2_PIN 58 // PE8 E3_FAN PWM pin, Controller fan - -// -// Misc functions -// -#define SDSS 11 // PA4 SPI_CS -#define LED_PIN -1 // Heart beat -#define PS_ON_PIN -1 -#define KILL_PIN -1 -#define PWR_LOSS -1 // Power loss / nAC_FAULT - -// -// LCD / Controller -// -//#define SD_DETECT_PIN 24 // PA15 SD_CA -//#define BEEPER_PIN 23 // PC9 SDIO_D1 -//#define LCD_PINS_RS 63 // PE9 Y_DIR -//#define LCD_PINS_ENABLE 58 // PE8 E3_FAN -//#define LCD_PINS_D4 15 // PB12 SPI_C -//#define LCD_PINS_D5 16 // PB13 SPI_S -//#define LCD_PINS_D6 17 // PB14 SPI_M -//#define LCD_PINS_D7 18 // PB15 SPI_M -//#define BTN_EN1 56 // PC4 E1_FAN -//#define BTN_EN2 57 // PC5 E2_FAN -//#define BTN_ENC 51 // PC3 BED_THE - -// -// Filament runout detection -// -//#define FIL_RUNOUT_PIN 55 // PA3 BED_THE - -// -// Extension pins -// -//#define EXT0_PIN 48 // PB0 E2_HEAT -//#define EXT1_PIN 49 // PB1 E3_HEAT -//#define EXT2_PIN // PB2 -//#define EXT3_PIN 38 // PD8 X_STOP -//#define EXT4_PIN 39 // PD9 Y_STOP -//#define EXT5_PIN 40 // PD10 Z_STOP -//#define EXT6_PIN 41 // PD11 -//#define EXT7_PIN 70 // PD12 E1_PW -//#define EXT8_PIN 62 // PB10 Y_PWM -//#define EXT9_PIN // PB11 diff --git a/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h b/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h new file mode 100644 index 000000000..92ef2f54c --- /dev/null +++ b/Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h @@ -0,0 +1,349 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2019 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 . + * + */ + +// This pin map came from https://github.com/stm32duino/Arduino_Core_STM32/blob/master/variants/ST3DP001_EVAL/variant.cpp + +/** + * HOW TO COMPILE + * + * PlatformIO - use the environment STM32F401VE_STEVAL. The AUTO BUILD script will automatically use that environment. + * + * Arduino - this has been tested under 1.8.10 + * Install library per https://github.com/stm32duino/Arduino_Core_STM32 + * Make the following selections under the TOOL menu in the Arduino IDE + * Board: "3D printer boards" + * Board part number: "STEVAL-3DP001V1" + * U(S)ART support: "Enabled (generic "Serial")" + * USB support (if available): "CDC (no generic "Serial")" + * Optimize: "Smallest (-Os default)" + * C Runtime Library: "newlib Nano (default)" + */ + +#pragma once + +#ifndef STM32F4 + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#ifndef MACHINE_NAME + #define MACHINE_NAME "STEVAL-3DP001V1" +#endif + +#undef TEMP_TIMER +#define TEMP_TIMER 9 // the Marlin default of timer 7 doesn't exist on the STM32MF401 series + + +// +// Limit Switches +// +#define X_MIN_PIN 39 // PD8 X_STOP +//#define X_MAX_PIN 44 // PD0 W_STOP +#define Y_MIN_PIN 40 // PD9 Y_STOP +//#define Y_MAX_PIN 43 // PA8 V_STOP +#define Z_MIN_PIN 41 // PD10 Z_STOP +//#define Z_MAX_PIN 42 // PD11 U_STOP + +// +// Z Probe (when not Z_MIN_PIN) +// +// #ifndef Z_MIN_PROBE_PIN +// #define Z_MIN_PROBE_PIN 16 // PA4 +// #endif + +#define SCK_PIN 13 // PB13 SPI_S +#define MISO_PIN 12 // PB14 SPI_M +#define MOSI_PIN 11 // PB15 SPI_M + + +#define L6470_CHAIN_SCK_PIN 17 // PA5 +#define L6470_CHAIN_MISO_PIN 18 // PA6 +#define L6470_CHAIN_MOSI_PIN 19 // PA7 +#define L6470_CHAIN_SS_PIN 16 // PA4 + +//#define SCK_PIN L6470_CHAIN_SCK_PIN +//#define MISO_PIN L6470_CHAIN_MISO_PIN +//#define MOSI_PIN L6470_CHAIN_MOSI_PIN + +// +// Steppers +// + +#define X_STEP_PIN 61 // PE14 X_PWM +#define X_DIR_PIN 62 // PE15 X_DIR +#define X_ENABLE_PIN 60 // PE13 X_RES +#define X_CS_PIN 16 // PA4 SPI_CS + +#define Y_STEP_PIN 64 // PB10 Y_PWM +#define Y_DIR_PIN 65 // PE9 Y_DIR +#define Y_ENABLE_PIN 63 // PE10 Y_RES +#define Y_CS_PIN 16 // PA4 SPI_CS + +#define Z_STEP_PIN 67 // PC6 Z_PWM +#define Z_DIR_PIN 68 // PC0 Z_DIR +#define Z_ENABLE_PIN 66 // PC15 Z_RES +#define Z_CS_PIN 16 // PA4 SPI_CS + +#define E0_STEP_PIN 71 // PD12 E1_PW +#define E0_DIR_PIN 70 // PC13 E1_DIR +#define E0_ENABLE_PIN 69 // PC14 E1_RE +#define E0_CS_PIN 16 // PA4 SPI_CS + +#define E1_STEP_PIN 73 // PE5 E2_PWM +#define E1_DIR_PIN 74 // PE6 E2_DIR +#define E1_ENABLE_PIN 72 // PE4 E2_RESE +#define E1_CS_PIN 16 // PA4 SPI_CS + +#define E2_STEP_PIN 77 // PB8 E3_PWM +#define E2_DIR_PIN 76 // PE2 E3_DIR +#define E2_ENABLE_PIN 75 // PE3 E3_RESE +#define E2_CS_PIN 16 // PA4 SPI_CS + +// needed to pass a sanity check +#define X2_CS_PIN 16 // PA4 SPI_CS +#define Y2_CS_PIN 16 // PA4 SPI_CS +#define Z2_CS_PIN 16 // PA4 SPI_CS +#define Z3_CS_PIN 16 // PA4 SPI_CS +#define E3_CS_PIN 16 // PA4 SPI_CS +#define E4_CS_PIN 16 // PA4 SPI_CS +#define E5_CS_PIN 16 // PA4 SPI_CS + +/** + * macro to reset/enable L6474 chips + * + * IMPORTANT - to disable (bypass) a L6474, install the corresponding + * resistor (R11 - R17) and change the "V" to zero for the + * corresponding pin. + */ +#define ENABLE_RESET_L64XX_CHIPS(V) do{OUT_WRITE(X_ENABLE_PIN, V);\ + OUT_WRITE(Y_ENABLE_PIN, V);\ + OUT_WRITE(Z_ENABLE_PIN, V);\ + OUT_WRITE(E0_ENABLE_PIN,V);\ + OUT_WRITE(E1_ENABLE_PIN,V);\ + OUT_WRITE(E2_ENABLE_PIN,V);\ + }while(0) + +// +// Temperature Sensors +// +#define TEMP_0_PIN 54 // PA0 E1_THERMISTOR +#define TEMP_1_PIN 55 // PA1 E2_THERMISTOR +#define TEMP_2_PIN 56 // PA2 E3_THERMISTOR +#define TEMP_BED_PIN 51 // PC2 BED_THERMISTOR_1 +#define TEMP_BED_1_PIN 52 // PC3 BED_THERMISTOR_2 +#define TEMP_BED_2_PIN 53 // PA3 BED_THERMISTOR_3 + + + + + +// +// Heaters / Fans +// +#define HEATER_0_PIN 48 // PC7 E1_HEAT_PWM +#define HEATER_1_PIN 49 // PB0 E2_HEAT_PWM +#define HEATER_2_PIN 50 // PB1 E3_HEAT_PWM +#define HEATER_BED_PIN 46 // PD14 BED_HEAT_1 FET +#define HEATER_BED_1_PIN 45 // PD13 BED_HEAT_2 FET +#define HEATER_BED_2_PIN 47 // PD15 BED_HEAT_3 FET + +#define FAN_PIN 57 // PC4 E1_FAN PWM pin, Part cooling fan FET +#define FAN1_PIN 58 // PC5 E2_FAN PWM pin, Extruder fan FET +#define ORIG_E0_AUTO_FAN_PIN FAN1_PIN +#define FAN2_PIN 59 // PE8 E3_FAN PWM pin, Controller fan FET + +// +// Misc functions +// +#define SDSS 16 // PA4 SPI_CS +#define LED_PIN -1 // 9 // PE1 green LED Heart beat +#define PS_ON_PIN -1 +#define KILL_PIN -1 +#define PWR_LOSS -1 // Power loss / nAC_FAULT + +// +// LCD / Controller +// +//#define SD_DETECT_PIN 66 // PA15 SD_CA +//#define BEEPER_PIN 24 // PC9 SDIO_D1 +//#define LCD_PINS_RS 65 // PE9 Y_DIR +//#define LCD_PINS_ENABLE 59 // PE8 E3_FAN +//#define LCD_PINS_D4 10 // PB12 SPI_C +//#define LCD_PINS_D5 13 // PB13 SPI_S +//#define LCD_PINS_D6 12 // PB14 SPI_M +//#define LCD_PINS_D7 11 // PB15 SPI_M +//#define BTN_EN1 57 // PC4 E1_FAN +//#define BTN_EN2 58 // PC5 E2_FAN +//#define BTN_ENC 52 // PC3 BED_THE + +// +// Filament runout detection +// +//#define FIL_RUNOUT_PIN 53 // PA3 BED_THE + +// +// Extension pins +// +//#define EXT0_PIN 49 // PB0 E2_HEAT +//#define EXT1_PIN 50 // PB1 E3_HEAT +//#define EXT2_PIN // PB2 not used (tied to ground) +//#define EXT3_PIN 39 // PD8 X_STOP +//#define EXT4_PIN 40 // PD9 Y_STOP +//#define EXT5_PIN 41 // PD10 Z_STOP +//#define EXT6_PIN 42 // PD11 +//#define EXT7_PIN 71 // PD12 E1_PW +//#define EXT8_PIN 64 // PB10 Y_PWM + + + +// WIFI +// #define 2 // PD3 //CTS +// #define 3 // PD4 //RTS +// #define 4 // PD5 //TX +// #define 5 // PD6 //RX +// #define 6 // PB5 //WIFI_WAKEUP +// #define 7 // PE11 //WIFI_RESET +// #define 8 // PE12 //WIFI_BOOT + + +// I2C USER +// #define 14 // PB7 //SDA +// #define 15 // PB6 //SCL + +// JTAG +// 20 // PA13 //JTAG_TMS/SWDIO +// 21 // PA14 //JTAG_TCK/SWCLK +// 22 // PB3 //JTAG_TDO/SWO + +// SDCARD +// #define 23 // PC8 //SDIO_D0 +// #define 24 // PC9 //SDIO_D1 +// #define 25 // PA15 //SD_CARD_DETECT +// #define 26 // PC10 //SDIO_D2 +// #define 27 // PC11 //SDIO_D3 +// #define 28 // PC12 //SDIO_CK +// #define 29 // PD2 //SDIO_CMD + +// OTG +// #define 30 // PA11 //OTG_DM +// #define 31 // PA12 //OTG_DP + +// USER_PINS +// #define 34 // PD7 //USER3 +// #define 35 // PB9 //USER1 +#define temp_bob_pin 36 // PE0 //USER2 +// #define 37 // PB4 //USER4 + +// USERKET +// #define 38 // PE7 //USER_BUTTON + + +// #define 0 // PA9 //TX +// #define 1 // PA10 //RX + + +// IR/PROBE +// #define 32 // PD1 //IR_OUT +// #define 33 // PC1 //IR_ON + + +/** + * logical pin vs. port/pin cross reference + * + * PA0 54 // E1_THERMISTOR PA9 0 //TX + * PA1 55 // E2_THERMISTOR PA10 1 //RX + * PA2 56 // E3_THERMISTOR PD3 2 // CTS + * PA3 53 // BED_THERMISTOR_3 PD4 3 // RTS + * PA4 16 // SPI_CS PD5 4 // TX + * PA5 17 // SPI_SCK PD6 5 // RX + * PA6 18 // SPI_MISO PB5 6 // WIFI_WAKEUP + * PA7 19 // SPI_MOSI PE11 7 // WIFI_RESET + * PA8 43 // V_STOP PE12 8 // WIFI_BOOT + * PA9 0 //TX PE1 9 // STATUS_LED + * PA10 1 //RX PB12 10 // SPI_CS + * PA11 30 //OTG_DM PB15 11 // SPI_MOSI + * PA12 31 //OTG_DP PB14 12 // SPI_MISO + * PA13 20 // JTAG_TMS/SWDIO PB13 13 // SPI_SCK + * PA14 21 // JTAG_TCK/SWCLK PB7 14 // SDA + * PA15 25 // SD_CARD_DETECT PB6 15 // SCL + * PB0 49 // E2_HEAT_PWM PA4 16 // SPI_CS + * PB1 50 // E3_HEAT_PWM PA5 17 // SPI_SCK + * PB3 22 // JTAG_TDO/SWO PA6 18 // SPI_MISO + * PB4 37 // USER4 PA7 19 // SPI_MOSI + * PB5 6 // WIFI_WAKEUP PA13 20 // JTAG_TMS/SWDIO + * PB6 15 // SCL PA14 21 // JTAG_TCK/SWCLK + * PB7 14 // SDA PB3 22 // JTAG_TDO/SWO + * PB8 77 // E3_PWM PC8 23 // SDIO_D0 + * PB9 35 // USER1 PC9 24 // SDIO_D1 + * PB10 64 // Y_PWM PA15 25 // SD_CARD_DETECT + * PB12 10 // SPI_CS PC10 26 // SDIO_D2 + * PB13 13 // SPI_SCK PC11 27 // SDIO_D3 + * PB14 12 // SPI_MISO PC12 28 // SDIO_CK + * PB15 11 // SPI_MOSI PD2 29 // SDIO_CMD + * PC0 68 // Z_DIR PA11 30 //OTG_DM + * PC1 33 //IR_ON PA12 31 //OTG_DP + * PC2 51 // BED_THERMISTOR_1 PD1 32 //IR_OUT + * PC3 52 // BED_THERMISTOR_2 PC1 33 //IR_ON + * PC4 57 // E1_FAN PD7 34 // USER3 + * PC5 58 // E2_FAN PB9 35 // USER1 + * PC6 67 // Z_PWM PE0 36 // USER2 + * PC7 48 // E1_HEAT_PWM PB4 37 // USER4 + * PC8 23 // SDIO_D0 PE7 38 // USER_BUTTON + * PC9 24 // SDIO_D1 PD8 39 // X_STOP + * PC10 26 // SDIO_D2 PD9 40 // Y_STOP + * PC11 27 // SDIO_D3 PD10 41 // Z_STOP + * PC12 28 // SDIO_CK PD11 42 // U_STOP + * PC13 70 // E1_DIR PA8 43 // V_STOP + * PC14 69 // E1_RESET PD0 44 // W_STOP + * PC15 66 // Z_RESET PD13 45 // BED_HEAT_2 + * PD0 44 // W_STOP PD14 46 // BED_HEAT_1 + * PD1 32 //IR_OUT PD15 47 // BED_HEAT_3 + * PD2 29 // SDIO_CMD PC7 48 // E1_HEAT_PWM + * PD3 2 // CTS PB0 49 // E2_HEAT_PWM + * PD4 3 // RTS PB1 50 // E3_HEAT_PWM + * PD5 4 // TX PC2 51 // BED_THERMISTOR_1 + * PD6 5 // RX PC3 52 // BED_THERMISTOR_2 + * PD7 34 // USER3 PA3 53 // BED_THERMISTOR_3 + * PD8 39 // X_STOP PA0 54 // E1_THERMISTOR + * PD9 40 // Y_STOP PA1 55 // E2_THERMISTOR + * PD10 41 // Z_STOP PA2 56 // E3_THERMISTOR + * PD11 42 // U_STOP PC4 57 // E1_FAN + * PD12 71 // E1_PWM PC5 58 // E2_FAN + * PD13 45 // BED_HEAT_2 PE8 59 // E3_FAN + * PD14 46 // BED_HEAT_1 PE13 60 // X_RESET + * PD15 47 // BED_HEAT_3 PE14 61 // X_PWM + * PE0 36 // USER2 PE15 62 // X_DIR + * PE1 9 // STATUS_LED PE10 63 // Y_RESET + * PE2 76 // E3_DIR PB10 64 // Y_PWM + * PE3 75 // E3_RESET PE9 65 // Y_DIR + * PE4 72 // E2_RESET PC15 66 // Z_RESET + * PE5 73 // E2_PWM PC6 67 // Z_PWM + * PE6 74 // E2_DIR PC0 68 // Z_DIR + * PE7 38 // USER_BUTTON PC14 69 // E1_RESET + * PE8 59 // E3_FAN PC13 70 // E1_DIR + * PE9 65 // Y_DIR PD12 71 // E1_PWM + * PE10 63 // Y_RESET PE4 72 // E2_RESET + * PE11 7 // WIFI_RESET PE5 73 // E2_PWM + * PE12 8 // WIFI_BOOT PE6 74 // E2_DIR + * PE13 60 // X_RESET PE3 75 // E3_RESET + * PE14 61 // X_PWM PE2 76 // E3_DIR + * PE15 62 // X_DIR PB8 77 // E3_PWM + */ diff --git a/buildroot/share/PlatformIO/boards/STEVAL_STM32F401VE.json b/buildroot/share/PlatformIO/boards/STEVAL_STM32F401VE.json new file mode 100644 index 000000000..bbfb3fdfa --- /dev/null +++ b/buildroot/share/PlatformIO/boards/STEVAL_STM32F401VE.json @@ -0,0 +1,65 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F401xx", + "f_cpu": "84000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "ldscript": "stm32f401xe.ld", + "mcu": "stm32f401vet6", + "variant": "STEVAL_F401VE" + }, + "debug": { + "jlink_device": "STM32F401VE", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32f4x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F401VE (96k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 98304, + "maximum_size": 514288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/evaluation-tools/steval-3dp001v1.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py b/buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py new file mode 100644 index 000000000..e132ff3af --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py @@ -0,0 +1,11 @@ +import os +Import("env") + +custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld") +for i, flag in enumerate(env["LINKFLAGS"]): + if "-Wl,-T" in flag: + env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script + elif flag == "-T": + env["LINKFLAGS"][i + 1] = custom_ld_script + + diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PeripheralPins.c b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PeripheralPins.c new file mode 100644 index 000000000..5335361a6 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PeripheralPins.c @@ -0,0 +1,274 @@ + +/* + ******************************************************************************* + * Copyright (c) 2019, 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 STM32F401V(D-E)Tx.xml + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Note: 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 + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_PWM[] = { + // {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PA_0, 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, 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, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + // {PA_2, 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, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + // {PA_3, 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, 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, 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, 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, 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, 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 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + // {PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + // {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + // {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + // {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + // {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + // {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + // {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#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)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {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)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {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)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {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)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {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, 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)}, + // {PD_6, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PE_6, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + // {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {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, 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)}, + // {PE_5, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + // {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {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, 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)}, + // {PD_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PE_2, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + // {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {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, 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, 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)}, + // {PE_4, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + // {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +//*** No CAN *** + +//*** No ETHERNET *** + +//*** No QUADSPI *** + +//*** USB *** + +#ifdef HAL_PCD_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 + +//*** No USB_OTG_HS *** +//*** 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 diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PinNamesVar.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PinNamesVar.h new file mode 100644 index 000000000..3082f8842 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/PinNamesVar.h @@ -0,0 +1,33 @@ +/* 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_SOF = PA_8, +USB_OTG_FS_VBUS = PA_9, +USB_OTG_FS_ID = PA_10, +USB_OTG_FS_DM = PA_11, +USB_OTG_FS_DP = PA_12, +#endif diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/hal_conf_custom.h new file mode 100644 index 000000000..400463342 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/hal_conf_custom.h @@ -0,0 +1,496 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 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 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_CUSTOM +#define __STM32F4xx_HAL_CONF_CUSTOM + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ + /** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +/* #define HAL_CAN_MODULE_ENABLED */ +/* #define HAL_CAN_LEGACY_MODULE_ENABLED */ +#define HAL_CRC_MODULE_ENABLED +/* #define HAL_CEC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +//#define HAL_DAC_MODULE_ENABLED +/* #define HAL_DCMI_MODULE_ENABLED */ +#define HAL_DMA_MODULE_ENABLED +/* #define HAL_DMA2D_MODULE_ENABLED */ +/* #define HAL_ETH_MODULE_ENABLED */ +#define HAL_FLASH_MODULE_ENABLED +/* #define HAL_NAND_MODULE_ENABLED */ +/* #define HAL_NOR_MODULE_ENABLED */ +/* #define HAL_PCCARD_MODULE_ENABLED */ +/* #define HAL_SRAM_MODULE_ENABLED */ +/* #define HAL_SDRAM_MODULE_ENABLED */ +/* #define HAL_HASH_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +/* #define HAL_EXTI_MODULE_ENABLED */ +#define HAL_I2C_MODULE_ENABLED +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_LTDC_MODULE_ENABLED */ +/* #define HAL_DSI_MODULE_ENABLED */ +#define HAL_PWR_MODULE_ENABLED +/* #define HAL_QSPI_MODULE_ENABLED */ +#define HAL_RCC_MODULE_ENABLED +/* #define HAL_RNG_MODULE_ENABLED */ +#define HAL_RTC_MODULE_ENABLED +/* #define HAL_SAI_MODULE_ENABLED */ +#define HAL_SD_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_CORTEX_MODULE_ENABLED +#ifndef HAL_PCD_MODULE_ENABLED + #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) +#endif +/* #define HAL_HCD_MODULE_ENABLED */ +/* #define HAL_FMPI2C_MODULE_ENABLED */ +/* #define HAL_SPDIFRX_MODULE_ENABLED */ +/* #define HAL_DFSDM_MODULE_ENABLED */ +/* #define HAL_LPTIM_MODULE_ENABLED */ +/* #define HAL_MMC_MODULE_ENABLED */ + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#ifndef HSE_VALUE +#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#ifndef HSE_STARTUP_TIMEOUT +#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#ifndef HSI_VALUE +#define HSI_VALUE 16000000U /*!< Value of the Internal oscillator in Hz */ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#ifndef LSI_VALUE +#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz */ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz +The real value may vary depending on the variations +in voltage and temperature. */ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#ifndef LSE_VALUE +#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#ifndef LSE_STARTUP_TIMEOUT +#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#ifndef EXTERNAL_CLOCK_VALUE +#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External oscillator in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#if !defined (VDD_VALUE) +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#endif +#if !defined (TICK_INT_PRIORITY) +#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */ +#endif +#if !defined (USE_RTOS) +#define USE_RTOS 0U +#endif +#if !defined (PREFETCH_ENABLE) +#define PREFETCH_ENABLE 1U +#endif +#if !defined (INSTRUCTION_CACHE_ENABLE) +#define INSTRUCTION_CACHE_ENABLE 1U +#endif +#if !defined (DATA_CACHE_ENABLE) +#define DATA_CACHE_ENABLE 1U +#endif + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ +#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#ifndef USE_SPI_CRC +#define USE_SPI_CRC 0U +#endif + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED +#include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED +#include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED +#include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED +#include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED +#include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED +#include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_CUSTOM_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld new file mode 100644 index 000000000..f20a047c6 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld @@ -0,0 +1,187 @@ +/* +***************************************************************************** +** +** File : ldscript.ld +** +** Abstract : Linker script for STM32F401RETx Device with +** 512KByte FLASH, 96KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20018000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .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 goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _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 left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h new file mode 100644 index 000000000..d93fc07db --- /dev/null +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h @@ -0,0 +1,315 @@ +/* + ******************************************************************************* + * Copyright (c) 2017, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ +#if defined(ARDUINO_STEVAL) + + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ +// USART1_MAIN +#define PA9 0 //TX +#define PA10 1 //RX + +// WIFI +#define PD3 2 // CTS +#define PD4 3 // RTS +#define PD5 4 // TX +#define PD6 5 // RX +#define PB5 6 // WIFI_WAKEUP +#define PE11 7 // WIFI_RESET +#define PE12 8 // WIFI_BOOT + +// STATUS_LED +#define PE1 9 // STATUS_LED + +// SPI USER +#define PB12 10 // SPI_CS +#define PB15 11 // SPI_MOSI +#define PB14 12 // SPI_MISO +#define PB13 13 // SPI_SCK + +// I2C USER +#define PB7 14 // SDA +#define PB6 15 // SCL + +// SPI +#define PA4 16 // SPI_CS +#define PA5 17 // SPI_SCK +#define PA6 18 // SPI_MISO +#define PA7 19 // SPI_MOSI + +// JTAG +#define PA13 20 // JTAG_TMS/SWDIO +#define PA14 21 // JTAG_TCK/SWCLK +#define PB3 22 // JTAG_TDO/SWO + +// SDCARD +#define PC8 23 // SDIO_D0 +#define PC9 24 // SDIO_D1 +#define PA15 25 // SD_CARD_DETECT +#define PC10 26 // SDIO_D2 +#define PC11 27 // SDIO_D3 +#define PC12 28 // SDIO_CK +#define PD2 29 // SDIO_CMD + +// OTG +#define PA11 30 //OTG_DM +#define PA12 31 //OTG_DP + +// IR/PROBE +#define PD1 32 //IR_OUT +#define PC1 33 //IR_ON + +// USER_PINS +#define PD7 34 // USER3 +#define PB9 35 // USER1 +#define PE0 36 // USER2 +#define PB4 37 // USER4 + +// USERKET +#define PE7 38 // USER_BUTTON + +// ENDSTOPS +#define PD8 39 // X_STOP +#define PD9 40 // Y_STOP +#define PD10 41 // Z_STOP +#define PD11 42 // U_STOP +#define PA8 43 // V_STOP +#define PD0 44 // W_STOP + +// HEATERS +#define PD13 45 // BED_HEAT_2 +#define PD14 46 // BED_HEAT_1 +#define PD15 47 // BED_HEAT_3 +#define PC7 48 // E1_HEAT_PWM +#define PB0 49 // E2_HEAT_PWM +#define PB1 50 // E3_HEAT_PWM + +// THERMISTOR +#define PC2 51 // BED_THERMISTOR_1 +#define PC3 52 // BED_THERMISTOR_2 +#define PA3 53 // BED_THERMISTOR_3 +#define PA0 54 // E1_THERMISTOR +#define PA1 55 // E2_THERMISTOR +#define PA2 56 // E3_THERMISTOR + +// FANS +#define PC4 57 // E1_FAN +#define PC5 58 // E2_FAN +#define PE8 59 // E3_FAN + +// X_MOTOR +#define PE13 60 // X_RESET +#define PE14 61 // X_PWM +#define PE15 62 // X_DIR + +// Y_MOTOR +#define PE10 63 // Y_RESET +#define PB10 64 // Y_PWM +#define PE9 65 // Y_DIR + +// Z_MOTOR +#define PC15 66 // Z_RESET +#define PC6 67 // Z_PWM +#define PC0 68 // Z_DIR + +// E1_MOTOR +#define PC14 69 // E1_RESET +#define PC13 70 // E1_DIR +#define PD12 71 // E1_PWM + +// E2_MOTOR +#define PE4 72 // E2_RESET +#define PE5 73 // E2_PWM +#define PE6 74 // E2_DIR + +// E3_MOTOR +#define PE3 75 // E3_RESET +#define PE2 76 // E3_DIR +#define PB8 77 // E3_PWM + +// This must be a literal +#define NUM_DIGITAL_PINS 78 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 6 +#define NUM_ANALOG_FIRST 51 + +// On-board LED pin number +#define LED_BUILTIN PE1 +#define LED_GREEN LED_BUILTIN + +// On-board user button +#define USER_BTN PE7 + +// UART Definitions +#define SERIAL_UART_INSTANCE 1 //Connected to ST-Link + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +/* SD detect signal */ +/* + * By default, R67 is not provided, so SD card detect is not used. + * Note: SD CD (pin 16 of expansion connector J23) can be connected + * to GND in order to be able to use SD_DETECT_PIN + */ +/*#define SD_DETECT_PIN PA15*/ + +/* HAL configuration */ +#define HSE_VALUE 25000000U + +/* Extra HAL modules */ +#define HAL_SD_MODULE_ENABLED + +#endif + +#ifdef __cplusplus +} // extern "C" +#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. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE Serial1 +#endif + +#endif // _VARIANT_ARDUINO_STM32_ + +// PA0 54 // E1_THERMISTOR +// PA1 55 // E2_THERMISTOR +// PA2 56 // E3_THERMISTOR +// PA3 53 // BED_THERMISTOR_3 +// PA4 16 // SPI_CS +// PA5 17 // SPI_SCK +// PA6 18 // SPI_MISO +// PA7 19 // SPI_MOSI +// PA8 43 // V_STOP +// PA9 0 //TX +// PA10 1 //RX +// PA11 30 //OTG_DM +// PA12 31 //OTG_DP +// PA13 20 // JTAG_TMS/SWDIO +// PA14 21 // JTAG_TCK/SWCLK +// PA15 25 // SD_CARD_DETECT +// PB0 49 // E2_HEAT_PWM +// PB1 50 // E3_HEAT_PWM +// PB3 22 // JTAG_TDO/SWO +// PB4 37 // USER4 +// PB5 6 // WIFI_WAKEUP +// PB6 15 // SCL +// PB7 14 // SDA +// PB8 77 // E3_PWM +// PB9 35 // USER1 +// PB10 64 // Y_PWM +// PB12 10 // SPI_CS +// PB13 13 // SPI_SCK +// PB14 12 // SPI_MISO +// PB15 11 // SPI_MOSI +// PC0 68 // Z_DIR +// PC1 33 //IR_ON +// PC2 51 // BED_THERMISTOR_1 +// PC3 52 // BED_THERMISTOR_2 +// PC4 57 // E1_FAN +// PC5 58 // E2_FAN +// PC6 67 // Z_PWM +// PC7 48 // E1_HEAT_PWM +// PC8 23 // SDIO_D0 +// PC9 24 // SDIO_D1 +// PC10 26 // SDIO_D2 +// PC11 27 // SDIO_D3 +// PC12 28 // SDIO_CK +// PC13 70 // E1_DIR +// PC14 69 // E1_RESET +// PC15 66 // Z_RESET +// PD0 44 // W_STOP +// PD1 32 //IR_OUT +// PD2 29 // SDIO_CMD +// PD3 2 // CTS +// PD4 3 // RTS +// PD5 4 // TX +// PD6 5 // RX +// PD7 34 // USER3 +// PD8 39 // X_STOP +// PD9 40 // Y_STOP +// PD10 41 // Z_STOP +// PD11 42 // U_STOP +// PD12 71 // E1_PWM +// PD13 45 // BED_HEAT_2 +// PD14 46 // BED_HEAT_1 +// PD15 47 // BED_HEAT_3 +// PE0 36 // USER2 +// PE1 9 // STATUS_LED +// PE2 76 // E3_DIR +// PE3 75 // E3_RESET +// PE4 72 // E2_RESET +// PE5 73 // E2_PWM +// PE6 74 // E2_DIR +// PE7 38 // USER_BUTTON +// PE8 59 // E3_FAN +// PE9 65 // Y_DIR +// PE10 63 // Y_RESET +// PE11 7 // WIFI_RESET +// PE12 8 // WIFI_BOOT +// PE13 60 // X_RESET +// PE14 61 // X_PWM +// PE15 62 // X_DIR diff --git a/platformio.ini b/platformio.ini index e89a476b0..3dc178241 100644 --- a/platformio.ini +++ b/platformio.ini @@ -581,6 +581,25 @@ src_filter = ${common.default_src_filter} + lib_ignore = Adafruit NeoPixel monitor_speed = 250000 +# +# STM32F401VE +# 'STEVAL-3DP001)' STM32F401VE board - https://www.st.com/en/evaluation-tools/steval-3dp001v1.html +# +[env:STM32F401VE_STEVAL] +platform = ststm32 +board = STEVAL_STM32F401VE +platform_packages = framework-arduinoststm32@>=3.10700.191028 +build_flags = ${common.build_flags} + -DTARGET_STM32F4 -DARDUINO_STEVAL -DSTM32F401xE + -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STEVAL_F401VE\" + -DDISABLE_GENERIC_SERIALUSB + -IMarlin/src/HAL/HAL_STM32 +build_unflags = -std=gnu++11 +extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py +lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, SoftwareSerial +src_filter = ${common.default_src_filter} + +monitor_speed = 250000 # # FLYF407ZG