Skip to content

Commit

Permalink
✨ Blackpill-based custom board (MarlinFirmware#25152)
Browse files Browse the repository at this point in the history
Co-authored-by: striker <striker@gmail.com>
  • Loading branch information
2 people authored and oponyx committed May 11, 2023
1 parent 87d0c57 commit 135a3e4
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 15 deletions.
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
140 changes: 140 additions & 0 deletions Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
*/
#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
7 changes: 0 additions & 7 deletions Marlin/src/pins/stm32f4/pins_TRONXY_V10.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions ini/stm32f4.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 135a3e4

Please sign in to comment.