From 8fb9b5804e1ff91c4f5d94493db8924a063b0659 Mon Sep 17 00:00:00 2001 From: Muhammad Arslan <55940958+arslan437@users.noreply.github.com> Date: Thu, 11 May 2023 18:18:24 +0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Blackpill-based=20custom=20board=20?= =?UTF-8?q?(#25152)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: striker --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 8 - .../src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h | 140 ++++++++++++++++++ Marlin/src/pins/stm32f4/pins_TRONXY_V10.h | 7 - ini/stm32f4.ini | 10 ++ 6 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 691b03ed0ac..3820ef8a07c 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -451,6 +451,7 @@ #define BOARD_MKS_SKIPR_V1 5244 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) #define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE) #define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 +#define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6. // // ARM Cortex-M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 5bf3b088100..369506a7487 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -792,6 +792,8 @@ #include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy #elif MB(CREALITY_F401RE) #include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality +#elif MB(BLACKPILL_CUSTOM) + #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 6cb4d48d58c..3d0a1885af7 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -299,11 +299,3 @@ #define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3 #define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK #define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD - -// SDIO pins -#define SDIO_D0_PIN PC8 -#define SDIO_D1_PIN PC9 -#define SDIO_D2_PIN PC10 -#define SDIO_D3_PIN PC11 -#define SDIO_CK_PIN PC12 -#define SDIO_CMD_PIN PD2 diff --git a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h new file mode 100644 index 00000000000..9049a553fb4 --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h @@ -0,0 +1,140 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +#include "env_validate.h" + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Custom Blackpill" +#endif + +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "SLA Printer" +#endif + +#define DISABLE_DEBUG false // DISABLE_(DEBUG|JTAG) is not supported for STM32F4. +#define ALLOW_STM32F4 +#define BOARD_NO_NATIVE_USB + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + //#define SDCARD_EEPROM_EMULATION +#endif + +// +// Servos +// +#if !defined(SERVO0_PIN) && !defined(HAS_PIN_27_BOARD) + #define SERVO0_PIN PC13 // BLTouch OUT +#endif + +#define LED_PIN PC13 + +// +// Limit Switches +// +#define Z_STOP_PIN PA15 +#define X_STOP_PIN PA11 +#define Y_STOP_PIN PA12 + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN PB15 // "Pulled-high" + +// +// Steppers +// +#define X_STEP_PIN PB0 +#define X_DIR_PIN PB1 +#define X_ENABLE_PIN PB2 // Shared + +#define Y_STEP_PIN PB3 +#define Y_DIR_PIN PB4 +#define Y_ENABLE_PIN X_ENABLE_PIN + +#define Z_STEP_PIN PB8 +#define Z_DIR_PIN PB5 +#define Z_ENABLE_PIN X_ENABLE_PIN + +#define E0_STEP_PIN PB9 +#define E0_DIR_PIN PB10 +#define E0_ENABLE_PIN X_ENABLE_PIN + +// +// Temperature Sensors +// +#define TEMP_0_PIN PA0 // TH1 +#define TEMP_BED_PIN PA1 // TB1 + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PA2 // HOT BED +#define FAN1_PIN PA8 // extruder fan +#define HEATER_0_PIN PA3 // HEATER1 + +// +// Encoder pins +// +#if ENABLED(OLED_PANEL_TINYBOY2) +#define BTN_EN1 PB12 +#define BTN_EN2 PB13 +#define BTN_ENC PB14 +#define BEEPER_PIN PC15 +#endif + +// +// SD Card +// +#define ONBOARD_SPI_DEVICE 1 +// #define ONBOARD_SD_CS_PIN PA4 // SDSS + +#define SD_DETECT_PIN -1 +#define SDCARD_CONNECTION ONBOARD +//#define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + +#if SD_CONNECTION_IS(ONBOARD) + #define SDSS PA4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 +#endif + +// Pins for documentation and sanity checks only. +// Changing these will not change the pin they are on. + +// Hardware UART pins +#define UART1_TX_PIN PA9 // default uses CH340 RX +#define UART1_RX_PIN PA10 // default uses CH340 TX +#define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN +#define UART2_RX_PIN PA3 // not connected +#define UART3_TX_PIN PB10 // default uses LCD connector +#define UART3_RX_PIN PB11 // default uses LCD connector +#define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2 +#define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3 +#define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK +#define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h index 1677b45697b..d5752e43dcc 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -255,10 +255,3 @@ #define SD_DETECT_PIN -1 // PF0, but not connected #define SDIO_CLOCK 4500000 #define SDIO_READ_RETRIES 16 - -#define SDIO_D0_PIN PC8 -#define SDIO_D1_PIN PC9 -#define SDIO_D2_PIN PC10 -#define SDIO_D3_PIN PC11 -#define SDIO_CK_PIN PC12 -#define SDIO_CMD_PIN PD2 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 29c3f5b9597..7dfffe47646 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -772,3 +772,13 @@ build_flags = ${stm32_variant.build_flags} -DSTM32F4xx build_unflags = ${stm32_variant.build_unflags} -fno-rtti -DUSBCON -DUSBD_USE_CDC + +# +# Blackpill +# +[env:STM32F401CD_blackpill_stlink] +platform = ${common_stm32.platform} +extends = common_stm32 +board = blackpill_f401cc +upload_protocol = stlink +monitor_speed = 115200