From 2148ef022097f99886758ddfe1a6fee0466ef52d Mon Sep 17 00:00:00 2001 From: cesarweb Date: Thu, 25 Jan 2024 09:17:51 -0300 Subject: [PATCH 01/10] Added Support For Creality ender 2 pro boars cr-fdm-v2.4.s4.170 --- Marlin/Configuration.h | 84 +-- Marlin/Configuration_adv.h | 22 +- .../pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h | 494 ++++++++++++++++++ Marlin/src/pins/pins.h | 3 +- ini/hc32.ini | 6 + 5 files changed, 555 insertions(+), 54 deletions(-) create mode 100644 Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9a0cd1addc3c..e203b844cef4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -68,7 +68,7 @@ // Choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_RAMPS_14_EFB + #define MOTHERBOARD BOARD_CREALITY_ENDER2P_V24S4 #endif /** @@ -79,7 +79,7 @@ * * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ -#define SERIAL_PORT 0 +#define SERIAL_PORT 2 /** * Serial Port Baud Rate @@ -92,7 +92,7 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -#define BAUDRATE 250000 +#define BAUDRATE 115200 //#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate @@ -101,7 +101,7 @@ * Currently Ethernet (-2) is only supported on Teensy 4.1 boards. * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7] */ -//#define SERIAL_PORT_2 -1 +// #define SERIAL_PORT_2 3 //#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE /** @@ -636,7 +636,7 @@ #define HEATER_5_MAXTEMP 275 #define HEATER_6_MAXTEMP 275 #define HEATER_7_MAXTEMP 275 -#define BED_MAXTEMP 150 +#define BED_MAXTEMP 90 #define CHAMBER_MAXTEMP 60 /** @@ -680,9 +680,9 @@ #define DEFAULT_Ki_LIST { 1.08, 1.08 } #define DEFAULT_Kd_LIST { 114.00, 114.00 } #else - #define DEFAULT_Kp 22.20 - #define DEFAULT_Ki 1.08 - #define DEFAULT_Kd 114.00 + #define DEFAULT_Kp 19.98 + #define DEFAULT_Ki 0.88 + #define DEFAULT_Kd 50.29 #endif #else #define BANG_MAX 255 // Limit hotend current while in bang-bang mode; 255=full current @@ -762,7 +762,7 @@ * * With this option disabled, bang-bang will be used. BED_LIMIT_SWITCHING enables hysteresis. */ -//#define PIDTEMPBED +#define PIDTEMPBED #if ENABLED(PIDTEMPBED) //#define MIN_BED_POWER 0 @@ -770,9 +770,9 @@ // 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) // from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) - #define DEFAULT_bedKp 10.00 - #define DEFAULT_bedKi .023 - #define DEFAULT_bedKd 305.4 + #define DEFAULT_bedKp 462.10 + #define DEFAULT_bedKi 85.47 + #define DEFAULT_bedKd 624.59 // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #else @@ -830,7 +830,7 @@ #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) //#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay - #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of flash) @@ -854,7 +854,7 @@ * Note: For Bowden Extruders make this large enough to allow load/unload. */ #define PREVENT_LENGTHY_EXTRUDE -#define EXTRUDE_MAXLENGTH 200 +#define EXTRUDE_MAXLENGTH 1000 //=========================================================================== //======================== Thermal Runaway Protection ======================= @@ -1234,7 +1234,7 @@ * Override with M92 (when enabled below) * X, Y, Z [, I [, J [, K...]]], E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 93 } /** * Enable support for M92. Disable to save at least ~530 bytes of flash. @@ -1274,9 +1274,9 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts -#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves +#define DEFAULT_ACCELERATION 3000 // X, Y, Z ... and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z ... acceleration for travel (non printing) moves /** * Default Jerk limits (mm/s) @@ -1598,7 +1598,7 @@ #define Z_PROBE_FEEDRATE_FAST (4*60) // Feedrate (mm/min) for the "accurate" probe of each point -#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2) +#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 4) /** * Probe Activation Switch @@ -1645,7 +1645,7 @@ * A total of 2 does fast/slow probes with a weighted average. * A total of 3 or more adds more slow probes, taking the average. */ -//#define MULTIPLE_PROBING 2 +#define MULTIPLE_PROBING 3 //#define EXTRA_PROBING 1 /** @@ -1671,8 +1671,8 @@ #define Z_PROBE_LOW_POINT -2 // (mm) Farthest distance below the trigger-point to go before stopping // For M851 provide ranges for adjusting the X, Y, and Z probe offsets -//#define PROBE_OFFSET_XMIN -50 // (mm) -//#define PROBE_OFFSET_XMAX 50 // (mm) +//#define PROBE_OFFSET_XMIN -20 // (mm) +//#define PROBE_OFFSET_XMAX 20 // (mm) //#define PROBE_OFFSET_YMIN -50 // (mm) //#define PROBE_OFFSET_YMAX 50 // (mm) //#define PROBE_OFFSET_ZMIN -20 // (mm) @@ -1748,8 +1748,8 @@ // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #define INVERT_X_DIR false -#define INVERT_Y_DIR true -#define INVERT_Z_DIR false +#define INVERT_Y_DIR false +#define INVERT_Z_DIR true //#define INVERT_I_DIR false //#define INVERT_J_DIR false //#define INVERT_K_DIR false @@ -1819,16 +1819,16 @@ // @section geometry // The size of the printable area -#define X_BED_SIZE 200 -#define Y_BED_SIZE 200 +#define X_BED_SIZE 165 +#define Y_BED_SIZE 165 // Travel limits (linear=mm, rotational=°) after homing, corresponding to endstop positions. -#define X_MIN_POS 0 -#define Y_MIN_POS 0 +#define X_MIN_POS -18 +#define Y_MIN_POS -2 #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE #define Y_MAX_POS Y_BED_SIZE -#define Z_MAX_POS 200 +#define Z_MAX_POS 180 //#define I_MIN_POS 0 //#define I_MAX_POS 50 //#define J_MIN_POS 0 @@ -2116,7 +2116,7 @@ #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. - #define GRID_MAX_POINTS_X 3 + #define GRID_MAX_POINTS_X 4 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X // Probe along the Y axis, advancing X after each column @@ -2322,7 +2322,7 @@ #define XY_SIDE_AD 200 // Or, set the XY skew factor directly: - //#define XY_SKEW_FACTOR 0.0 + #define XY_SKEW_FACTOR 0.0 //#define SKEW_CORRECTION_FOR_Z #if ENABLED(SKEW_CORRECTION_FOR_Z) @@ -2356,7 +2356,7 @@ * M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes) * M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.) */ -//#define EEPROM_SETTINGS // Persistent storage with M500 and M501 +#define EEPROM_SETTINGS // Persistent storage with M500 and M501 //#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release! #define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save flash. #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load @@ -2395,14 +2395,14 @@ // Preheat Constants - Up to 10 are supported without changes // #define PREHEAT_1_LABEL "PLA" -#define PREHEAT_1_TEMP_HOTEND 180 -#define PREHEAT_1_TEMP_BED 70 +#define PREHEAT_1_TEMP_HOTEND 200 +#define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_TEMP_CHAMBER 35 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 -#define PREHEAT_2_TEMP_BED 110 +#define PREHEAT_2_TEMP_BED 80 #define PREHEAT_2_TEMP_CHAMBER 35 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -2646,7 +2646,7 @@ * SD Card support is disabled by default. If your controller has an SD slot, * you must uncomment the following option or it won't work. */ -//#define SDSUPPORT +#define SDSUPPORT /** * SD CARD: ENABLE CRC @@ -2726,7 +2726,7 @@ // // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // -//#define INDIVIDUAL_AXIS_HOMING_MENU +#define INDIVIDUAL_AXIS_HOMING_MENU //#define INDIVIDUAL_AXIS_HOMING_SUBMENU // @@ -2744,8 +2744,8 @@ // Note: Test audio output with the G-Code: // M300 S P // -//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 -//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 +#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +#define LCD_FEEDBACK_FREQUENCY_HZ 5000 // // Tone queue size, used to keep beeps from blocking execution. @@ -3037,11 +3037,11 @@ // // Factory display for Creality CR-10 / CR-7 / Ender-3 -// https://marlinfw.org/docs/hardware/controllers.html#cr10_stockdisplay +// https://www.aliexpress.com/item/32833148327.html // // Connect to EXP1 on RAMPS and compatible boards. // -//#define CR10_STOCKDISPLAY +#define CR10_STOCKDISPLAY // // Ender-2 OEM display, a variant of the MKS_MINI_12864 @@ -3179,7 +3179,7 @@ * - Plug the microSD card into the back of the display. * - Boot the display and wait for the update to complete. * - * :[ 'ORIGIN', 'FYSETC', 'HYPRECY', 'MKS', 'RELOADED', 'IA_CREALITY', 'E3S1PRO' ] + * :[ 'ORIGIN', 'FYSETC', 'HYPRECY', 'MKS', 'RELOADED', 'IA_CREALITY', 'E3S1PRO', 'CREALITY_TOUCH' ] */ //#define DGUS_LCD_UI ORIGIN #if DGUS_UI_IS(MKS) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 49eea39180f7..a88f301c9838 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -327,7 +327,7 @@ * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * below 2. */ - #define WATCH_TEMP_PERIOD 40 // (seconds) + #define WATCH_TEMP_PERIOD 20 // (seconds) #define WATCH_TEMP_INCREASE 2 // (°C) #endif @@ -459,7 +459,7 @@ #define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0 #else - #define PID_FAN_SCALING_LIN_FACTOR (0) // Power-loss due to cooling = Kf * (fan_speed) + #define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed) #define DEFAULT_Kf 10 // A constant value added to the PID-tuner #define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING #endif @@ -496,7 +496,7 @@ // Show Temperature ADC value // Enable for M105 to include ADC values read from temperature sensors. -//#define SHOW_TEMP_ADC_VALUES +#define SHOW_TEMP_ADC_VALUES /** * High Temperature Thermistor Support @@ -1253,8 +1253,8 @@ #define DISABLE_IDLE_E // Shut down all idle extruders // Default Minimum Feedrates for printing and travel moves -#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum feedrate. Set with M205 S. -#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum travel feedrate. Set with M205 T. +#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S. +#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T. // Minimum time that a segment needs to take as the buffer gets emptied #define DEFAULT_MINSEGMENTTIME 20000 // (µs) Set with M205 B. @@ -1529,7 +1529,7 @@ #endif // Include a page of printer information in the LCD Main Menu - //#define LCD_INFO_MENU + #define LCD_INFO_MENU #if ENABLED(LCD_INFO_MENU) //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages #endif @@ -1745,7 +1745,7 @@ */ //#define POWER_LOSS_RECOVERY #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) + #define PLR_ENABLED_DEFAULT true // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) //#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable) //#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default. @@ -2500,9 +2500,9 @@ // #define ARC_SUPPORT // Requires ~3226 bytes #if ENABLED(ARC_SUPPORT) - #define MIN_ARC_SEGMENT_MM 0.1 // (mm) Minimum length of each arc segment + #define MIN_ARC_SEGMENT_MM 1 // (mm) Minimum length of each arc segment #define MAX_ARC_SEGMENT_MM 1.0 // (mm) Maximum length of each arc segment - #define MIN_CIRCLE_SEGMENTS 72 // Minimum number of segments in a complete circle + #define MIN_CIRCLE_SEGMENTS 24 // Minimum number of segments in a complete circle //#define ARC_SEGMENTS_PER_SEC 50 // Use the feedrate to choose the segment length #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles @@ -4304,8 +4304,8 @@ * If you add more debug displays, be careful to avoid conflicts! */ #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row // If you experience stuttering, reboots, etc. this option can reveal how diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h new file mode 100644 index 000000000000..5c75d6d45652 --- /dev/null +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -0,0 +1,494 @@ +/** + * 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 + +// +// Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) +// +#include "env_validate.h" + +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 + #error "Creality v2.4.S4 only supports one hotend and E-stepper" +#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Creality v2.4.S4" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Ender 2 Pro" +#endif + +// +// Onboard crystal oscillator +// +#ifndef BOARD_XTAL_FREQUENCY + #define BOARD_XTAL_FREQUENCY 8000000 // 8 MHz XTAL +#endif + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +//#define DISABLE_DEBUG +//#define DISABLE_JTAG + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM + //#define SDCARD_EEPROM_EMULATION + #undef NO_EEPROM_SELECTED +#endif + +#if ENABLED(IIC_BL24CXX_EEPROM) + #define IIC_EEPROM_SDA PA12 + #define IIC_EEPROM_SCL PA11 + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) +#elif ENABLED(SDCARD_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800 // 2K +#endif + +// +// Servos +// +#ifndef SERVO0_PIN + #define SERVO0_PIN PB0 // BLTouch OUT * +#endif + +// +// Limit Switches +// +#define X_STOP_PIN PA5 +#define Y_STOP_PIN PA6 +#define Z_STOP_PIN PB0 // BLTOUCH * + +// #define X_MAX_PIN PA4 +#define Y_MAX_PIN -1 +#define Z_MAX_PIN -1 + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB1 // BLTouch IN * +#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PC15 // "Pulled-high" * +#endif + +// +// Steppers +// + #define X_ENABLE_PIN PC2 + #define X_STEP_PIN PC1 + #define X_DIR_PIN PC0 + + #define Y_ENABLE_PIN PH2 + #define Y_STEP_PIN PB9 + #define Y_DIR_PIN PB8 + + #define Z_ENABLE_PIN PB7 + #define Z_STEP_PIN PB6 + #define Z_DIR_PIN PB5 + + #define E0_ENABLE_PIN PB4 + #define E0_STEP_PIN PB3 + #define E0_DIR_PIN PA15 + + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 +#define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 +#define ADC_CHANNEL_COUNT 2u + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA1 // HEATER1 +#define HEATER_BED_PIN PB10 // HOT BED + +#define FAN0_PIN PA0 // FAN0 + +#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 + + + #define BEEPER_PIN PC6 //LCD_ENC + + + #define BTN_ENC PC7 //LCD_RST + #define BTN_EN1 PA2 // UART4-TX + #define BTN_EN2 PB13 // SPI MISO + + #define LCD_PINS_RS PB15//SPI3_NSS + #define LCD_PINS_EN PB12// SPI3_MOSI + #define LCD_PINS_D4 PB14// SPI3_CLK + +#endif + + +// ****** checked with klipper/config/printer-creality-ender2pro-hc32-2022.cfg ; https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender2pro-hc32-2022.cfg + +// +// SD Card +// +#define SD_DETECT_PIN PA10 +#define ONBOARD_SPI_DEVICE 1 +#define ONBOARD_SD_CS_PIN PC3 // SDSS +#define ONBOARD_SDIO +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + + #ifndef LCD_SERIAL_PORT + #define LCD_SERIAL_PORT 1 + #endif + +/* + * SDIO Pins + */ + #define BOARD_SDIO_D0 PC8 + #define BOARD_SDIO_D1 PC9 + #define BOARD_SDIO_D2 PC10 + #define BOARD_SDIO_D3 PC11 + #define BOARD_SDIO_CLK PC12 + #define BOARD_SDIO_CMD PD2 + #define BOARD_SDIO_DET PA10 + +// +// USART Pins +// + +// Display +#define BOARD_USART1_TX_PIN PA2// LCD +#define BOARD_USART1_RX_PIN PA3 + +// Host +#define BOARD_USART2_TX_PIN PA8//USB +#define BOARD_USART2_RX_PIN PA7 + + +// Onboard LED (HIGH = off, LOW = on) +#ifndef LED_BUILTIN + #define LED_BUILTIN PC3 +#endif + +#define BOARD_NO_NATIVE_USB + +/* + * SPI3 Pins (LCD) + */ + #define SPI_NSS PB15 //SPI3_NSS + #define SPI_SCK PB14 // SPI3_CLK + #define SPI_MISO PB13// SPI3_MISO + #define SPI_MOSI PB12 // SPI3_MOSI + + +// # This file contains pin mappings for the Creality Ender2 Pro +// # with the HC32F460. The board is CR-FDM-v2.5.S4.170 +// # To use this config, during "make menuconfig" select HC32F460 + +// # Flash this firmware by copying "out/klipper.bin" to a SD card +// # as /user/firmware.bin +// # Turn on the printer with the card inserted. + +// # See docs/Config_Reference.md for a description of parameters. + +// [stepper_x] +// step_pin: PC1 +// dir_pin: PC0 +// enable_pin: !PC2 +// microsteps: 16 +// rotation_distance: 40 +// endstop_pin: ^PA5 +// position_min: -20 +// position_endstop: -20 +// position_max: 165 +// homing_speed: 50 + +// [stepper_y] +// step_pin: PB9 +// dir_pin: PB8 +// enable_pin: !PH2 +// microsteps: 16 +// rotation_distance: 40 +// endstop_pin: ^PA6 +// position_min: -5 +// position_endstop: -5 +// position_max: 165 +// homing_speed: 50 + +// [stepper_z] +// step_pin: PB6 +// dir_pin: !PB5 +// enable_pin: !PB7 +// microsteps: 16 +// rotation_distance: 8 +// endstop_pin: ^PB0 +// position_endstop: 0.0 +// position_max: 180 + +// [extruder] +// max_extrude_only_distance: 100.0 +// step_pin: PB3 +// dir_pin: PA15 +// enable_pin: !PB4 +// microsteps: 16 +// rotation_distance: 27.53480577 +// nozzle_diameter: 0.400 +// filament_diameter: 1.750 +// heater_pin: PA1 +// sensor_pin: PC5 +// sensor_type: Generic 3950 +// control: pid +// pid_Kp: 29.634 +// pid_Ki: 2.102 +// pid_Kd: 104.459 +// min_temp: 0 +// max_temp: 260 + +// [heater_bed] +// heater_pin: PB10 +// sensor_type: Generic 3950 +// sensor_pin: PC4 +// control: pid +// pid_Kp: 72.921 +// pid_Ki: 1.594 +// pid_Kd: 834.031 +// min_temp: 0 +// max_temp: 80 + +// [fan] +// pin: PA0 + +// [mcu] +// serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 +// restart_method: command + +// [printer] +// kinematics: cartesian +// max_velocity: 300 +// max_accel: 3000 +// max_z_velocity: 5 +// max_z_accel: 100 + +// [display] +// lcd_type: st7920 +// cs_pin: PB15 +// sclk_pin: PB14 +// sid_pin: PB12 +// encoder_pins: ^PB13,^PA2 +// click_pin: ^!PC7 + + + // Data from kiel ".165 firmware version" + +// /** +// * CREALITY v4.2.7 (STM32F103) board pin assignments +// */ + +// #ifndef HC32F46x +// #error "Oops! Select an HC32F46x board in 'options > c/c++->defines.'" +// #endif + +// #if defined(CR10_STOCKDISPLAY) && !defined RET6_12864_LCD && !definedVET6_12864_LCD +// #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the Creality V4 controller." +// #endif + +// #if HOTENDS > 1 || E_STEPPERS > 1 +// #error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue." +// #endif + +// #define BOARD_INFO_NAME "Creality v2.4.S4" +// #define DEFAULT_MACHINE_NAME "Creality3D" + + + +// #define BOARD_NO_NATIVE_USB +// /* LED0 Port/Pin definition */ +// #define LED0 PC3 // TEST +// /* +// * SPI3 Pins +// */ +// #define SPI_NSS PB15 //SPI3_NSS +// #define SPI_SCK PB14 // SPI3_CLK +// #define SPI_MISO PB13// SPI3_MISO +// #define SPI_MOSI PB12 // SPI3_MOSI + +// /* +// * SDIO Pins +// */ +// #define BOARD_SDIO_D0 PC8 +// #define BOARD_SDIO_D1 PC9 +// #define BOARD_SDIO_D2 PC10 +// #define BOARD_SDIO_D3 PC11 +// #define BOARD_SDIO_CLK PC12 +// #define BOARD_SDIO_CMD PD2 +// #define BOARD_SDIO_DET PA10 + +// // USARTS + +// #define BOARD_USART2_TX_PIN PA8//USB +// #define BOARD_USART2_RX_PIN PA7 + +// #define BOARD_USART1_TX_PIN PA2// LCD +// #define BOARD_USART1_RX_PIN PA3 + +// // +// // EEPROM +// // +// #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 +// //#define SDCARD_EEPROM_EMULATION + +// #ifdef IIC_BL24CXX_EEPROM +// #define IIC_EEPROM_SDA PA12 +// #define IIC_EEPROM_SCL PA11 +// #define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16) +// #endif + +// // +// // Servos +// // +// #ifndef SERVO0_PIN +// #define SERVO0_PIN PB2 // BLTouch OUT PIN +// #endif + +// // +// // Limit Switches +// // +// #define X_STOP_PIN PA5 +// #define Y_STOP_PIN PA6 +// #define Z_STOP_PIN PB0 +// #define X_MAX_PIN PA4 +// #define Y_MAX_PIN -1 +// #define Z_MAX_PIN -1 + +// #ifndef Z_MIN_PROBE_PIN +// #define Z_MIN_PROBE_PIN PB1 // BLTouch IN +// #endif + +// // +// // Filament Runout Sensor +// // +// #ifndef FIL_RUNOUT_PIN +// #define FIL_RUNOUT_PIN PC15 // "Pulled-high" +// #endif + + +// // +// // Steppers +// // +// #define X_ENABLE_PIN PC2 +// #define X_STEP_PIN PC1 +// #define X_DIR_PIN PC0 + +// #define Y_ENABLE_PIN PH2 +// #define Y_STEP_PIN PB9 +// #define Y_DIR_PIN PB8 + +// #define Z_ENABLE_PIN PB7 +// #define Z_STEP_PIN PB6 +// #define Z_DIR_PIN PB5 + +// #define E0_ENABLE_PIN PB4 +// #define E0_STEP_PIN PB3 +// #define E0_DIR_PIN PA15 + +// // +// // Temperature Sensors +// // +// #define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 +// #define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 +// #define ADC_CHANNEL_COUNT 2u + +// // +// // Heaters / Fans +// // +// #define HEATER_0_PIN PA1 // HEATER1 +// #define HEATER_BED_PIN PB10 // HOT BED + +// #ifndef FAN_PIN +// #define FAN_PIN PA0 // FAN +// #endif +// #if PIN_EXISTS(FAN) +// #define FAN_SOFT_PWM +// #endif + +// // +// // SD Card +// // +// #define SD_DETECT_PIN PA10 +// #define SDCARD_CONNECTION ONBOARD +// #define ONBOARD_SPI_DEVICE 1 +// #define ONBOARD_SD_CS_PIN PC3 // SDSS +// #define SDIO_SUPPORT +// #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + + +// #if ENABLED(RET6_12864_LCD) + +// /* RET6 12864 LCD */ +// #define LCD_PINS_RS PB15//SPI3_NSS +// #define LCD_PINS_ENABLE PB12// SPI3_MOSI +// #define LCD_PINS_D4 PB14// SPI3_CLK + +// #define BTN_ENC PC7 //LCD_RST +// #define BTN_EN1 PA2 // UART4-TX +// #define BTN_EN2 PB13 // SPI MISO + +// #define BEEPER_PIN PC6 //LCD_ENC + +// #elif ENABLED(VET6_12864_LCD) + +// /* VET6 12864 LCD */ +// #define LCD_PINS_RS PA4 +// #define LCD_PINS_ENABLE PA7 +// #define LCD_PINS_D4 PA5 + +// #define BTN_ENC PC5 +// #define BTN_EN1 PB10 +// #define BTN_EN2 PA6 + +// #elif ENABLED(DWIN_CREALITY_LCD) + +// // RET6 DWIN ENCODER LCD +// #define BTN_ENC PB14 +// #define BTN_EN1 PB15 +// #define BTN_EN2 PB12 + +// //#define LCD_LED_PIN PB2 +// #ifndef BEEPER_PIN +// #define BEEPER_PIN PB13 +// #undef SPEAKER +// #endif + +// #elif ENABLED(DWIN_VET6_CREALITY_LCD) + +// // VET6 DWIN ENCODER LCD +// #define BTN_ENC PA6 +// #define BTN_EN1 PA7 +// #define BTN_EN2 PA4 + +// #define BEEPER_PIN PA5 + +// #endif + diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 71d663d1eaf3..19c9a713e648 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -902,7 +902,8 @@ // #elif MB(AQUILA_V101) #include "hc32f4/pins_AQUILA_101.h" // HC32F460 env:HC32F460C_aquila_101 - +#elif MB(CREALITY_ENDER2P_V24S4) + #include "hc32f4/pins_CREALITY_ENDER2P_V24S4.h" // HC32F460 env:HC32F460C_e2p24s4 // // Custom board (with custom PIO env) // diff --git a/ini/hc32.ini b/ini/hc32.ini index d25ef4e7be07..a0e11ca6c5e8 100644 --- a/ini/hc32.ini +++ b/ini/hc32.ini @@ -85,3 +85,9 @@ board_build.ld_args.flash_size = 512K extends = HC32F460C_base board_build.ld_args.flash_start = 0xC000 # Bootloader start address, as logged by the bootloader on boot board_build.ld_args.boot_mode = secondary # Save ~1.4k of flash by compiling as secondary firmware + +# +# Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) has 256 KB of flash and 192 KB of ram available. +# +[env:HC32F460C_e2p24s4] +extends = HC32F460C_base \ No newline at end of file From d35eae37be3cfcb84b1525cf9fa83eb99cf3ba08 Mon Sep 17 00:00:00 2001 From: cesarweb Date: Thu, 25 Jan 2024 09:21:20 -0300 Subject: [PATCH 02/10] Added board_build.ld_args.flash_start --- ini/hc32.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ini/hc32.ini b/ini/hc32.ini index a0e11ca6c5e8..c3e847c4c47e 100644 --- a/ini/hc32.ini +++ b/ini/hc32.ini @@ -90,4 +90,5 @@ board_build.ld_args.boot_mode = secondary # Save ~1.4k of flash by compiling a # Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) has 256 KB of flash and 192 KB of ram available. # [env:HC32F460C_e2p24s4] -extends = HC32F460C_base \ No newline at end of file +extends = HC32F460C_base +board_build.ld_args.flash_start = 0x8000 \ No newline at end of file From 4c1e2ac0021d3c14a6f8a552fc7f9f23b5cf5714 Mon Sep 17 00:00:00 2001 From: cesarweb Date: Thu, 25 Jan 2024 09:33:09 -0300 Subject: [PATCH 03/10] added boards.h --- Marlin/src/core/boards.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 91141b23f99f..b07bdc4a4feb 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -520,7 +520,7 @@ // HC32 ARM Cortex-M4 // #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 - +#define BOARD_CREALITY_ENDER2P_V24S4 7201 // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta). // // Custom board // From 2b9780c2b2bfe8e7911f5679cd54687c97df79ab Mon Sep 17 00:00:00 2001 From: cesarweb Date: Thu, 25 Jan 2024 11:25:08 -0300 Subject: [PATCH 04/10] revert changes in CONFIGURATION_H and CONFIGURATION_ADV_H --- Marlin/Configuration.h | 84 +++++++++++++++++++------------------- Marlin/Configuration_adv.h | 22 +++++----- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e203b844cef4..9a0cd1addc3c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -68,7 +68,7 @@ // Choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_CREALITY_ENDER2P_V24S4 + #define MOTHERBOARD BOARD_RAMPS_14_EFB #endif /** @@ -79,7 +79,7 @@ * * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ -#define SERIAL_PORT 2 +#define SERIAL_PORT 0 /** * Serial Port Baud Rate @@ -92,7 +92,7 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -#define BAUDRATE 115200 +#define BAUDRATE 250000 //#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate @@ -101,7 +101,7 @@ * Currently Ethernet (-2) is only supported on Teensy 4.1 boards. * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7] */ -// #define SERIAL_PORT_2 3 +//#define SERIAL_PORT_2 -1 //#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE /** @@ -636,7 +636,7 @@ #define HEATER_5_MAXTEMP 275 #define HEATER_6_MAXTEMP 275 #define HEATER_7_MAXTEMP 275 -#define BED_MAXTEMP 90 +#define BED_MAXTEMP 150 #define CHAMBER_MAXTEMP 60 /** @@ -680,9 +680,9 @@ #define DEFAULT_Ki_LIST { 1.08, 1.08 } #define DEFAULT_Kd_LIST { 114.00, 114.00 } #else - #define DEFAULT_Kp 19.98 - #define DEFAULT_Ki 0.88 - #define DEFAULT_Kd 50.29 + #define DEFAULT_Kp 22.20 + #define DEFAULT_Ki 1.08 + #define DEFAULT_Kd 114.00 #endif #else #define BANG_MAX 255 // Limit hotend current while in bang-bang mode; 255=full current @@ -762,7 +762,7 @@ * * With this option disabled, bang-bang will be used. BED_LIMIT_SWITCHING enables hysteresis. */ -#define PIDTEMPBED +//#define PIDTEMPBED #if ENABLED(PIDTEMPBED) //#define MIN_BED_POWER 0 @@ -770,9 +770,9 @@ // 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) // from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) - #define DEFAULT_bedKp 462.10 - #define DEFAULT_bedKi 85.47 - #define DEFAULT_bedKd 624.59 + #define DEFAULT_bedKp 10.00 + #define DEFAULT_bedKi .023 + #define DEFAULT_bedKd 305.4 // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #else @@ -830,7 +830,7 @@ #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) //#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay - #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of flash) @@ -854,7 +854,7 @@ * Note: For Bowden Extruders make this large enough to allow load/unload. */ #define PREVENT_LENGTHY_EXTRUDE -#define EXTRUDE_MAXLENGTH 1000 +#define EXTRUDE_MAXLENGTH 200 //=========================================================================== //======================== Thermal Runaway Protection ======================= @@ -1234,7 +1234,7 @@ * Override with M92 (when enabled below) * X, Y, Z [, I [, J [, K...]]], E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 93 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 } /** * Enable support for M92. Disable to save at least ~530 bytes of flash. @@ -1274,9 +1274,9 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ -#define DEFAULT_ACCELERATION 3000 // X, Y, Z ... and E acceleration for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts -#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z ... acceleration for travel (non printing) moves +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves /** * Default Jerk limits (mm/s) @@ -1598,7 +1598,7 @@ #define Z_PROBE_FEEDRATE_FAST (4*60) // Feedrate (mm/min) for the "accurate" probe of each point -#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 4) +#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2) /** * Probe Activation Switch @@ -1645,7 +1645,7 @@ * A total of 2 does fast/slow probes with a weighted average. * A total of 3 or more adds more slow probes, taking the average. */ -#define MULTIPLE_PROBING 3 +//#define MULTIPLE_PROBING 2 //#define EXTRA_PROBING 1 /** @@ -1671,8 +1671,8 @@ #define Z_PROBE_LOW_POINT -2 // (mm) Farthest distance below the trigger-point to go before stopping // For M851 provide ranges for adjusting the X, Y, and Z probe offsets -//#define PROBE_OFFSET_XMIN -20 // (mm) -//#define PROBE_OFFSET_XMAX 20 // (mm) +//#define PROBE_OFFSET_XMIN -50 // (mm) +//#define PROBE_OFFSET_XMAX 50 // (mm) //#define PROBE_OFFSET_YMIN -50 // (mm) //#define PROBE_OFFSET_YMAX 50 // (mm) //#define PROBE_OFFSET_ZMIN -20 // (mm) @@ -1748,8 +1748,8 @@ // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #define INVERT_X_DIR false -#define INVERT_Y_DIR false -#define INVERT_Z_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR false //#define INVERT_I_DIR false //#define INVERT_J_DIR false //#define INVERT_K_DIR false @@ -1819,16 +1819,16 @@ // @section geometry // The size of the printable area -#define X_BED_SIZE 165 -#define Y_BED_SIZE 165 +#define X_BED_SIZE 200 +#define Y_BED_SIZE 200 // Travel limits (linear=mm, rotational=°) after homing, corresponding to endstop positions. -#define X_MIN_POS -18 -#define Y_MIN_POS -2 +#define X_MIN_POS 0 +#define Y_MIN_POS 0 #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE #define Y_MAX_POS Y_BED_SIZE -#define Z_MAX_POS 180 +#define Z_MAX_POS 200 //#define I_MIN_POS 0 //#define I_MAX_POS 50 //#define J_MIN_POS 0 @@ -2116,7 +2116,7 @@ #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. - #define GRID_MAX_POINTS_X 4 + #define GRID_MAX_POINTS_X 3 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X // Probe along the Y axis, advancing X after each column @@ -2322,7 +2322,7 @@ #define XY_SIDE_AD 200 // Or, set the XY skew factor directly: - #define XY_SKEW_FACTOR 0.0 + //#define XY_SKEW_FACTOR 0.0 //#define SKEW_CORRECTION_FOR_Z #if ENABLED(SKEW_CORRECTION_FOR_Z) @@ -2356,7 +2356,7 @@ * M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes) * M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.) */ -#define EEPROM_SETTINGS // Persistent storage with M500 and M501 +//#define EEPROM_SETTINGS // Persistent storage with M500 and M501 //#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release! #define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save flash. #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load @@ -2395,14 +2395,14 @@ // Preheat Constants - Up to 10 are supported without changes // #define PREHEAT_1_LABEL "PLA" -#define PREHEAT_1_TEMP_HOTEND 200 -#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_TEMP_HOTEND 180 +#define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_TEMP_CHAMBER 35 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 -#define PREHEAT_2_TEMP_BED 80 +#define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_TEMP_CHAMBER 35 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -2646,7 +2646,7 @@ * SD Card support is disabled by default. If your controller has an SD slot, * you must uncomment the following option or it won't work. */ -#define SDSUPPORT +//#define SDSUPPORT /** * SD CARD: ENABLE CRC @@ -2726,7 +2726,7 @@ // // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // -#define INDIVIDUAL_AXIS_HOMING_MENU +//#define INDIVIDUAL_AXIS_HOMING_MENU //#define INDIVIDUAL_AXIS_HOMING_SUBMENU // @@ -2744,8 +2744,8 @@ // Note: Test audio output with the G-Code: // M300 S P // -#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 -#define LCD_FEEDBACK_FREQUENCY_HZ 5000 +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 // // Tone queue size, used to keep beeps from blocking execution. @@ -3037,11 +3037,11 @@ // // Factory display for Creality CR-10 / CR-7 / Ender-3 -// https://www.aliexpress.com/item/32833148327.html +// https://marlinfw.org/docs/hardware/controllers.html#cr10_stockdisplay // // Connect to EXP1 on RAMPS and compatible boards. // -#define CR10_STOCKDISPLAY +//#define CR10_STOCKDISPLAY // // Ender-2 OEM display, a variant of the MKS_MINI_12864 @@ -3179,7 +3179,7 @@ * - Plug the microSD card into the back of the display. * - Boot the display and wait for the update to complete. * - * :[ 'ORIGIN', 'FYSETC', 'HYPRECY', 'MKS', 'RELOADED', 'IA_CREALITY', 'E3S1PRO', 'CREALITY_TOUCH' ] + * :[ 'ORIGIN', 'FYSETC', 'HYPRECY', 'MKS', 'RELOADED', 'IA_CREALITY', 'E3S1PRO' ] */ //#define DGUS_LCD_UI ORIGIN #if DGUS_UI_IS(MKS) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a88f301c9838..49eea39180f7 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -327,7 +327,7 @@ * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * below 2. */ - #define WATCH_TEMP_PERIOD 20 // (seconds) + #define WATCH_TEMP_PERIOD 40 // (seconds) #define WATCH_TEMP_INCREASE 2 // (°C) #endif @@ -459,7 +459,7 @@ #define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0 #else - #define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed) + #define PID_FAN_SCALING_LIN_FACTOR (0) // Power-loss due to cooling = Kf * (fan_speed) #define DEFAULT_Kf 10 // A constant value added to the PID-tuner #define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING #endif @@ -496,7 +496,7 @@ // Show Temperature ADC value // Enable for M105 to include ADC values read from temperature sensors. -#define SHOW_TEMP_ADC_VALUES +//#define SHOW_TEMP_ADC_VALUES /** * High Temperature Thermistor Support @@ -1253,8 +1253,8 @@ #define DISABLE_IDLE_E // Shut down all idle extruders // Default Minimum Feedrates for printing and travel moves -#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S. -#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T. +#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum feedrate. Set with M205 S. +#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum travel feedrate. Set with M205 T. // Minimum time that a segment needs to take as the buffer gets emptied #define DEFAULT_MINSEGMENTTIME 20000 // (µs) Set with M205 B. @@ -1529,7 +1529,7 @@ #endif // Include a page of printer information in the LCD Main Menu - #define LCD_INFO_MENU + //#define LCD_INFO_MENU #if ENABLED(LCD_INFO_MENU) //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages #endif @@ -1745,7 +1745,7 @@ */ //#define POWER_LOSS_RECOVERY #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_ENABLED_DEFAULT true // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) + #define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) //#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable) //#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default. @@ -2500,9 +2500,9 @@ // #define ARC_SUPPORT // Requires ~3226 bytes #if ENABLED(ARC_SUPPORT) - #define MIN_ARC_SEGMENT_MM 1 // (mm) Minimum length of each arc segment + #define MIN_ARC_SEGMENT_MM 0.1 // (mm) Minimum length of each arc segment #define MAX_ARC_SEGMENT_MM 1.0 // (mm) Maximum length of each arc segment - #define MIN_CIRCLE_SEGMENTS 24 // Minimum number of segments in a complete circle + #define MIN_CIRCLE_SEGMENTS 72 // Minimum number of segments in a complete circle //#define ARC_SEGMENTS_PER_SEC 50 // Use the feedrate to choose the segment length #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles @@ -4304,8 +4304,8 @@ * If you add more debug displays, be careful to avoid conflicts! */ #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row // If you experience stuttering, reboots, etc. this option can reveal how From d727f17d94038a306872d0661fb075743e55535a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 14:39:39 -0600 Subject: [PATCH 05/10] format, strip extra content --- Marlin/src/core/boards.h | 4 +- .../pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h | 402 +++--------------- 2 files changed, 53 insertions(+), 353 deletions(-) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index b07bdc4a4feb..0895bb46a08f 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -519,8 +519,10 @@ // // HC32 ARM Cortex-M4 // + #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 -#define BOARD_CREALITY_ENDER2P_V24S4 7201 // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta). +#define BOARD_CREALITY_ENDER2P_V24S4 7201 // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) + // // Custom board // diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h index 5c75d6d45652..76c6b0abd22b 100644 --- a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -79,11 +79,7 @@ // #define X_STOP_PIN PA5 #define Y_STOP_PIN PA6 -#define Z_STOP_PIN PB0 // BLTOUCH * - -// #define X_MAX_PIN PA4 -#define Y_MAX_PIN -1 -#define Z_MAX_PIN -1 +#define Z_STOP_PIN PB0 // BLTOUCH * #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN PB1 // BLTouch IN * @@ -93,61 +89,55 @@ // Filament Runout Sensor // #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN PC15 // "Pulled-high" * + #define FIL_RUNOUT_PIN PC15 // "Pulled-high" * #endif // // Steppers // - #define X_ENABLE_PIN PC2 - #define X_STEP_PIN PC1 - #define X_DIR_PIN PC0 - - #define Y_ENABLE_PIN PH2 - #define Y_STEP_PIN PB9 - #define Y_DIR_PIN PB8 +#define X_ENABLE_PIN PC2 +#define X_STEP_PIN PC1 +#define X_DIR_PIN PC0 - #define Z_ENABLE_PIN PB7 - #define Z_STEP_PIN PB6 - #define Z_DIR_PIN PB5 +#define Y_ENABLE_PIN PH2 +#define Y_STEP_PIN PB9 +#define Y_DIR_PIN PB8 - #define E0_ENABLE_PIN PB4 - #define E0_STEP_PIN PB3 - #define E0_DIR_PIN PA15 +#define Z_ENABLE_PIN PB7 +#define Z_STEP_PIN PB6 +#define Z_DIR_PIN PB5 +#define E0_ENABLE_PIN PB4 +#define E0_STEP_PIN PB3 +#define E0_DIR_PIN PA15 // // Temperature Sensors // -#define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 -#define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 -#define ADC_CHANNEL_COUNT 2u +#define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 +#define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 +#define ADC_CHANNEL_COUNT 2 // // Heaters / Fans // #define HEATER_0_PIN PA1 // HEATER1 -#define HEATER_BED_PIN PB10 // HOT BED +#define HEATER_BED_PIN PB10 // HOT BED #define FAN0_PIN PA0 // FAN0 -#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 - - - #define BEEPER_PIN PC6 //LCD_ENC - - - #define BTN_ENC PC7 //LCD_RST - #define BTN_EN1 PA2 // UART4-TX - #define BTN_EN2 PB13 // SPI MISO +#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 + #define BEEPER_PIN PC6 // LCD_ENC - #define LCD_PINS_RS PB15//SPI3_NSS - #define LCD_PINS_EN PB12// SPI3_MOSI - #define LCD_PINS_D4 PB14// SPI3_CLK + #define BTN_ENC PC7 // LCD_RST + #define BTN_EN1 PA2 // UART4-TX + #define BTN_EN2 PB13 // SPI MISO + #define LCD_PINS_RS PB15 // SPI3_NSS + #define LCD_PINS_EN PB12 // SPI3_MOSI + #define LCD_PINS_D4 PB14 // SPI3_CLK #endif - // ****** checked with klipper/config/printer-creality-ender2pro-hc32-2022.cfg ; https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender2pro-hc32-2022.cfg // @@ -159,336 +149,44 @@ #define ONBOARD_SDIO #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer - #ifndef LCD_SERIAL_PORT - #define LCD_SERIAL_PORT 1 - #endif +#ifndef LCD_SERIAL_PORT + #define LCD_SERIAL_PORT 1 +#endif /* * SDIO Pins - */ - #define BOARD_SDIO_D0 PC8 - #define BOARD_SDIO_D1 PC9 - #define BOARD_SDIO_D2 PC10 - #define BOARD_SDIO_D3 PC11 - #define BOARD_SDIO_CLK PC12 - #define BOARD_SDIO_CMD PD2 - #define BOARD_SDIO_DET PA10 +*/ +#define BOARD_SDIO_D0 PC8 +#define BOARD_SDIO_D1 PC9 +#define BOARD_SDIO_D2 PC10 +#define BOARD_SDIO_D3 PC11 +#define BOARD_SDIO_CLK PC12 +#define BOARD_SDIO_CMD PD2 +#define BOARD_SDIO_DET PA10 // // USART Pins // // Display -#define BOARD_USART1_TX_PIN PA2// LCD -#define BOARD_USART1_RX_PIN PA3 +#define BOARD_USART1_TX_PIN PA2 // LCD +#define BOARD_USART1_RX_PIN PA3 // Host -#define BOARD_USART2_TX_PIN PA8//USB -#define BOARD_USART2_RX_PIN PA7 - +#define BOARD_USART2_TX_PIN PA8 // USB +#define BOARD_USART2_RX_PIN PA7 // Onboard LED (HIGH = off, LOW = on) #ifndef LED_BUILTIN - #define LED_BUILTIN PC3 + #define LED_BUILTIN PC3 #endif #define BOARD_NO_NATIVE_USB -/* - * SPI3 Pins (LCD) - */ - #define SPI_NSS PB15 //SPI3_NSS - #define SPI_SCK PB14 // SPI3_CLK - #define SPI_MISO PB13// SPI3_MISO - #define SPI_MOSI PB12 // SPI3_MOSI - - -// # This file contains pin mappings for the Creality Ender2 Pro -// # with the HC32F460. The board is CR-FDM-v2.5.S4.170 -// # To use this config, during "make menuconfig" select HC32F460 - -// # Flash this firmware by copying "out/klipper.bin" to a SD card -// # as /user/firmware.bin -// # Turn on the printer with the card inserted. - -// # See docs/Config_Reference.md for a description of parameters. - -// [stepper_x] -// step_pin: PC1 -// dir_pin: PC0 -// enable_pin: !PC2 -// microsteps: 16 -// rotation_distance: 40 -// endstop_pin: ^PA5 -// position_min: -20 -// position_endstop: -20 -// position_max: 165 -// homing_speed: 50 - -// [stepper_y] -// step_pin: PB9 -// dir_pin: PB8 -// enable_pin: !PH2 -// microsteps: 16 -// rotation_distance: 40 -// endstop_pin: ^PA6 -// position_min: -5 -// position_endstop: -5 -// position_max: 165 -// homing_speed: 50 - -// [stepper_z] -// step_pin: PB6 -// dir_pin: !PB5 -// enable_pin: !PB7 -// microsteps: 16 -// rotation_distance: 8 -// endstop_pin: ^PB0 -// position_endstop: 0.0 -// position_max: 180 - -// [extruder] -// max_extrude_only_distance: 100.0 -// step_pin: PB3 -// dir_pin: PA15 -// enable_pin: !PB4 -// microsteps: 16 -// rotation_distance: 27.53480577 -// nozzle_diameter: 0.400 -// filament_diameter: 1.750 -// heater_pin: PA1 -// sensor_pin: PC5 -// sensor_type: Generic 3950 -// control: pid -// pid_Kp: 29.634 -// pid_Ki: 2.102 -// pid_Kd: 104.459 -// min_temp: 0 -// max_temp: 260 - -// [heater_bed] -// heater_pin: PB10 -// sensor_type: Generic 3950 -// sensor_pin: PC4 -// control: pid -// pid_Kp: 72.921 -// pid_Ki: 1.594 -// pid_Kd: 834.031 -// min_temp: 0 -// max_temp: 80 - -// [fan] -// pin: PA0 - -// [mcu] -// serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 -// restart_method: command - -// [printer] -// kinematics: cartesian -// max_velocity: 300 -// max_accel: 3000 -// max_z_velocity: 5 -// max_z_accel: 100 - -// [display] -// lcd_type: st7920 -// cs_pin: PB15 -// sclk_pin: PB14 -// sid_pin: PB12 -// encoder_pins: ^PB13,^PA2 -// click_pin: ^!PC7 - - - // Data from kiel ".165 firmware version" - -// /** -// * CREALITY v4.2.7 (STM32F103) board pin assignments -// */ - -// #ifndef HC32F46x -// #error "Oops! Select an HC32F46x board in 'options > c/c++->defines.'" -// #endif - -// #if defined(CR10_STOCKDISPLAY) && !defined RET6_12864_LCD && !definedVET6_12864_LCD -// #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the Creality V4 controller." -// #endif - -// #if HOTENDS > 1 || E_STEPPERS > 1 -// #error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue." -// #endif - -// #define BOARD_INFO_NAME "Creality v2.4.S4" -// #define DEFAULT_MACHINE_NAME "Creality3D" - - - -// #define BOARD_NO_NATIVE_USB -// /* LED0 Port/Pin definition */ -// #define LED0 PC3 // TEST -// /* -// * SPI3 Pins -// */ -// #define SPI_NSS PB15 //SPI3_NSS -// #define SPI_SCK PB14 // SPI3_CLK -// #define SPI_MISO PB13// SPI3_MISO -// #define SPI_MOSI PB12 // SPI3_MOSI - -// /* -// * SDIO Pins -// */ -// #define BOARD_SDIO_D0 PC8 -// #define BOARD_SDIO_D1 PC9 -// #define BOARD_SDIO_D2 PC10 -// #define BOARD_SDIO_D3 PC11 -// #define BOARD_SDIO_CLK PC12 -// #define BOARD_SDIO_CMD PD2 -// #define BOARD_SDIO_DET PA10 - -// // USARTS - -// #define BOARD_USART2_TX_PIN PA8//USB -// #define BOARD_USART2_RX_PIN PA7 - -// #define BOARD_USART1_TX_PIN PA2// LCD -// #define BOARD_USART1_RX_PIN PA3 - -// // -// // EEPROM -// // -// #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 -// //#define SDCARD_EEPROM_EMULATION - -// #ifdef IIC_BL24CXX_EEPROM -// #define IIC_EEPROM_SDA PA12 -// #define IIC_EEPROM_SCL PA11 -// #define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16) -// #endif - -// // -// // Servos -// // -// #ifndef SERVO0_PIN -// #define SERVO0_PIN PB2 // BLTouch OUT PIN -// #endif - -// // -// // Limit Switches -// // -// #define X_STOP_PIN PA5 -// #define Y_STOP_PIN PA6 -// #define Z_STOP_PIN PB0 -// #define X_MAX_PIN PA4 -// #define Y_MAX_PIN -1 -// #define Z_MAX_PIN -1 - -// #ifndef Z_MIN_PROBE_PIN -// #define Z_MIN_PROBE_PIN PB1 // BLTouch IN -// #endif - -// // -// // Filament Runout Sensor -// // -// #ifndef FIL_RUNOUT_PIN -// #define FIL_RUNOUT_PIN PC15 // "Pulled-high" -// #endif - - -// // -// // Steppers -// // -// #define X_ENABLE_PIN PC2 -// #define X_STEP_PIN PC1 -// #define X_DIR_PIN PC0 - -// #define Y_ENABLE_PIN PH2 -// #define Y_STEP_PIN PB9 -// #define Y_DIR_PIN PB8 - -// #define Z_ENABLE_PIN PB7 -// #define Z_STEP_PIN PB6 -// #define Z_DIR_PIN PB5 - -// #define E0_ENABLE_PIN PB4 -// #define E0_STEP_PIN PB3 -// #define E0_DIR_PIN PA15 - -// // -// // Temperature Sensors -// // -// #define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 -// #define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 -// #define ADC_CHANNEL_COUNT 2u - -// // -// // Heaters / Fans -// // -// #define HEATER_0_PIN PA1 // HEATER1 -// #define HEATER_BED_PIN PB10 // HOT BED - -// #ifndef FAN_PIN -// #define FAN_PIN PA0 // FAN -// #endif -// #if PIN_EXISTS(FAN) -// #define FAN_SOFT_PWM -// #endif - -// // -// // SD Card -// // -// #define SD_DETECT_PIN PA10 -// #define SDCARD_CONNECTION ONBOARD -// #define ONBOARD_SPI_DEVICE 1 -// #define ONBOARD_SD_CS_PIN PC3 // SDSS -// #define SDIO_SUPPORT -// #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer - - -// #if ENABLED(RET6_12864_LCD) - -// /* RET6 12864 LCD */ -// #define LCD_PINS_RS PB15//SPI3_NSS -// #define LCD_PINS_ENABLE PB12// SPI3_MOSI -// #define LCD_PINS_D4 PB14// SPI3_CLK - -// #define BTN_ENC PC7 //LCD_RST -// #define BTN_EN1 PA2 // UART4-TX -// #define BTN_EN2 PB13 // SPI MISO - -// #define BEEPER_PIN PC6 //LCD_ENC - -// #elif ENABLED(VET6_12864_LCD) - -// /* VET6 12864 LCD */ -// #define LCD_PINS_RS PA4 -// #define LCD_PINS_ENABLE PA7 -// #define LCD_PINS_D4 PA5 - -// #define BTN_ENC PC5 -// #define BTN_EN1 PB10 -// #define BTN_EN2 PA6 - -// #elif ENABLED(DWIN_CREALITY_LCD) - -// // RET6 DWIN ENCODER LCD -// #define BTN_ENC PB14 -// #define BTN_EN1 PB15 -// #define BTN_EN2 PB12 - -// //#define LCD_LED_PIN PB2 -// #ifndef BEEPER_PIN -// #define BEEPER_PIN PB13 -// #undef SPEAKER -// #endif - -// #elif ENABLED(DWIN_VET6_CREALITY_LCD) - -// // VET6 DWIN ENCODER LCD -// #define BTN_ENC PA6 -// #define BTN_EN1 PA7 -// #define BTN_EN2 PA4 - -// #define BEEPER_PIN PA5 - -// #endif - +// +// SPI3 Pins (LCD) +// +#define SPI_NSS PB15 // SPI3_NSS +#define SPI_SCK PB14 // SPI3_CLK +#define SPI_MISO PB13 // SPI3_MISO +#define SPI_MOSI PB12 // SPI3_MOSI From ffaab28b75371085e54b4feebbf88ac0ab4606e7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 14:43:57 -0600 Subject: [PATCH 06/10] header --- Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h index 76c6b0abd22b..22fbe9c26e89 100644 --- a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -23,6 +23,7 @@ // // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) +// Derived from https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender2pro-hc32-2022.cfg // #include "env_validate.h" @@ -138,8 +139,6 @@ #define LCD_PINS_D4 PB14 // SPI3_CLK #endif -// ****** checked with klipper/config/printer-creality-ender2pro-hc32-2022.cfg ; https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender2pro-hc32-2022.cfg - // // SD Card // @@ -169,11 +168,11 @@ // // Display -#define BOARD_USART1_TX_PIN PA2 // LCD +#define BOARD_USART1_TX_PIN PA2 // LCD #define BOARD_USART1_RX_PIN PA3 // Host -#define BOARD_USART2_TX_PIN PA8 // USB +#define BOARD_USART2_TX_PIN PA8 // USB #define BOARD_USART2_RX_PIN PA7 // Onboard LED (HIGH = off, LOW = on) From c8c35346f12c9083ae8e1c3d6685137f9c907d64 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 14:45:51 -0600 Subject: [PATCH 07/10] remove unused define --- Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h index 22fbe9c26e89..7d47d840c540 100644 --- a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -117,7 +117,6 @@ // #define TEMP_0_PIN PC5 // HEATER1 ADC1_IN15 #define TEMP_BED_PIN PC4 // HOT BED ADC1_IN14 -#define ADC_CHANNEL_COUNT 2 // // Heaters / Fans From f1c43056fbb053563eeabbad457650caadf8cc19 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 14:48:13 -0600 Subject: [PATCH 08/10] format --- ini/hc32.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ini/hc32.ini b/ini/hc32.ini index c3e847c4c47e..9bf15447e2cd 100644 --- a/ini/hc32.ini +++ b/ini/hc32.ini @@ -87,8 +87,8 @@ board_build.ld_args.flash_start = 0xC000 # Bootloader start address, as logge board_build.ld_args.boot_mode = secondary # Save ~1.4k of flash by compiling as secondary firmware # -# Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) has 256 KB of flash and 192 KB of ram available. +# Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) (256K Flash, 192K RAM). # [env:HC32F460C_e2p24s4] extends = HC32F460C_base -board_build.ld_args.flash_start = 0x8000 \ No newline at end of file +board_build.ld_args.flash_start = 0x8000 From 6257962f7bcccbd6abb9fb23d8a3c3294a9b2baa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 15:02:51 -0600 Subject: [PATCH 09/10] define EXP1 pins --- .../pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h | 62 ++++++++++++++----- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h index 7d47d840c540..64b013d9993e 100644 --- a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -126,18 +126,6 @@ #define FAN0_PIN PA0 // FAN0 -#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 - #define BEEPER_PIN PC6 // LCD_ENC - - #define BTN_ENC PC7 // LCD_RST - #define BTN_EN1 PA2 // UART4-TX - #define BTN_EN2 PB13 // SPI MISO - - #define LCD_PINS_RS PB15 // SPI3_NSS - #define LCD_PINS_EN PB12 // SPI3_MOSI - #define LCD_PINS_D4 PB14 // SPI3_CLK -#endif - // // SD Card // @@ -151,9 +139,9 @@ #define LCD_SERIAL_PORT 1 #endif -/* - * SDIO Pins -*/ +// +// SDIO Pins +// #define BOARD_SDIO_D0 PC8 #define BOARD_SDIO_D1 PC9 #define BOARD_SDIO_D2 PC10 @@ -188,3 +176,47 @@ #define SPI_SCK PB14 // SPI3_CLK #define SPI_MISO PB13 // SPI3_MISO #define SPI_MOSI PB12 // SPI3_MOSI + +// +// LCD / Controller +// + +/** ------ + * PC6 | 1 2 | PC7 + * PA2 | 3 4 | PC1 + * PB13 5 6 | PB14 + * PB15 | 7 8 | PB12 + * GND | 9 10 | 5V + * ------ + * EXP1 + */ +#define EXP1_01_PIN PC6 +#define EXP1_02_PIN PC7 +#define EXP1_03_PIN PA2 +#define EXP1_04_PIN PC1 +#define EXP1_05_PIN PB13 +#define EXP1_06_PIN PB14 +#define EXP1_07_PIN PB15 +#define EXP1_08_PIN PB12 + +#if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 + /** ------ + * BEEPER | 1 2 | ENC + * EN1 | 3 4 | KILL + * EN2 5 6 | LCD_D4 + * LCD_RS | 7 8 | LCD_EN + * GND | 9 10 | 5V + * ------ + */ + #define BEEPER_PIN EXP1_01_PIN + + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #define KILL_PIN EXP1_04_PIN +#endif From 29ca3d28a286505bf1bedcc971b97417a9bf187f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jan 2024 15:10:16 -0600 Subject: [PATCH 10/10] properly --- Marlin/src/pins/pins.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 19c9a713e648..af32d8c11968 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -900,10 +900,12 @@ // // HC32 ARM Cortex-M4 // + #elif MB(AQUILA_V101) #include "hc32f4/pins_AQUILA_101.h" // HC32F460 env:HC32F460C_aquila_101 #elif MB(CREALITY_ENDER2P_V24S4) #include "hc32f4/pins_CREALITY_ENDER2P_V24S4.h" // HC32F460 env:HC32F460C_e2p24s4 + // // Custom board (with custom PIO env) //