From 15acc7bd38a0b4ab2850f904dfd80fee6557eb48 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 10 Jul 2023 12:08:36 +0100 Subject: [PATCH 01/12] first stab at adding the Fly-E3-V2 still needs the LCD pins sorting and anything for the SD Card --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 333 +++++++++++++++++++++++ ini/stm32f4.ini | 10 + 4 files changed, 346 insertions(+) create mode 100644 Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index e9940fc34496..7fd366ae1d62 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -458,6 +458,7 @@ #define BOARD_CREALITY_F401RE 5245 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 #define BOARD_BLACKPILL_CUSTOM 5246 // Custom board based on STM32F401CDU6. #define BOARD_I3DBEEZ9_V1 5247 // I3DBEEZ9 V1 (STM32F407ZG) +#define BOARD_FLY_E3_V2 5248 // Fly-E3-v2 (STM32F407VG) // // ARM Cortex-M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 4d41d76d8878..a06cbed04874 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -802,6 +802,8 @@ #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink #elif MB(I3DBEEZ9_V1) #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 +#elif MB(FLY_E3_V2) + #include "stm32f4/pins_FLY_E3_V2.h" // STM32F4 env:FLY_E3_V2 // // ARM Cortex-M7 diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h new file mode 100644 index 000000000000..a98467a35431 --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -0,0 +1,333 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 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 + +#if NOT_TARGET(STM32F4) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "FLY_E3_V2" +#endif + +#define USES_DIAG_JUMPERS + +// Add-on board for IDEX conversion +//#define BTT_E3_RRF_IDEX_BOARD + +// Onboard I2C EEPROM +#define I2C_EEPROM +#define MARLIN_EEPROM_SIZE 0x1000 // 4K + +// +// Servos +// +#define SERVO0_PIN PE6 // SERVOS + +// +// Limit Switches +// +#define X_STOP_PIN PE7 // X-STOP +#define Y_STOP_PIN PE8 // Y-STOP +#define Z_STOP_PIN PE9 // Z-STOP + +// +// Z Probe must be this pin +// +#define Z_MIN_PROBE_PIN PC2 // PROBE + +// +// Steppers +// +#define X_ENABLE_PIN PC1 +#define X_STEP_PIN PE5 +#define X_DIR_PIN PC0 +#ifndef X_CS_PIN + #define X_CS_PIN PC15 +#endif + +#define Y_ENABLE_PIN PC14 +#define Y_STEP_PIN PE4 +#define Y_DIR_PIN PC13 +#ifndef Y_CS_PIN + #define Y_CS_PIN PB6 +#endif + +#define Z_ENABLE_PIN PE3 +#define Z_STEP_PIN PE1 +#define Z_DIR_PIN PB7 +#ifndef Z_CS_PIN + #define Z_CS_PIN PD7 +#endif + +#define E0_ENABLE_PIN PD6 +#define E0_STEP_PIN PE2 +#define E0_DIR_PIN PD5 +#ifndef E0_CS_PIN + #define E0_CS_PIN PD4 +#endif + +#define E1_ENABLE_PIN PD3 +#define E1_STEP_PIN PE0 +#define E1_DIR_PIN PD1 +#ifndef E1_CS_PIN + #define E1_CS_PIN PD0 +#endif + + +// +// Temperature Sensors +// +#define TEMP_BED_PIN PB1 // Analog Input "TB" +#define TEMP_0_PIN PC4 // Analog Input "TH0" +#define TEMP_1_PIN PC5 // Analog Input "TH0" + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PB0 // "HB" +#define HEATER_0_PIN PC6 // "HE0" +#define HEATER_1_PIN PC7 // "HE0" + +#define FAN0_PIN PA0 // "FAN0" +#define FAN1_PIN PA1 +#define FAN2_PIN PA2 +#define FAN3_PIN PA3 + +/** + * BTT E3 RRF + * ------ + * (BEEPER) PE8 | 1 2 | PE9 (BTN_ENC) + * (BTN_EN1) PE7 | 3 4 | RESET + * (BTN_EN2) PB2 5 6 | PE10 (LCD_D4) + * (LCD_RS) PB1 | 7 8 | PE11 (LCD_EN) + * GND | 9 10 | 5V + * ------ + * EXP1 + */ + +#if HAS_WIRED_LCD + + #if ANY(CR10_STOCKDISPLAY, LCD_FOR_MELZI) + + #define BEEPER_PIN PE8 + + #define BTN_ENC PE9 + #define BTN_EN1 PE7 + #define BTN_EN2 PB2 + + #define LCD_PINS_RS PB1 + #define LCD_PINS_EN PE11 + #define LCD_PINS_D4 PE10 + + #if ENABLED(LCD_FOR_MELZI) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FOR_MELZI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + /** LCD_FOR_MELZI display pinout + * + * BTT E3 RRF Display Ribbon + * ------ ------ + * (BEEPER) PE8 | 1 2 | PE9 (BTN_ENC) GND |10 9 | 5V + * (BTN_EN1) PE7 | 3 4 | RESET BEEPER | 8 7 | ESTOP (RESET) + * (BTN_EN2) PB2 5 6 | PE10 (LCD_D4) (BTN_ENC) ENC_BTN | 6 5 | LCD_SCLK (LCD_D4) + * (LCD_RS) PB1 | 7 8 | PE11 (LCD_EN) (BTN_EN2) ENC_A | 4 3 | LCD_DATA (LCD_EN) + * GND | 9 10 | 5V (BTN_EN1) ENC_B | 2 1 | LCD_CS (LCD_RS) + * ------ ------ + * EXP1 LCD + * + * Needs custom cable: + * + * Board Adapter Display Ribbon (coming from display) + * ---------------------------------- + * EXP1-10 ---------- LCD-9 5V + * EXP1-9 ----------- LCD-10 GND + * EXP1-8 ----------- LCD-3 LCD_EN + * EXP1-7 ----------- LCD-1 LCD_RS + * EXP1-6 ----------- LCD-5 LCD_D4 + * EXP1-5 ----------- LCD-4 EN2 + * EXP1-4 ----------- LCD-7 RESET + * EXP1-3 ----------- LCD-2 EN1 + * EXP1-2 ----------- LCD-6 BTN + * EXP1-1 ----------- LCD-8 BEEPER + */ + + #endif + + #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + #define LCD_PINS_RS PE10 + #define LCD_PINS_EN PE9 + #define LCD_PINS_D4 PB1 + #define LCD_PINS_D5 PB2 + #define LCD_PINS_D6 PE7 + #define LCD_PINS_D7 PE8 + #define ADC_KEYPAD_PIN PB0 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! + + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + + #define BTN_ENC PE9 + #define BTN_EN1 PE7 + #define BTN_EN2 PB2 + + #define DOGLCD_CS PB1 + #define DOGLCD_A0 PE10 + #define DOGLCD_SCK PE8 + #define DOGLCD_MOSI PE11 + + #define FORCE_SOFT_SPI + #define LCD_BACKLIGHT_PIN -1 + + #elif IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + /** + * TFTGLCD_PANEL_SPI display pinout + * + * Board Display + * ------ ------ + * (SD_DET) PE8 | 1 2 | PE9 (BEEPER) 5V |10 9 | GND + * (MOD_RESET) PE7 | 3 4 | RESET -- | 8 7 | (SD_DET) + * (SD_CS) PB2 5 6 | PE10 (MOSI) 6 5 | -- + * (LCD_CS) PB1 | 7 8 | PE11 (SD_CS) | 4 3 | (LCD_CS) + * GND | 9 10 | 5V (SCK) | 2 1 | (MISO) + * ------ ------ + * EXP1 EXP1 + * + * Needs custom cable: + * + * Board Adapter Display + * ---------------------------------- + * EXP1-10 ---------- EXP1-10 5V + * EXP1-9 ----------- EXP1-9 GND + * SPI1-4 ----------- EXP1-6 MOSI + * EXP1-7 ----------- n/c + * SPI1-3 ----------- EXP1-2 SCK + * EXP1-5 ----------- EXP1-4 SD_CS + * EXP1-4 ----------- n/c + * EXP1-3 ----------- EXP1-3 LCD_CS + * SPI1-1 ----------- EXP1-1 MISO + * EXP1-1 ----------- EXP1-7 SD_DET + */ + + #define TFTGLCD_CS PE7 + + #endif + + #else + #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, LCD_FOR_MELZI, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BTT_E3_RRF." + #endif + + // Alter timing for graphical display + #if ENABLED(LCD_FOR_MELZI) // LCD_FOR_MELZI default timing is too fast. This works but may be reduced. + #define BOARD_ST7920_DELAY_1 200 + #define BOARD_ST7920_DELAY_2 400 + #define BOARD_ST7920_DELAY_3 1200 + #elif IS_U8GLIB_ST7920 + #define BOARD_ST7920_DELAY_1 96 + #define BOARD_ST7920_DELAY_2 48 + #define BOARD_ST7920_DELAY_3 600 + #endif + +#endif // HAS_WIRED_LCD + +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + /** FYSETC TFT TFT81050 display pinout + * + * Board Display + * ------ ------ + * (SD_DET) PE8 | 1 2 | PE9 (BEEPER) 5V |10 9 | GND + * (MOD_RESET) PE7 | 3 4 | RESET RESET | 8 7 | (SD_DET) + * (SD_CS) PB2 5 6 | PE10 (MOSI) | 6 5 | (LCD_CS) + * (LCD_CS) PB1 | 7 8 | PE11 (SD_CS) | 4 3 | (MOD_RESET) + * GND | 9 10 | 5V (SCK) | 2 1 | (MISO) + * ------ ------ + * EXP1 EXP1 + * + * Needs custom cable: + * + * Board Adapter Display + * ---------------------------------- + * EXP1-10 ---------- EXP1-10 5V + * EXP1-9 ----------- EXP1-9 GND + * SPI1-4 ----------- EXP1-6 MOSI + * EXP1-7 ----------- EXP1-5 LCD_CS + * SPI1-3 ----------- EXP1-2 SCK + * EXP1-5 ----------- EXP1-4 SD_CS + * EXP1-4 ----------- EXP1-8 RESET + * EXP1-3 ----------- EXP1-3 MOD_RST + * SPI1-1 ----------- EXP1-1 MISO + * EXP1-1 ----------- EXP1-7 SD_DET + */ + + #define CLCD_SPI_BUS 1 // SPI1 connector + + #define BEEPER_PIN PE9 + + #define CLCD_MOD_RESET PE7 + #define CLCD_SPI_CS PB1 + +#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 + +// +// SD Support +// + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +#if SD_CONNECTION_IS(ONBOARD) + #define ONBOARD_SDIO // Use SDIO for onboard SD + //#define SDIO_CLOCK 48000000 + #define SD_DETECT_PIN PC4 +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "SD CUSTOM_CABLE is not compatible with BTT E3 RRF." +#endif + +#if ENABLED(WIFISUPPORT) + // + // WIFI + // + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PA4 + #define ESP_WIFI_MODULE_ENABLE_PIN PA5 + #define ESP_WIFI_MODULE_GPIO0_PIN PA6 +#endif + diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 8708a6dbcacd..9bbc015e3829 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -806,3 +806,13 @@ board_build.offset = 0x8000 build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX debug_tool = stlink upload_protocol = stlink + +# +# FLY-E3-V2 +# +[env:FLY_E3_V2] +extends = stm32_variant +board = marlin_STM32F407ZGT6 +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0x8000 +upload_protocol = dfu \ No newline at end of file From 25d361b2325416fe98a3c90f3866bdd1847c69a8 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 11 Jul 2023 13:15:51 +0100 Subject: [PATCH 02/12] further changes to pins --- Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 92 ++++++++++++++++++++---- 1 file changed, 79 insertions(+), 13 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h index a98467a35431..5b4e86a922f9 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -31,12 +31,19 @@ #define USES_DIAG_JUMPERS -// Add-on board for IDEX conversion -//#define BTT_E3_RRF_IDEX_BOARD +// Use one of these or SDCard-based Emulation will be used +#if NO_EEPROM_SELECTED + //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation + #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation +#endif + +#if ENABLED(FLASH_EEPROM_EMULATION) + // Decrease delays and flash wear by spreading writes across the + // 128 kB sector allocated for EEPROM emulation. + #define FLASH_EEPROM_LEVELING +#endif -// Onboard I2C EEPROM -#define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4K +//#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos @@ -55,6 +62,15 @@ // #define Z_MIN_PROBE_PIN PC2 // PROBE +// +// Probe enable +// +#if ENABLED(PROBE_ENABLE_DISABLE) + #ifndef PROBE_ENABLE_PIN + #define PROBE_ENABLE_PIN SERVO0_PIN + #endif +#endif + // // Steppers // @@ -113,6 +129,56 @@ #define FAN2_PIN PA2 #define FAN3_PIN PA3 + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // + // Software serial + // + #define X_SERIAL_TX_PIN PC15 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PB6 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PD7 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PD4 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PD0 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #ifndef TMC_BAUD_RATE + #define TMC_BAUD_RATE 19200 + #endif + +#endif // HAS_TMC_UART + +//#ifndef SDCARD_CONNECTION +// #define SDCARD_CONNECTION ONBOARD +//#endif + + /** * BTT E3 RRF * ------ @@ -315,19 +381,19 @@ #if SD_CONNECTION_IS(ONBOARD) #define ONBOARD_SDIO // Use SDIO for onboard SD //#define SDIO_CLOCK 48000000 - #define SD_DETECT_PIN PC4 + //#define SD_DETECT_PIN PC4 #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with BTT E3 RRF." #endif -#if ENABLED(WIFISUPPORT) +//#if ENABLED(WIFISUPPORT) // // WIFI // - #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this - #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 - #define ESP_WIFI_MODULE_RESET_PIN PA4 - #define ESP_WIFI_MODULE_ENABLE_PIN PA5 - #define ESP_WIFI_MODULE_GPIO0_PIN PA6 -#endif +// #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this +// #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 +// #define ESP_WIFI_MODULE_RESET_PIN PA4 +// #define ESP_WIFI_MODULE_ENABLE_PIN PA5 +// #define ESP_WIFI_MODULE_GPIO0_PIN PA6 +//#endif From 885a6dcc1d7f2ca4189f89b1e363938eec1a8cc8 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 11 Jul 2023 14:48:33 +0100 Subject: [PATCH 03/12] fix build issues --- ini/stm32f4.ini | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 9bbc015e3829..2680effa6b44 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -811,8 +811,15 @@ upload_protocol = stlink # FLY-E3-V2 # [env:FLY_E3_V2] -extends = stm32_variant -board = marlin_STM32F407ZGT6 -board_build.variant = MARLIN_F4x7Vx -board_build.offset = 0x8000 -upload_protocol = dfu \ No newline at end of file +extends = stm32_variant +platform_packages = ${stm_flash_drive.platform_packages} +board = marlin_STM32F407VGT6_CCM +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0x8000 +board_upload.offset_address = 0x08008000 +build_flags = ${stm_flash_drive.build_flags} + -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS + -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 + -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 +upload_protocol = stlink From dc5b8fbfd1cdf5205fd6b3c0e4f9ec9fc708b8ef Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 13 Jul 2023 21:50:57 +0100 Subject: [PATCH 04/12] bit more work on Fly-E3-V2 pins --- Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 94 +++++++++++++++++------- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h index 5b4e86a922f9..a75f5d49c34b 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -29,8 +29,6 @@ #define BOARD_INFO_NAME "FLY_E3_V2" #endif -#define USES_DIAG_JUMPERS - // Use one of these or SDCard-based Emulation will be used #if NO_EEPROM_SELECTED //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation @@ -43,19 +41,42 @@ #define FLASH_EEPROM_LEVELING #endif -//#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos // #define SERVO0_PIN PE6 // SERVOS +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PE7 // X-STOP +#define Y_DIAG_PIN PE8 // Y-STOP +#define Z_DIAG_PIN PE9 // Z-STOP + // // Limit Switches // -#define X_STOP_PIN PE7 // X-STOP -#define Y_STOP_PIN PE8 // Y-STOP -#define Z_STOP_PIN PE9 // Z-STOP +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN +#else + #define X_STOP_PIN PE7 // X-STOP +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN +#else + #define Y_STOP_PIN PE8 // Y-STOP +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN +#else + #ifndef Z_STOP_PIN + #define Z_STOP_PIN PE9 // Z-STOP + #endif +#endif // // Z Probe must be this pin @@ -120,15 +141,38 @@ // // Heaters / Fans // -#define HEATER_BED_PIN PB0 // "HB" -#define HEATER_0_PIN PC6 // "HE0" -#define HEATER_1_PIN PC7 // "HE0" +#ifndef HEATER_BED_PIN + #define HEATER_BED_PIN PB0 // "HB" +#endif +#ifndef HEATER_0_PIN + #define HEATER_0_PIN PC6 // "HE0" +#endif +#ifndef HEATER_1_PIN + #define HEATER_1_PIN PC7 // "HE0" +#endif -#define FAN0_PIN PA0 // "FAN0" -#define FAN1_PIN PA1 -#define FAN2_PIN PA2 -#define FAN3_PIN PA3 +#ifndef FAN0_PIN + #define FAN0_PIN PA0 // "FAN0" +#endif +#ifndef FAN1_PIN + #define FAN1_PIN PA1 +#endif +#ifndef FAN2_PIN + #define FAN2_PIN PA2 +#endif +#ifndef FAN3_PIN + #define FAN3_PIN PA3 +#endif +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB5 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB4 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB3 +#endif #if HAS_TMC_UART /** @@ -174,21 +218,21 @@ #endif // HAS_TMC_UART -//#ifndef SDCARD_CONNECTION -// #define SDCARD_CONNECTION ONBOARD -//#endif +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif /** - * BTT E3 RRF - * ------ - * (BEEPER) PE8 | 1 2 | PE9 (BTN_ENC) - * (BTN_EN1) PE7 | 3 4 | RESET - * (BTN_EN2) PB2 5 6 | PE10 (LCD_D4) - * (LCD_RS) PB1 | 7 8 | PE11 (LCD_EN) - * GND | 9 10 | 5V - * ------ - * EXP1 + * Fly-E3-v2 + * ------ ------ + * (BEEPER) PD10 | 1 2 | PA9 (BTN_ENC) (MISO) PA6 | 1 2 | PA5 (SCK) + * (LCD_EN) PA8 | 3 4 | PA10 (LCD_RS) (BTN_EN1) PB11 | 3 4 | PA4 (SD_SS) + * (LCD_D4) PE15 | 5 6 PE14 (LCD_D5) (BTN_EN2) PB10 | 5 6 | PA7 (MOSI) + * (LCD_D6) PA14 | 7 8 | PA13 (LCD_D7) (SD_DETECT) PE13 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | -- + * ------ ------ + * EXP1 EXP2 */ #if HAS_WIRED_LCD From c11c182662fd07fcfe77cc6e2459d70fe320acae Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 14 Jul 2023 20:36:32 +0100 Subject: [PATCH 05/12] finish Fly-E3-V2 --- Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 384 +++++++++++++---------- 1 file changed, 219 insertions(+), 165 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h index a75f5d49c34b..ee9bff1a9f19 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -234,210 +234,264 @@ * ------ ------ * EXP1 EXP2 */ +#define EXP1_01_PIN PD10 +#define EXP1_02_PIN PA9 +#define EXP1_03_PIN PA8 +#define EXP1_04_PIN PA10 +#define EXP1_05_PIN PE15 +#define EXP1_06_PIN PE14 +#define EXP1_07_PIN PA14 +#define EXP1_08_PIN PA13 + +#define EXP2_01_PIN PA6 +#define EXP2_02_PIN PA5 +#define EXP2_03_PIN PB11 +#define EXP2_04_PIN PA4 +#define EXP2_05_PIN PB10 +#define EXP2_06_PIN PA7 +#define EXP2_07_PIN PE13 +#define EXP2_08_PIN -1 -#if HAS_WIRED_LCD - - #if ANY(CR10_STOCKDISPLAY, LCD_FOR_MELZI) +// +// Onboard SD card +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 +// +#if SD_CONNECTION_IS(LCD) + #define SDSS EXP2_04_PIN + #define SD_SS_PIN SDSS + #define SD_SCK_PIN EXP2_02_PIN + #define SD_MISO_PIN EXP2_01_PIN + #define SD_MOSI_PIN EXP2_06_PIN + #define SD_DETECT_PIN EXP2_07_PIN +#elif SD_CONNECTION_IS(ONBOARD) + #define ONBOARD_SDIO // Use SDIO for onboard SD +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "No custom SD drive cable defined for this board." +#endif - #define BEEPER_PIN PE8 +#if ENABLED(BTT_MOTOR_EXPANSION) + /** ----- ----- + * -- | . . | GND -- | . . | GND + * -- | . . | M1EN M2EN | . . | M3EN + * M1STP | . . M1DIR M1RX | . . M1DIAG + * M2DIR | . . | M2STP M2RX | . . | M2DIAG + * M3DIR | . . | M3STP M3RX | . . | M3DIAG + * ----- ----- + * EXP2 EXP1 + * + * NB In EXP_MOT_USE_EXP2_ONLY mode EXP1 is not used and M2EN and M3EN need to be jumpered to M1EN + */ - #define BTN_ENC PE9 - #define BTN_EN1 PE7 - #define BTN_EN2 PB2 + // M1 on Driver Expansion Module + #define E2_STEP_PIN EXP2_06_PIN + #define E2_DIR_PIN EXP2_05_PIN + #define E2_ENABLE_PIN EXP2_07_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E2_DIAG_PIN EXP1_05_PIN + #define E2_CS_PIN EXP1_06_PIN + #if HAS_TMC_UART + #define E2_SERIAL_TX_PIN EXP1_06_PIN + #define E2_SERIAL_RX_PIN EXP1_06_PIN + #endif + #endif - #define LCD_PINS_RS PB1 - #define LCD_PINS_EN PE11 - #define LCD_PINS_D4 PE10 + // M2 on Driver Expansion Module + #define E3_STEP_PIN EXP2_03_PIN + #define E3_DIR_PIN EXP2_04_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E3_ENABLE_PIN EXP1_08_PIN + #define E3_DIAG_PIN EXP1_03_PIN + #define E3_CS_PIN EXP1_04_PIN + #if HAS_TMC_UART + #define E3_SERIAL_TX_PIN EXP1_04_PIN + #define E3_SERIAL_RX_PIN EXP1_04_PIN + #endif + #else + #define E3_ENABLE_PIN EXP2_07_PIN + #endif - #if ENABLED(LCD_FOR_MELZI) + // M3 on Driver Expansion Module + #define E4_STEP_PIN EXP2_01_PIN + #define E4_DIR_PIN EXP2_02_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E4_ENABLE_PIN EXP1_07_PIN + #define E4_DIAG_PIN EXP1_01_PIN + #define E4_CS_PIN EXP1_02_PIN + #if HAS_TMC_UART + #define E4_SERIAL_TX_PIN EXP1_02_PIN + #define E4_SERIAL_RX_PIN EXP1_02_PIN + #endif + #else + #define E4_ENABLE_PIN EXP2_07_PIN + #endif - #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! LCD_FOR_MELZI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" - #endif +#endif // BTT_MOTOR_EXPANSION - /** LCD_FOR_MELZI display pinout - * - * BTT E3 RRF Display Ribbon - * ------ ------ - * (BEEPER) PE8 | 1 2 | PE9 (BTN_ENC) GND |10 9 | 5V - * (BTN_EN1) PE7 | 3 4 | RESET BEEPER | 8 7 | ESTOP (RESET) - * (BTN_EN2) PB2 5 6 | PE10 (LCD_D4) (BTN_ENC) ENC_BTN | 6 5 | LCD_SCLK (LCD_D4) - * (LCD_RS) PB1 | 7 8 | PE11 (LCD_EN) (BTN_EN2) ENC_A | 4 3 | LCD_DATA (LCD_EN) - * GND | 9 10 | 5V (BTN_EN1) ENC_B | 2 1 | LCD_CS (LCD_RS) - * ------ ------ - * EXP1 LCD - * - * Needs custom cable: - * - * Board Adapter Display Ribbon (coming from display) - * ---------------------------------- - * EXP1-10 ---------- LCD-9 5V - * EXP1-9 ----------- LCD-10 GND - * EXP1-8 ----------- LCD-3 LCD_EN - * EXP1-7 ----------- LCD-1 LCD_RS - * EXP1-6 ----------- LCD-5 LCD_D4 - * EXP1-5 ----------- LCD-4 EN2 - * EXP1-4 ----------- LCD-7 RESET - * EXP1-3 ----------- LCD-2 EN1 - * EXP1-2 ----------- LCD-6 BTN - * EXP1-1 ----------- LCD-8 BEEPER - */ +// +// LCDs and Controllers +// +#if IS_TFTGLCD_PANEL - #endif + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_03_PIN + #endif - #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! +#elif HAS_WIRED_LCD - #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" - #endif + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN - #define LCD_PINS_RS PE10 - #define LCD_PINS_EN PE9 - #define LCD_PINS_D4 PB1 - #define LCD_PINS_D5 PB2 - #define LCD_PINS_D6 PE7 - #define LCD_PINS_D7 PE8 - #define ADC_KEYPAD_PIN PB0 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! + #if ENABLED(CR10_STOCKDISPLAY) - #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #define LCD_PINS_RS EXP1_07_PIN - #define BTN_ENC PE9 - #define BTN_EN1 PE7 - #define BTN_EN2 PB2 + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN - #define DOGLCD_CS PB1 - #define DOGLCD_A0 PE10 - #define DOGLCD_SCK PE8 - #define DOGLCD_MOSI PE11 + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN - #define FORCE_SOFT_SPI - #define LCD_BACKLIGHT_PIN -1 + #elif ENABLED(MKS_MINI_12864) - #elif IS_TFTGLCD_PANEL + #define DOGLCD_A0 EXP1_07_PIN + #define DOGLCD_CS EXP1_06_PIN + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN - #if ENABLED(TFTGLCD_PANEL_SPI) + #else - #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN EXP1_06_PIN + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN EXP1_07_PIN + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN EXP1_08_PIN + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_06_PIN #endif + #endif // !FYSETC_MINI_12864 - /** - * TFTGLCD_PANEL_SPI display pinout - * - * Board Display - * ------ ------ - * (SD_DET) PE8 | 1 2 | PE9 (BEEPER) 5V |10 9 | GND - * (MOD_RESET) PE7 | 3 4 | RESET -- | 8 7 | (SD_DET) - * (SD_CS) PB2 5 6 | PE10 (MOSI) 6 5 | -- - * (LCD_CS) PB1 | 7 8 | PE11 (SD_CS) | 4 3 | (LCD_CS) - * GND | 9 10 | 5V (SCK) | 2 1 | (MISO) - * ------ ------ - * EXP1 EXP1 - * - * Needs custom cable: - * - * Board Adapter Display - * ---------------------------------- - * EXP1-10 ---------- EXP1-10 5V - * EXP1-9 ----------- EXP1-9 GND - * SPI1-4 ----------- EXP1-6 MOSI - * EXP1-7 ----------- n/c - * SPI1-3 ----------- EXP1-2 SCK - * EXP1-5 ----------- EXP1-4 SD_CS - * EXP1-4 ----------- n/c - * EXP1-3 ----------- EXP1-3 LCD_CS - * SPI1-1 ----------- EXP1-1 MISO - * EXP1-1 ----------- EXP1-7 SD_DET - */ - - #define TFTGLCD_CS PE7 + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN - #endif + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif - #else - #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, LCD_FOR_MELZI, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BTT_E3_RRF." - #endif + #endif - // Alter timing for graphical display - #if ENABLED(LCD_FOR_MELZI) // LCD_FOR_MELZI default timing is too fast. This works but may be reduced. - #define BOARD_ST7920_DELAY_1 200 - #define BOARD_ST7920_DELAY_2 400 - #define BOARD_ST7920_DELAY_3 1200 - #elif IS_U8GLIB_ST7920 - #define BOARD_ST7920_DELAY_1 96 - #define BOARD_ST7920_DELAY_2 48 - #define BOARD_ST7920_DELAY_3 600 #endif #endif // HAS_WIRED_LCD -#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if HAS_SPI_TFT - #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" - #endif + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN - /** FYSETC TFT TFT81050 display pinout - * - * Board Display - * ------ ------ - * (SD_DET) PE8 | 1 2 | PE9 (BEEPER) 5V |10 9 | GND - * (MOD_RESET) PE7 | 3 4 | RESET RESET | 8 7 | (SD_DET) - * (SD_CS) PB2 5 6 | PE10 (MOSI) | 6 5 | (LCD_CS) - * (LCD_CS) PB1 | 7 8 | PE11 (SD_CS) | 4 3 | (MOD_RESET) - * GND | 9 10 | 5V (SCK) | 2 1 | (MISO) - * ------ ------ - * EXP1 EXP1 - * - * Needs custom cable: - * - * Board Adapter Display - * ---------------------------------- - * EXP1-10 ---------- EXP1-10 5V - * EXP1-9 ----------- EXP1-9 GND - * SPI1-4 ----------- EXP1-6 MOSI - * EXP1-7 ----------- EXP1-5 LCD_CS - * SPI1-3 ----------- EXP1-2 SCK - * EXP1-5 ----------- EXP1-4 SD_CS - * EXP1-4 ----------- EXP1-8 RESET - * EXP1-3 ----------- EXP1-3 MOD_RST - * SPI1-1 ----------- EXP1-1 MISO - * EXP1-1 ----------- EXP1-7 SD_DET - */ + #if ENABLED(BTT_TFT35_SPI_V1_0) + // 480x320, 3.5", SPI Display with Rotary Encoder. + // Stock Display for the BIQU B1 SE. + #define TFT_CS_PIN EXP2_04_PIN + #define TFT_A0_PIN EXP2_07_PIN - #define CLCD_SPI_BUS 1 // SPI1 connector + #define TOUCH_CS_PIN EXP1_04_PIN + #define TOUCH_SCK_PIN EXP1_05_PIN + #define TOUCH_MISO_PIN EXP1_06_PIN + #define TOUCH_MOSI_PIN EXP1_03_PIN + #define TOUCH_INT_PIN EXP1_07_PIN - #define BEEPER_PIN PE9 + #elif ENABLED(MKS_TS35_V2_0) - #define CLCD_MOD_RESET PE7 - #define CLCD_SPI_CS PB1 + /** ------ ------ + * BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK + * TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS + * TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI + * SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | VCC + * ------ ------ + * EXP1 EXP2 + */ + #define TFT_CS_PIN EXP1_07_PIN // SPI1_CS + #define TFT_A0_PIN EXP1_08_PIN // SPI1_RS + #define TFT_DC_PIN TFT_DC_PIN -#endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 + #define TFT_RESET_PIN EXP1_04_PIN -// -// SD Support -// + #define LCD_BACKLIGHT_PIN EXP1_03_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN -#ifndef SDCARD_CONNECTION - #define SDCARD_CONNECTION ONBOARD -#endif + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 -#if SD_CONNECTION_IS(ONBOARD) - #define ONBOARD_SDIO // Use SDIO for onboard SD - //#define SDIO_CLOCK 48000000 - //#define SD_DETECT_PIN PC4 -#elif SD_CONNECTION_IS(CUSTOM_CABLE) - #error "SD CUSTOM_CABLE is not compatible with BTT E3 RRF." + #define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS + #define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK + #define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO + #define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI + + #define LCD_READ_ID 0xD3 + #define LCD_USE_DMA_SPI + + #define TFT_BUFFER_SIZE 14400 + + #endif + +#endif // HAS_SPI_TFT + +// Alter timing for graphical display +#if IS_U8GLIB_ST7920 + #ifndef BOARD_ST7920_DELAY_1 + #define BOARD_ST7920_DELAY_1 120 + #endif + #ifndef BOARD_ST7920_DELAY_2 + #define BOARD_ST7920_DELAY_2 80 + #endif + #ifndef BOARD_ST7920_DELAY_3 + #define BOARD_ST7920_DELAY_3 580 + #endif #endif -//#if ENABLED(WIFISUPPORT) +#if ENABLED(WIFISUPPORT) // // WIFI // -// #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this -// #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 -// #define ESP_WIFI_MODULE_RESET_PIN PA4 -// #define ESP_WIFI_MODULE_ENABLE_PIN PA5 -// #define ESP_WIFI_MODULE_GPIO0_PIN PA6 -//#endif + /** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PB11 | 13 | | 4 | -- + * -- | 14 | | 3 | 3.3V (ESP-EN) + * (ESP-RX) PD8 | 15 | | 2 | -- + * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) + * ------- + * WIFI + */ + #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 + #define ESP_WIFI_MODULE_RESET_PIN PE11 + #define ESP_WIFI_MODULE_GPIO0_PIN PE10 + #define ESP_WIFI_MODULE_GPIO4_PIN PE12 +#endif From abf5c0b17401c456146affcb4df44a2bf711df96 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 14 Jul 2023 20:39:40 +0100 Subject: [PATCH 06/12] one more Fly-E3-V2 change --- Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h index ee9bff1a9f19..48b8968d3203 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -29,6 +29,18 @@ #define BOARD_INFO_NAME "FLY_E3_V2" #endif +// If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION +// https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT +//#define BTT_MOTOR_EXPANSION + +#if ALL(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if ANY(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) + #define EXP_MOT_USE_EXP2_ONLY 1 + #else + #error "You can't use both an LCD and a Motor Expansion Module on EXP1/EXP2 at the same time." + #endif +#endif + // Use one of these or SDCard-based Emulation will be used #if NO_EEPROM_SELECTED //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation @@ -476,19 +488,6 @@ // WIFI // - /** - * ------- - * GND | 9 | | 8 | 3.3V - * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) - * 3.3V | 11 | | 6 | PB14 (ESP-MISO) - * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) - * (ESP-IO4) PB11 | 13 | | 4 | -- - * -- | 14 | | 3 | 3.3V (ESP-EN) - * (ESP-RX) PD8 | 15 | | 2 | -- - * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) - * ------- - * WIFI - */ #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 #define ESP_WIFI_MODULE_RESET_PIN PE11 From 3b8060ef4d38058574dba1001ef713a0baa38ffa Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 17 Jul 2023 07:30:52 +0100 Subject: [PATCH 07/12] Changes as requested also merged recent SKR2 TFT changes --- Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h | 38 ++++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h index 48b8968d3203..123b664286ce 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h @@ -26,7 +26,7 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "FLY_E3_V2" + #define BOARD_INFO_NAME "MELLOW_FLY_E3_V2" #endif // If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION @@ -53,8 +53,6 @@ #define FLASH_EEPROM_LEVELING #endif -#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support - // // Servos // @@ -417,15 +415,27 @@ #if HAS_SPI_TFT + #define TFT_SCK_PIN EXP2_02_PIN + #define TFT_MISO_PIN EXP2_01_PIN + #define TFT_MOSI_PIN EXP2_06_PIN + #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP2_03_PIN #define BTN_EN2 EXP2_05_PIN + #ifndef TFT_WIDTH + #define TFT_WIDTH 480 + #endif + #ifndef TFT_HEIGHT + #define TFT_HEIGHT 320 + #endif + #if ENABLED(BTT_TFT35_SPI_V1_0) // 480x320, 3.5", SPI Display with Rotary Encoder. // Stock Display for the BIQU B1 SE. #define TFT_CS_PIN EXP2_04_PIN - #define TFT_A0_PIN EXP2_07_PIN + #define TFT_DC_PIN EXP2_07_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN @@ -433,6 +443,22 @@ #define TOUCH_MOSI_PIN EXP1_03_PIN #define TOUCH_INT_PIN EXP1_07_PIN + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 17540 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y -11388 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X -21 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 337 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + #elif ENABLED(MKS_TS35_V2_0) /** ------ ------ @@ -445,8 +471,8 @@ * EXP1 EXP2 */ #define TFT_CS_PIN EXP1_07_PIN // SPI1_CS - #define TFT_A0_PIN EXP1_08_PIN // SPI1_RS - #define TFT_DC_PIN TFT_DC_PIN + #define TFT_DC_PIN EXP1_08_PIN // SPI1_RS + #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_04_PIN From c836e8536ad8d9ecdd95a602c7fa2d154ce62683 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:50:10 -0700 Subject: [PATCH 08/12] Update name, adjust comments, pins format --- Marlin/src/core/boards.h | 2 +- Marlin/src/pins/pins.h | 4 +-- ...ns_FLY_E3_V2.h => pins_MELLOW_FLY_E3_V2.h} | 28 +++++++++---------- ini/stm32f4.ini | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) rename Marlin/src/pins/stm32f4/{pins_FLY_E3_V2.h => pins_MELLOW_FLY_E3_V2.h} (95%) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 2141788bd06e..e5431dfc33f3 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -458,7 +458,7 @@ #define BOARD_CREALITY_F401RE 5245 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 #define BOARD_BLACKPILL_CUSTOM 5246 // Custom board based on STM32F401CDU6. #define BOARD_I3DBEEZ9_V1 5247 // I3DBEEZ9 V1 (STM32F407ZG) -#define BOARD_FLY_E3_V2 5248 // Fly-E3-v2 (STM32F407VG) +#define BOARD_MELLOW_FLY_E3_V2 5248 // Mellow Fly E3 V2 (STM32F407VG) // // ARM Cortex-M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 1bbb7eb84292..a61999cde81f 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -802,8 +802,8 @@ #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink #elif MB(I3DBEEZ9_V1) #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 -#elif MB(FLY_E3_V2) - #include "stm32f4/pins_FLY_E3_V2.h" // STM32F4 env:FLY_E3_V2 +#elif MB(MELLOW_FLY_E3_V2) + #include "stm32f4/pins_MELLOW_FLY_E3_V2.h" // STM32F4 env:FLY_E3_V2 // // ARM Cortex-M7 diff --git a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h similarity index 95% rename from Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h rename to Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h index 123b664286ce..cfe3b5a0fadf 100644 --- a/Marlin/src/pins/stm32f4/pins_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h @@ -26,7 +26,7 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "MELLOW_FLY_E3_V2" + #define BOARD_INFO_NAME "Mellow Fly E3 V2" #endif // If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION @@ -140,7 +140,6 @@ #define E1_CS_PIN PD0 #endif - // // Temperature Sensors // @@ -152,26 +151,26 @@ // Heaters / Fans // #ifndef HEATER_BED_PIN - #define HEATER_BED_PIN PB0 // "HB" + #define HEATER_BED_PIN PB0 // "HB" #endif #ifndef HEATER_0_PIN - #define HEATER_0_PIN PC6 // "HE0" + #define HEATER_0_PIN PC6 // "HE0" #endif #ifndef HEATER_1_PIN - #define HEATER_1_PIN PC7 // "HE0" + #define HEATER_1_PIN PC7 // "HE0" #endif #ifndef FAN0_PIN - #define FAN0_PIN PA0 // "FAN0" + #define FAN0_PIN PA0 // "FAN0" #endif #ifndef FAN1_PIN - #define FAN1_PIN PA1 + #define FAN1_PIN PA1 #endif #ifndef FAN2_PIN - #define FAN2_PIN PA2 + #define FAN2_PIN PA2 #endif #ifndef FAN3_PIN - #define FAN3_PIN PA3 + #define FAN3_PIN PA3 #endif #ifndef TMC_SPI_MOSI @@ -232,7 +231,6 @@ #define SDCARD_CONNECTION ONBOARD #endif - /** * Fly-E3-v2 * ------ ------ @@ -424,10 +422,10 @@ #define BTN_EN2 EXP2_05_PIN #ifndef TFT_WIDTH - #define TFT_WIDTH 480 + #define TFT_WIDTH 480 #endif #ifndef TFT_HEIGHT - #define TFT_HEIGHT 320 + #define TFT_HEIGHT 320 #endif #if ENABLED(BTT_TFT35_SPI_V1_0) @@ -435,7 +433,7 @@ // Stock Display for the BIQU B1 SE. #define TFT_CS_PIN EXP2_04_PIN #define TFT_DC_PIN EXP2_07_PIN - #define TFT_A0_PIN TFT_DC_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_SCK_PIN EXP1_05_PIN @@ -456,7 +454,7 @@ #define TOUCH_OFFSET_Y 337 #endif #ifndef TOUCH_ORIENTATION - #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE #endif #elif ENABLED(MKS_TS35_V2_0) @@ -480,7 +478,7 @@ #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI - #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 + #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 #define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS #define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 2680effa6b44..c214e863303f 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -808,7 +808,7 @@ debug_tool = stlink upload_protocol = stlink # -# FLY-E3-V2 +# Mellow Fly E3 V2 (STM32F407VGT6 ARM Cortex-M4) # [env:FLY_E3_V2] extends = stm32_variant From 0f956ca3847d41fbd7b038fee8dba808c8e07186 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 7 Aug 2023 00:27:38 -0500 Subject: [PATCH 09/12] No FD on the Fly E3 V2 --- Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h | 2 +- ini/stm32f4.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h index cfe3b5a0fadf..306441ca84ed 100644 --- a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index c214e863303f..32cbdea17997 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -812,12 +812,12 @@ upload_protocol = stlink # [env:FLY_E3_V2] extends = stm32_variant -platform_packages = ${stm_flash_drive.platform_packages} +platform_packages = ${stm32_variant.platform_packages} board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_F4x7Vx board_build.offset = 0x8000 board_upload.offset_address = 0x08008000 -build_flags = ${stm_flash_drive.build_flags} +build_flags = ${stm32_variant.build_flags} -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED From a89c9975c6347f8d4324dc8a0aa972ad8a348db0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 7 Aug 2023 15:48:09 -0500 Subject: [PATCH 10/12] No platform_packages field --- ini/stm32f4.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 32cbdea17997..212e9baff7f5 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -812,7 +812,6 @@ upload_protocol = stlink # [env:FLY_E3_V2] extends = stm32_variant -platform_packages = ${stm32_variant.platform_packages} board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_F4x7Vx board_build.offset = 0x8000 From f2d9f7bda7d051b64ae4d17bc3bd64f1d796a9e1 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 20 Aug 2023 14:50:50 +0100 Subject: [PATCH 11/12] finish support --- .../src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h | 2 ++ ini/stm32f4.ini | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h index 306441ca84ed..a5e55eb1cfcc 100644 --- a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h @@ -518,3 +518,5 @@ #define ESP_WIFI_MODULE_GPIO0_PIN PE10 #define ESP_WIFI_MODULE_GPIO4_PIN PE12 #endif + +//#define POWER_MONITOR_VOLTAGE_PIN PC3 \ No newline at end of file diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 0a844f05234c..f36bb74986dd 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -817,8 +817,16 @@ board_build.variant = MARLIN_F4x7Vx board_build.offset = 0x8000 board_upload.offset_address = 0x08008000 build_flags = ${stm32_variant.build_flags} - -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS - -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 - -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED - -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 -upload_protocol = stlink + -DHAVE_HWSERIAL1 + -DHAVE_HWSERIAL3 + -DPIN_SERIAL1_RX=PA_10 + -DPIN_SERIAL1_TX=PA_9 + -DHAL_SD_MODULE_ENABLED + -DPIN_SERIAL3_RX=PD_9 + -DPIN_SERIAL3_TX=PD_8 + -DUSE_USBHOST_HS + -DUSE_USB_HS_IN_FS + -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DHSE_VALUE=8000000U +upload_protocol = stlink \ No newline at end of file From cc07eead28083b53286d80f987b15a19fc68b729 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 25 Aug 2023 18:39:10 -0500 Subject: [PATCH 12/12] misc. cleanup --- Marlin/src/pins/stm32f4/pins_CREALITY_F401.h | 2 +- Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h | 11 +++++------ .../src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h | 2 +- ini/stm32f4.ini | 17 ++++++----------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h b/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h index f4b5b7d96a72..b4c5bad0938a 100644 --- a/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h @@ -140,7 +140,7 @@ //#define LED_CONTROL_PIN PA7 // -// WiFI Reset +// WiFi Reset // #ifdef MENU_RESET_WIFI #define RESET_WIFI_PIN PB12 diff --git a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h index a5e55eb1cfcc..39073bffceca 100644 --- a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h @@ -507,16 +507,15 @@ #endif #endif -#if ENABLED(WIFISUPPORT) - // - // WIFI - // +//#define POWER_MONITOR_VOLTAGE_PIN PC3 +// +// WiFi +// +#if ENABLED(WIFISUPPORT) #define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 #define ESP_WIFI_MODULE_RESET_PIN PE11 #define ESP_WIFI_MODULE_GPIO0_PIN PE10 #define ESP_WIFI_MODULE_GPIO4_PIN PE12 #endif - -//#define POWER_MONITOR_VOLTAGE_PIN PC3 \ No newline at end of file diff --git a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h index 9d30d853b5dd..ded9ec4e8913 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h @@ -449,7 +449,7 @@ #endif // -// WIFI +// WiFi // #if ENABLED(WIFISUPPORT) /** diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index f36bb74986dd..454337295d29 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -817,16 +817,11 @@ board_build.variant = MARLIN_F4x7Vx board_build.offset = 0x8000 board_upload.offset_address = 0x08008000 build_flags = ${stm32_variant.build_flags} - -DHAVE_HWSERIAL1 - -DHAVE_HWSERIAL3 - -DPIN_SERIAL1_RX=PA_10 - -DPIN_SERIAL1_TX=PA_9 + -DHAVE_HWSERIAL1 -DHAVE_HWSERIAL3 + -DPIN_SERIAL1_RX=PA_10 -DPIN_SERIAL1_TX=PA_9 + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 -DHAL_SD_MODULE_ENABLED - -DPIN_SERIAL3_RX=PD_9 - -DPIN_SERIAL3_TX=PD_8 - -DUSE_USBHOST_HS - -DUSE_USB_HS_IN_FS - -DUSBD_IRQ_PRIO=5 - -DUSBD_IRQ_SUBPRIO=6 + -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS + -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DHSE_VALUE=8000000U -upload_protocol = stlink \ No newline at end of file +upload_protocol = stlink