Skip to content

Commit 16acb57

Browse files
authored
✨ Creality v2.4.S4_170 (Ender 2 Pro, HC32F460KCTA) (MarlinFirmware#26730)
1 parent 04c8a31 commit 16acb57

File tree

4 files changed

+234
-0
lines changed

4 files changed

+234
-0
lines changed

Marlin/src/core/boards.h

+2
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,9 @@
519519
//
520520
// HC32 ARM Cortex-M4
521521
//
522+
522523
#define BOARD_AQUILA_V101 7200 // Voxelab Aquila V1.0.0/V1.0.1/V1.0.2/V1.0.3 as found in the Voxelab Aquila X2 and C2
524+
#define BOARD_CREALITY_ENDER2P_V24S4 7201 // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta)
523525

524526
//
525527
// Custom board
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* Based on Sprinter and grbl.
6+
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
#pragma once
23+
24+
//
25+
// Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta)
26+
// Derived from https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender2pro-hc32-2022.cfg
27+
//
28+
#include "env_validate.h"
29+
30+
#if HAS_MULTI_HOTEND || E_STEPPERS > 1
31+
#error "Creality v2.4.S4 only supports one hotend and E-stepper"
32+
#endif
33+
34+
#ifndef BOARD_INFO_NAME
35+
#define BOARD_INFO_NAME "Creality v2.4.S4"
36+
#endif
37+
#ifndef DEFAULT_MACHINE_NAME
38+
#define DEFAULT_MACHINE_NAME "Ender 2 Pro"
39+
#endif
40+
41+
//
42+
// Onboard crystal oscillator
43+
//
44+
#ifndef BOARD_XTAL_FREQUENCY
45+
#define BOARD_XTAL_FREQUENCY 8000000 // 8 MHz XTAL
46+
#endif
47+
48+
//
49+
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
50+
//
51+
//#define DISABLE_DEBUG
52+
//#define DISABLE_JTAG
53+
54+
//
55+
// EEPROM
56+
//
57+
#if NO_EEPROM_SELECTED
58+
#define IIC_BL24CXX_EEPROM
59+
//#define SDCARD_EEPROM_EMULATION
60+
#undef NO_EEPROM_SELECTED
61+
#endif
62+
63+
#if ENABLED(IIC_BL24CXX_EEPROM)
64+
#define IIC_EEPROM_SDA PA12
65+
#define IIC_EEPROM_SCL PA11
66+
#define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16)
67+
#elif ENABLED(SDCARD_EEPROM_EMULATION)
68+
#define MARLIN_EEPROM_SIZE 0x800 // 2K
69+
#endif
70+
71+
//
72+
// Servos
73+
//
74+
#ifndef SERVO0_PIN
75+
#define SERVO0_PIN PB0 // BLTouch OUT *
76+
#endif
77+
78+
//
79+
// Limit Switches
80+
//
81+
#define X_STOP_PIN PA5
82+
#define Y_STOP_PIN PA6
83+
#define Z_STOP_PIN PB0 // BLTOUCH *
84+
85+
#ifndef Z_MIN_PROBE_PIN
86+
#define Z_MIN_PROBE_PIN PB1 // BLTouch IN *
87+
#endif
88+
89+
//
90+
// Filament Runout Sensor
91+
//
92+
#ifndef FIL_RUNOUT_PIN
93+
#define FIL_RUNOUT_PIN PC15 // "Pulled-high" *
94+
#endif
95+
96+
//
97+
// Steppers
98+
//
99+
#define X_ENABLE_PIN PC2
100+
#define X_STEP_PIN PC1
101+
#define X_DIR_PIN PC0
102+
103+
#define Y_ENABLE_PIN PH2
104+
#define Y_STEP_PIN PB9
105+
#define Y_DIR_PIN PB8
106+
107+
#define Z_ENABLE_PIN PB7
108+
#define Z_STEP_PIN PB6
109+
#define Z_DIR_PIN PB5
110+
111+
#define E0_ENABLE_PIN PB4
112+
#define E0_STEP_PIN PB3
113+
#define E0_DIR_PIN PA15
114+
115+
//
116+
// Temperature Sensors
117+
//
118+
#define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15
119+
#define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14
120+
121+
//
122+
// Heaters / Fans
123+
//
124+
#define HEATER_0_PIN PA1 // HEATER1
125+
#define HEATER_BED_PIN PB10 // HOT BED
126+
127+
#define FAN0_PIN PA0 // FAN0
128+
129+
//
130+
// SD Card
131+
//
132+
#define SD_DETECT_PIN PA10
133+
#define ONBOARD_SPI_DEVICE 1
134+
#define ONBOARD_SD_CS_PIN PC3 // SDSS
135+
#define ONBOARD_SDIO
136+
#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer
137+
138+
#ifndef LCD_SERIAL_PORT
139+
#define LCD_SERIAL_PORT 1
140+
#endif
141+
142+
//
143+
// SDIO Pins
144+
//
145+
#define BOARD_SDIO_D0 PC8
146+
#define BOARD_SDIO_D1 PC9
147+
#define BOARD_SDIO_D2 PC10
148+
#define BOARD_SDIO_D3 PC11
149+
#define BOARD_SDIO_CLK PC12
150+
#define BOARD_SDIO_CMD PD2
151+
#define BOARD_SDIO_DET PA10
152+
153+
//
154+
// USART Pins
155+
//
156+
157+
// Display
158+
#define BOARD_USART1_TX_PIN PA2 // LCD
159+
#define BOARD_USART1_RX_PIN PA3
160+
161+
// Host
162+
#define BOARD_USART2_TX_PIN PA8 // USB
163+
#define BOARD_USART2_RX_PIN PA7
164+
165+
// Onboard LED (HIGH = off, LOW = on)
166+
#ifndef LED_BUILTIN
167+
#define LED_BUILTIN PC3
168+
#endif
169+
170+
#define BOARD_NO_NATIVE_USB
171+
172+
//
173+
// SPI3 Pins (LCD)
174+
//
175+
#define SPI_NSS PB15 // SPI3_NSS
176+
#define SPI_SCK PB14 // SPI3_CLK
177+
#define SPI_MISO PB13 // SPI3_MISO
178+
#define SPI_MOSI PB12 // SPI3_MOSI
179+
180+
//
181+
// LCD / Controller
182+
//
183+
184+
/** ------
185+
* PC6 | 1 2 | PC7
186+
* PA2 | 3 4 | PC1
187+
* PB13 5 6 | PB14
188+
* PB15 | 7 8 | PB12
189+
* GND | 9 10 | 5V
190+
* ------
191+
* EXP1
192+
*/
193+
#define EXP1_01_PIN PC6
194+
#define EXP1_02_PIN PC7
195+
#define EXP1_03_PIN PA2
196+
#define EXP1_04_PIN PC1
197+
#define EXP1_05_PIN PB13
198+
#define EXP1_06_PIN PB14
199+
#define EXP1_07_PIN PB15
200+
#define EXP1_08_PIN PB12
201+
202+
#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2
203+
/** ------
204+
* BEEPER | 1 2 | ENC
205+
* EN1 | 3 4 | KILL
206+
* EN2 5 6 | LCD_D4
207+
* LCD_RS | 7 8 | LCD_EN
208+
* GND | 9 10 | 5V
209+
* ------
210+
*/
211+
#define BEEPER_PIN EXP1_01_PIN
212+
213+
#define BTN_ENC EXP1_02_PIN
214+
#define BTN_EN1 EXP1_03_PIN
215+
#define BTN_EN2 EXP1_05_PIN
216+
217+
#define LCD_PINS_RS EXP1_07_PIN
218+
#define LCD_PINS_EN EXP1_08_PIN
219+
#define LCD_PINS_D4 EXP1_06_PIN
220+
221+
#define KILL_PIN EXP1_04_PIN
222+
#endif

Marlin/src/pins/pins.h

+3
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,11 @@
900900
//
901901
// HC32 ARM Cortex-M4
902902
//
903+
903904
#elif MB(AQUILA_V101)
904905
#include "hc32f4/pins_AQUILA_101.h" // HC32F460 env:HC32F460C_aquila_101
906+
#elif MB(CREALITY_ENDER2P_V24S4)
907+
#include "hc32f4/pins_CREALITY_ENDER2P_V24S4.h" // HC32F460 env:HC32F460C_e2p24s4
905908

906909
//
907910
// Custom board (with custom PIO env)

ini/hc32.ini

+7
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ board_build.ld_args.flash_size = 512K
8585
extends = HC32F460C_base
8686
board_build.ld_args.flash_start = 0xC000 # Bootloader start address, as logged by the bootloader on boot
8787
board_build.ld_args.boot_mode = secondary # Save ~1.4k of flash by compiling as secondary firmware
88+
89+
#
90+
# Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) (256K Flash, 192K RAM).
91+
#
92+
[env:HC32F460C_e2p24s4]
93+
extends = HC32F460C_base
94+
board_build.ld_args.flash_start = 0x8000

0 commit comments

Comments
 (0)