Creality STM32F401RE board (e.g., Ender-5 S1) (#25773)

This commit is contained in:
Scott Lahteine
2023-05-02 17:59:27 -05:00
committed by GitHub
parent 21ea9bf50f
commit e1f6435d44
22 changed files with 1881 additions and 7 deletions

View File

@@ -462,6 +462,7 @@
* 11 : 100kΩ Keenovo AC silicone mats, most Wanhao i3 machines - beta 3950, 1%
* 12 : 100kΩ Vishay 0603 SMD NTCS0603E3104FXT (#8) - calibrated for Makibox hot bed
* 13 : 100kΩ Hisens up to 300°C - for "Simple ONE" & "All In ONE" hotend - beta 3950, 1%
* 14 : 100kΩ (R25), 4092K (beta25), 4.7kΩ pull-up, bed thermistor as used in Ender-5 S1
* 15 : 100kΩ Calibrated for JGAurora A5 hotend
* 18 : 200kΩ ATC Semitec 204GT-2 Dagoma.Fr - MKS_Base_DKU001327
* 22 : 100kΩ GTM32 Pro vB - hotend - 4.7kΩ pullup to 3.3V and 220Ω to analog input

View File

@@ -449,6 +449,7 @@
#define BOARD_FYSETC_SPIDER_KING407 5243 // FYSETC Spider King407 (STM32F407ZG)
#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
//
// ARM Cortex-M7

View File

@@ -1061,6 +1061,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 422: M422(); break; // M422: Set Z Stepper automatic alignment position using probe
#endif
#if ENABLED(OTA_FIRMWARE_UPDATE)
case 936: M936(); break; // M936: OTA update firmware.
#endif
#if SPI_FLASH_BACKUP
case 993: M993(); break; // M993: Backup SPI Flash to SD
case 994: M994(); break; // M994: Load a Backup from SD to SPI Flash

View File

@@ -300,6 +300,7 @@
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
* M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
* M919 - Get or Set motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc. If no parameters are given, report. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
* M936 - OTA update firmware. (Requires OTA_FIRMWARE_UPDATE)
* M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
* M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
* M7219 - Control Max7219 Matrix LEDs. (Requires MAX7219_GCODE)
@@ -1199,6 +1200,10 @@ private:
static void M928();
#endif
#if ENABLED(OTA_FIRMWARE_UPDATE)
static void M936();
#endif
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
static void M951();
#endif

View File

@@ -0,0 +1,72 @@
/**
* 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/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(OTA_FIRMWARE_UPDATE)
#include "../gcode.h"
#include "../../libs/BL24CXX.h"
#if ENABLED(CREALITY_RTS)
#include "../../lcd/rts/lcd_rts.h"
#endif
#define OTA_FLAG_EEPROM 90
//#define DEBUG_OUT 1
#include "../../core/debug_out.h"
/**
* M936: Set one of the OTA update flags.
* V2 = Upgrade the motherboard firmware
* V3 = Upgrade the RTS controller firmware
*/
void GcodeSuite::M936() {
static uint8_t ota_update_flag = 0x00;
const int16_t ota = parser.intval('V', -1);
switch (ota) {
case 2:
// Set the OTA board firmware upgrade flag ahead of reboot.
ota_update_flag = 0x01;
DEBUG_ECHOLNPGM("Motherboard upgrade flag set");
TERN_(CREALITY_RTS, RTS_Error(Error_205));
break;
#if ENABLED(CREALITY_RTS)
case 3:
// Set the OTA screen firmware upgrade flag ahead of reboot.
ota_update_flag = 0x02;
DEBUG_ECHOLNPGM("DWIN upgrade flag set");
TERN_(CREALITY_RTS, RTS_Error(Error_206));
break;
#endif
}
switch (ota) {
case 2: TERN_(CREALITY_RTS, case 3:)
BL24CXX::write(OTA_FLAG_EEPROM, &ota_update_flag, sizeof(ota_update_flag));
safe_delay(100);
hal.reboot();
}
}
#endif // OTA_FIRMWARE_UPDATE

View File

@@ -65,6 +65,10 @@
#undef IIC_BL24CXX_EEPROM
#endif
#if DISABLED(IIC_BL24CXX_EEPROM)
#undef OTA_FIRMWARE_UPDATE
#endif
#ifdef TEENSYDUINO
#undef max
#define max(a,b) ((a)>(b)?(a):(b))

View File

@@ -749,3 +749,10 @@
#if SDSORT_CACHE_LPC1768_WARNING
#warning "SDCARD_SORT_ALPHA sub-options overridden for LPC1768 with DOGM LCD SCK overlap."
#endif
/**
* Ender-5 S1 bootloader
*/
#ifdef STM32F4_UPDATE_FOLDER
#warning "Place the firmware bin file in a folder named 'STM32F4_UPDATE' on the SD card. Install with 'M936 V2'."
#endif

View File

@@ -23,6 +23,10 @@
// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
constexpr temp_entry_t temptable_1[] PROGMEM = {
{ OV( 18), 320 },
{ OV( 19), 315 },
{ OV( 20), 310 },
{ OV( 22), 305 },
{ OV( 23), 300 },
{ OV( 25), 295 },
{ OV( 27), 290 },

View File

@@ -0,0 +1,85 @@
/**
* 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
// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
const temp_entry_t temptable_14[] PROGMEM = {
{ OV( 23), 275 },
{ OV( 25), 270 },
{ OV( 27), 265 },
{ OV( 28), 260 },
{ OV( 31), 255 },
{ OV( 33), 250 },
{ OV( 35), 245 },
{ OV( 38), 240 },
{ OV( 41), 235 },
{ OV( 44), 230 },
{ OV( 47), 225 },
{ OV( 52), 220 },
{ OV( 56), 215 },
{ OV( 62), 210 },
{ OV( 68), 205 },
{ OV( 74), 200 },
{ OV( 81), 195 },
{ OV( 90), 190 },
{ OV( 99), 185 },
{ OV( 108), 180 },
{ OV( 121), 175 },
{ OV( 133), 170 },
{ OV( 147), 165 },
{ OV( 162), 160 },
{ OV( 180), 155 },
{ OV( 199), 150 },
{ OV( 219), 145 },
{ OV( 243), 140 },
{ OV( 268), 135 },
{ OV( 296), 130 },
{ OV( 326), 125 },
{ OV( 358), 120 },
{ OV( 398), 115 },
{ OV( 435), 110 },
{ OV( 476), 105 },
{ OV( 519), 100 },
{ OV( 566), 95 },
{ OV( 610), 90 },
{ OV( 658), 85 },
{ OV( 703), 80 },
{ OV( 742), 75 },
{ OV( 773), 70 },
{ OV( 807), 65 },
{ OV( 841), 60 },
{ OV( 871), 55 },
{ OV( 895), 50 },
{ OV( 918), 45 },
{ OV( 937), 40 },
{ OV( 954), 35 },
{ OV( 968), 30 },
{ OV( 978), 25 },
{ OV( 985), 20 },
{ OV( 993), 15 },
{ OV( 999), 10 },
{ OV(1004), 5 },
{ OV(1008), 0 },
{ OV(1012), -5 },
{ OV(1016), -10 },
{ OV(1020), -15 }
};

View File

@@ -109,6 +109,9 @@ typedef struct { raw_adc_t value; celsius_t celsius; } temp_entry_t;
#if ANY_THERMISTOR_IS(13) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Hisens"
#include "thermistor_13.h"
#endif
#if ANY_THERMISTOR_IS(14) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "EPCOS" for hot bed
#include "thermistor_14.h"
#endif
#if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration
#include "thermistor_15.h"
#endif

View File

@@ -788,6 +788,8 @@
#include "stm32f4/pins_MKS_SKIPR_V1_0.h" // STM32F4 env:mks_skipr_v1 env:mks_skipr_v1_nobootloader
#elif MB(TRONXY_V10)
#include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy
#elif MB(CREALITY_F401RE)
#include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality
//
// ARM Cortex M7

View File

@@ -0,0 +1,241 @@
/**
* 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"
#define BOARD_INFO_NAME "STM32F401RET6"
#define DEFAULT_MACHINE_NAME "Ender-5 S1"
#define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 used only for display settings
#if ENABLED(IIC_BL24CXX_EEPROM)
#define IIC_EEPROM_SDA PA11
#define IIC_EEPROM_SCL PA12
#define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16)
#else
#define SDCARD_EEPROM_EMULATION // SD EEPROM until all EEPROM is BL24CXX
#define MARLIN_EEPROM_SIZE 0x800 // 2Kb
#endif
// SPI
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
// 32Mb FLASH
//#define SPI_FLASH_CS ?
//
// Servos
//
#define SERVO0_PIN PC13 // BLTouch OUT
//
// Limit Switches
//
#define X_STOP_PIN PA5
#define Y_STOP_PIN PA6
#if ENABLED(BLTOUCH)
#define Z_MAX_PIN PA15 // ROCK_20220730
#define Z_MIN_PIN PC14
//#define Z_STOP_PIN_NADD PA15 // Added z-axis limit switch
#elif ENABLED(PROBE_ACTIVATION_SWITCH)
#define Z_MIN_PIN PA15
#define PROBE_TARE_PIN PC14
#define PROBE_ACTIVATION_SWITCH_PIN PB2
#else
#define Z_MIN_PIN PA15
#endif
//
// Filament runout
//
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_PIN PC15
#endif
//
// Steppers Motor drive chip power control
//
#define X_ENABLE_PIN PC3
#define X_STEP_PIN PC2
#define X_DIR_PIN PB9
#define Y_ENABLE_PIN PC3
#define Y_STEP_PIN PB8
#define Y_DIR_PIN PB7
#define Z_ENABLE_PIN PC3
#define Z_STEP_PIN PB6
#define Z_DIR_PIN PB5
#define E0_ENABLE_PIN PC3
#define E0_STEP_PIN PB4
#define E0_DIR_PIN PB3
//
// Temperature Sensors
//
#ifndef TEMP_0_PIN
#define TEMP_0_PIN PC5 // E1_THERMISTOR PA0 -> PT100
#endif
#define TEMP_BED_PIN PC4 // BED_THERMISTOR_1
//
// Heaters / Fans
//
#define HEATER_0_PIN PA1 // E1_HEAT_PWM
#define HEATER_BED_PIN PA7 // BED_HEAT_1 FET
#define FAN0_PIN PA0 // Part cooling fan FET
//#define FAN1_PIN PE11 // Extruder fan FET
//#define FAN2_PIN PE1 // Controller fan FET
#ifndef E0_AUTO_FAN_PIN
#define E0_AUTO_FAN_PIN PA1 // FAN1_PIN
#endif
//
// SD Card
//
#define SD_DETECT_PIN PC7
#define SDCARD_CONNECTION ONBOARD
#define ONBOARD_SPI_DEVICE 1
#define ONBOARD_SD_CS_PIN PC12 // SDSS
#define SDIO_SUPPORT
#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer
// SPI 2
#if ENABLED(RET6_12864_LCD)
#define LCD_PINS_RS PB12
#define LCD_PINS_ENABLE PB15
#define LCD_PINS_D4 PB13
#define BTN_EN2 PB14
#endif
//#define LED_CONTROL_PIN PA7
//
// WiFI Reset
//
#ifdef MENU_RESET_WIFI
#define RESET_WIFI_PIN PB12
#endif
//
// Backpower
//
#ifndef BACKPOWER_CTRL_PIN
#define BACKPOWER_CTRL_PIN PA4 // Pull down on the electricity, When the ADC detects that the 24V power supply is below 20V, Save the continued call data first, PA4 = 1
#endif
#ifndef CHECK_24V_PIN
#define POWER_DETECTION_PIN PB0 // Detect ADC input pin of 24V power supply
#endif
/**
* 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
*/