From 9aee6674bb1ffca1057de2c14b5ae79d6d4b875a Mon Sep 17 00:00:00 2001 From: Foxies Date: Thu, 22 Oct 2020 02:00:57 +0200 Subject: [PATCH 1/4] FLSUN Delta QQS-Pro pins (#19793) --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 366 ++++++++++++++++++ .../share/PlatformIO/scripts/add_nanolib.py | 2 + platformio.ini | 15 + 5 files changed, 386 insertions(+) create mode 100644 Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h create mode 100644 buildroot/share/PlatformIO/scripts/add_nanolib.py diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 1854e42ec2..e115903342 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -325,6 +325,7 @@ #define BOARD_CREALITY_V427 4036 // Creality v4.2.7 (STM32F103RE) #define BOARD_TRIGORILLA_PRO 4037 // Trigorilla Pro (STM32F103ZET6) #define BOARD_FLY_MINI 4038 // FLY MINI (STM32F103RCT6) +#define BOARD_FLSUN_HISPEED 4039 // FLSUN HiSpeedV1 (STM32F103VET6) // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index f43214f7be..3a380def74 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -581,6 +581,8 @@ #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro #elif MB(FLY_MINI) #include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI +#elif MB(FLSUN_HISPEED) + #include "stm32f1/pins_FLSUN_HISPEED.h" // STM32F1 env:flsun_hispeed // // ARM Cortex-M4F diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h new file mode 100644 index 0000000000..7f3ab03654 --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -0,0 +1,366 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 + +/** + * FLSUN HiSpeed V1 (STM32F103VET6) board pin assignments + * FLSun Hispeed (clone MKS_Robin_miniV2) board. + * + * MKS Robin Mini USB uses UART3 (PB10-TX, PB11-RX) + * #define SERIAL_PORT_2 3 + */ + +#if NOT_TARGET(__STM32F1__, STM32F1xx) + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" +#elif HOTENDS > 1 || E_STEPPERS > 1 + #error "FLSUN HiSpeedV1 supports 1 hotend / E-stepper. Comment out this line to continue." +#endif + +#define BOARD_INFO_NAME "FLSun HiSpeedV1" +#define BOARD_WEBSITE_URL "github.com/Foxies-CSTL" + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + +// +// EEPROM +// +#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) + #define FLASH_EEPROM_EMULATION + #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB +#endif + +// SPI +// Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface. +// +#define ENABLE_SPI2 + +// SPI Flash +#define HAS_SPI_FLASH 1 +#define SPI_FLASH_SIZE 0x1000000 // 16MB + +#if HAS_SPI_FLASH + // SPI 2 + #define W25QXX_CS_PIN PB12 // SPI2_NSS / Flash chip-select + #define W25QXX_MOSI_PIN PB15 + #define W25QXX_MISO_PIN PB14 + #define W25QXX_SCK_PIN PB13 +#endif + +// +// Servos +// +//#define SERVO0_PIN PA8 // use IO0 to enable BLTOUCH support/remove Mks_Wifi + +// +// Limit Switches +// +#define X_STOP_PIN PA15 // -X +#define Y_STOP_PIN PA12 // -Y +#define Z_MIN_PIN PA11 // -Z +#define Z_MAX_PIN PC4 // +Z + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN MT_DET_1_PIN +#endif + +// +// Steppers +// +#define X_ENABLE_PIN PE4 // X_EN +#define X_STEP_PIN PE3 // X_STEP +#define X_DIR_PIN PE2 // X_DIR + +#define Y_ENABLE_PIN PE1 // Y_EN +#define Y_STEP_PIN PE0 // Y_STEP +#define Y_DIR_PIN PB9 // Y_DIR + +#define Z_ENABLE_PIN PB8 // Z_EN +#define Z_STEP_PIN PB5 // Z_STEP +#define Z_DIR_PIN PB4 // Z_DIR + +#define E0_ENABLE_PIN PB3 // E0_EN +#define E0_STEP_PIN PD6 // E0_STEP +#define E0_DIR_PIN PD3 // E0_DIR + +// +// Drivers +// +#if HAS_TMC220x + + #if ENABLED(HARDWARE_SERIAL) /* TMC2209 */ + #define X_SLAVE_ADDRESS 3 // | | : + #define Y_SLAVE_ADDRESS 2 // : | : + #define Z_SLAVE_ADDRESS 1 // | : : + //#define E0_SLAVE_ADDRESS 0 // : : : + + #define X_SERIAL_TX_PIN PA9 // TXD1 + #define X_SERIAL_RX_PIN PA9 // TXD1 + + #define Y_SERIAL_TX_PIN PA9 // TXD1 + #define Y_SERIAL_RX_PIN PA9 // TXD1 + + #define Z_SERIAL_TX_PIN PA9 // TXD1 + #define Z_SERIAL_RX_PIN PA9 // TXD1 + + #elif ENABLED(SOFTWARE_SERIAL) /* TMC220x */ + /** + * TMC2208 stepper UART-configurable by PDN_UART pin + * Software serial + */ + #define X_SLAVE_ADDRESS 0 + #define Y_SLAVE_ADDRESS 0 + #define Z_SLAVE_ADDRESS 0 + + #define X_SERIAL_TX_PIN PA10 // RXD1 + #define X_SERIAL_RX_PIN PA10 // RXD1 + + #define Y_SERIAL_TX_PIN PA9 // TXD1 + #define Y_SERIAL_RX_PIN PA9 // TXD1 + + #define Z_SERIAL_TX_PIN PC7 // IO1 + #define Z_SERIAL_RX_PIN PC7 // IO1 + + #endif + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#else + + // Motor current PWM pins + #define MOTOR_CURRENT_PWM_XY_PIN PA6 // VREF2/3 CONTROL XY + #define MOTOR_CURRENT_PWM_Z_PIN PA7 // VREF4 CONTROL Z + #define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp + #ifndef DEFAULT_PWM_MOTOR_CURRENT + #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 } + #endif + + /** + * src: MKS Robin_Mini V2 + * __ESP(M1)__ -J1- + * GND| 15 | | 08 |+3v3 (22)=>RXD1(PA10) // + * | 16 | | 07 |MOSI (21)=>TXD1(PA9) // active low, probably OK to leave floating + * IO2| 17 | | 06 |MISO (19)=>IO1(PC7) // Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) + * IO0| 18 | | 05 |CLK (18)=>IO0(PA8) // must be high (ESP3D software configures this with a pullup so OK to leave as floating) + * IO1| 19 | | 03 |EN (03)=>WIFI_EN() // Must be high for module to run + * | nc | | nc | (01)=>WIFI_CTRL(PA5) + * RX| 21 | | nc | + * TX| 22 | | 01 |RST + *  ̄ ̄ AE ̄ ̄ + * + */ + #ifdef ESP_WIFI + #define WIFI_IO0_PIN PA8 // PC13 MKS ESP WIFI IO0 PIN + #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN + #define WIFI_RESET_PIN PA5 // MKS ESP WIFI RESET PIN + #endif +#endif + +// +// EXTRUDER +// +#if AXIS_DRIVER_TYPE(E0,TMC2208)||AXIS_DRIVER_TYPE(E0,TMC2209) + #define E0_SLAVE_ADDRESS 0 + + #define E0_SERIAL_TX_PIN PA8 // IO0 + #define E0_SERIAL_RX_PIN PA8 // IO0 + #define TMC_BAUD_RATE 19200 +#else + // Motor current PWM pins + #define MOTOR_CURRENT_PWM_E_PIN PB0 // VREF1 CONTROL E + #define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp + #ifndef DEFAULT_PWM_MOTOR_CURRENT + #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 } + #endif +#endif + +// +// Temperature Sensors(THM) +// +#define TEMP_0_PIN PC1 // TEMP_E0 +#define TEMP_BED_PIN PC0 // TEMP_BED + +// +// Heaters / Fans +// +#define HEATER_0_PIN PC3 // HEATER_E0 +#define HEATER_BED_PIN PA0 // HEATER_BED-WKUP + +#define FAN_PIN PB1 // E_FAN +//#define CONTROLLER_FAN_PIN PD6 // BOARD FAN + +// +// Misc. Functions +// +//#define POWER_LOSS_PIN PA1 // PW_SO +#if ENABLED(BACKUP_POWER_SUPPLY) + #define POWER_LOSS_PIN PA2 // PW_DET (UPS) MKSPWC +#endif + +// +// Power Supply Control +// +#if ENABLED(PSU_CONTROL) + #define KILL_PIN PA2 // PW_DET + #define KILL_PIN_INVERTING true // + //#define PS_ON_PIN PA3 // PW_CN /PW_OFF +#endif + +#define MT_DET_1_PIN PA4 // MT_DET +#define MT_DET_2_PIN PE6 // FALA_CRTL +#define MT_DET_PIN_INVERTING false + +// +// LED / NEOPixel +// +//#define LED_PIN PB2 // BOOT1 + +#if ENABLED(NEOPIXEL_LED) + #define LED_PWM PA8 + #ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN LED_PWM // USED WIFI IO0/IO1/TX/RX PIN + #endif +#endif + +//Others test. +//#define SERVO0_PIN PA5 // WIFI CRTL +//#define GPIO_CLEAR PA8 // IO0 +//#define GPIO_SET PA5 + +// +// SD Card +// +#define SDIO_SUPPORT +#define SDIO_CLOCK 4500000 // 4.5 MHz /* 18 MHz (18000000) or 4.5MHz (450000) */ +//#define SDIO_CLOCK 18000000 // 18 MHz (18000000) +#if ENABLED(SDIO_SUPPORT) + #define SCK_PIN PB13 // SPI2 + #define MISO_PIN PB14 // SPI2 + #define MOSI_PIN PB15 // SPI2 + #define SD_DETECT_PIN PD12 // SD_CD +#endif + +// +// LCD / Controller +// +#ifndef BEEPER_PIN + #define BEEPER_PIN PC5 +#endif + +/** + * Note: MKS Robin TFT screens use various TFT controllers + * Supported screens are based on the ILI9341, ST7789V and ILI9328 (320x240) + * ILI9488 is not supported + * Define init sequences for other screens in u8g_dev_tft_320x240_upscale_from_128x64.cpp + * + * If the screen stays white, disable 'LCD_RESET_PIN' + * to let the bootloader init the screen. + * + * Setting an 'LCD_RESET_PIN' may cause a flicker when entering the LCD menu + * because Marlin uses the reset as a failsafe to revive a glitchy LCD. + */ + +// MKS Robin TFT v2.0 with ILI9341 +// Read display identification information (0xD3 on ILI9341) +//#define XPT2046_X_CALIBRATION 12013 +//#define XPT2046_Y_CALIBRATION -8711 +//#define XPT2046_X_OFFSET -32 +//#define XPT2046_Y_OFFSET 256 + +// MKS Robin TFT v1.1 with ILI9328 +//#define XPT2046_X_CALIBRATION -11792 +//#define XPT2046_Y_CALIBRATION 8947 +//#define XPT2046_X_OFFSET 342 +//#define XPT2046_Y_OFFSET -19 + +// MKS Robin TFT v1.1 with R61505 +//#define XPT2046_X_CALIBRATION 12489 +//#define XPT2046_Y_CALIBRATION 9210 +//#define XPT2046_X_OFFSET -52 +//#define XPT2046_Y_OFFSET -17 + +// QQS-Pro uses MKS Robin TFT v2.0 + +// Shared FSMC Configs +#if HAS_FSMC_TFT + #define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h + #define DOGLCD_SCK -1 + + #define FSMC_CS_PIN PD7 // NE4 + #define FSMC_RS_PIN PD11 // A0 + + #define TFT_RESET_PIN PC6 // FSMC_RST + #define TFT_BACKLIGHT_PIN PD13 + + #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT + #define FSMC_DMA_DEV DMA2 + #define FSMC_DMA_CHANNEL DMA_CH5 + + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 2 +#endif + +// XPT2046 Touch Screen calibration +#if EITHER(TFT_LVGL_UI_FSMC, TFT_COLOR_UI) + #define TFT_BUFFER_SIZE 14400 + + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 12218 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -8814 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -35 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 256 + #endif + +#elif ENABLED(TFT_CLASSIC_UI) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 12149 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -8746 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -35 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 256 + #endif + + #define TFT_MARLINUI_COLOR 0xFFFF // White + #define TFT_BTARROWS_COLOR 0xDEE6 // 11011 110111 00110 Yellow + #define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan +#endif + +#if NEED_TOUCH_PINS + #define TOUCH_CS_PIN PC2 // SPI2_NSS + #define TOUCH_SCK_PIN PB13 // SPI2_SCK + #define TOUCH_MISO_PIN PB14 // SPI2_MISO + #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI +#endif diff --git a/buildroot/share/PlatformIO/scripts/add_nanolib.py b/buildroot/share/PlatformIO/scripts/add_nanolib.py new file mode 100644 index 0000000000..102b4b9bb0 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/add_nanolib.py @@ -0,0 +1,2 @@ +Import("env") +env.Append(LINKFLAGS=["--specs=nano.specs"]) diff --git a/platformio.ini b/platformio.ini index 8416b93a27..326dca172f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1133,6 +1133,21 @@ debug_tool = jlink upload_protocol = jlink monitor_speed = 115200 +# +# FLSUN QQ (STM32F103VET6) +# +[env:flsun_hispeed] +platform = ${common_stm32f1.platform} +extends = common_stm32f1 +board = genericSTM32F103VE +platform_packages = tool-stm32duino +extra_scripts = ${common.extra_scripts} + buildroot/share/PlatformIO/scripts/mks_robin_mini.py + buildroot/share/PlatformIO/scripts/add_nanolib.py +build_flags = ${common_stm32f1.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 +lib_deps = SoftwareSerialM + #Adafruit NeoPixel=https://github.com/Foxies-CSTL/Robin-NeoPixel-Lib/archive/master.zip + # # STM32F401VE # 'STEVAL-3DP001V1' STM32F401VE board - https://www.st.com/en/evaluation-tools/steval-3dp001v1.html From ec596315bd292d6ced44a543502fe80036456dd7 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 22 Oct 2020 00:16:17 +0000 Subject: [PATCH 2/4] [cron] Bump distribution date (2020-10-22) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a4c9aebbb0..9c3407074f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-10-21" + #define STRING_DISTRIBUTION_DATE "2020-10-22" #endif /** From 4fccb92e072463bd6147b2ce22352b79337cb53c Mon Sep 17 00:00:00 2001 From: ManuelMcLure Date: Thu, 22 Oct 2020 04:27:33 -0700 Subject: [PATCH 3/4] Configure TMC interpolation per driver (#19828) --- Marlin/Configuration_adv.h | 27 +++++++++++++-- Marlin/src/feature/tmc_util.cpp | 13 ++++++- Marlin/src/inc/Conditionals_post.h | 48 ++++++++++++++++++++++++++ Marlin/src/module/stepper/trinamic.cpp | 30 ++++++++-------- 4 files changed, 99 insertions(+), 19 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index fc77345b9b..31661a582e 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2261,14 +2261,20 @@ #if HAS_TRINAMIC_CONFIG #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current - #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + /** + * Interpolate microsteps to 256 + * Override for each driver with _INTERPOLATE settings below + */ + #define INTERPOLATE true #if AXIS_IS_TMC(X) #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing - #define X_MICROSTEPS 16 // 0..256 + #define X_MICROSTEPS 16 // 0..256 #define X_RSENSE 0.11 - #define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ... + #define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ... + //#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis #endif #if AXIS_IS_TMC(X2) @@ -2277,6 +2283,7 @@ #define X2_MICROSTEPS 16 #define X2_RSENSE 0.11 #define X2_CHAIN_POS -1 + //#define X2_INTERPOLATE true #endif #if AXIS_IS_TMC(Y) @@ -2285,6 +2292,7 @@ #define Y_MICROSTEPS 16 #define Y_RSENSE 0.11 #define Y_CHAIN_POS -1 + //#define Y_INTERPOLATE true #endif #if AXIS_IS_TMC(Y2) @@ -2293,6 +2301,7 @@ #define Y2_MICROSTEPS 16 #define Y2_RSENSE 0.11 #define Y2_CHAIN_POS -1 + //#define Y2_INTERPOLATE true #endif #if AXIS_IS_TMC(Z) @@ -2301,6 +2310,7 @@ #define Z_MICROSTEPS 16 #define Z_RSENSE 0.11 #define Z_CHAIN_POS -1 + //#define Z_INTERPOLATE true #endif #if AXIS_IS_TMC(Z2) @@ -2309,6 +2319,7 @@ #define Z2_MICROSTEPS 16 #define Z2_RSENSE 0.11 #define Z2_CHAIN_POS -1 + //#define Z2_INTERPOLATE true #endif #if AXIS_IS_TMC(Z3) @@ -2317,6 +2328,7 @@ #define Z3_MICROSTEPS 16 #define Z3_RSENSE 0.11 #define Z3_CHAIN_POS -1 + //#define Z3_INTERPOLATE true #endif #if AXIS_IS_TMC(Z4) @@ -2325,6 +2337,7 @@ #define Z4_MICROSTEPS 16 #define Z4_RSENSE 0.11 #define Z4_CHAIN_POS -1 + //#define Z4_INTERPOLATE true #endif #if AXIS_IS_TMC(E0) @@ -2332,6 +2345,7 @@ #define E0_MICROSTEPS 16 #define E0_RSENSE 0.11 #define E0_CHAIN_POS -1 + //#define E0_INTERPOLATE true #endif #if AXIS_IS_TMC(E1) @@ -2339,6 +2353,7 @@ #define E1_MICROSTEPS 16 #define E1_RSENSE 0.11 #define E1_CHAIN_POS -1 + //#define E1_INTERPOLATE true #endif #if AXIS_IS_TMC(E2) @@ -2346,6 +2361,7 @@ #define E2_MICROSTEPS 16 #define E2_RSENSE 0.11 #define E2_CHAIN_POS -1 + //#define E2_INTERPOLATE true #endif #if AXIS_IS_TMC(E3) @@ -2353,6 +2369,7 @@ #define E3_MICROSTEPS 16 #define E3_RSENSE 0.11 #define E3_CHAIN_POS -1 + //#define E3_INTERPOLATE true #endif #if AXIS_IS_TMC(E4) @@ -2360,6 +2377,7 @@ #define E4_MICROSTEPS 16 #define E4_RSENSE 0.11 #define E4_CHAIN_POS -1 + //#define E4_INTERPOLATE true #endif #if AXIS_IS_TMC(E5) @@ -2367,6 +2385,7 @@ #define E5_MICROSTEPS 16 #define E5_RSENSE 0.11 #define E5_CHAIN_POS -1 + //#define E5_INTERPOLATE true #endif #if AXIS_IS_TMC(E6) @@ -2374,6 +2393,7 @@ #define E6_MICROSTEPS 16 #define E6_RSENSE 0.11 #define E6_CHAIN_POS -1 + //#define E6_INTERPOLATE true #endif #if AXIS_IS_TMC(E7) @@ -2381,6 +2401,7 @@ #define E7_MICROSTEPS 16 #define E7_RSENSE 0.11 #define E7_CHAIN_POS -1 + //#define E7_INTERPOLATE true #endif /** diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 781253079e..d27177326b 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -497,7 +497,8 @@ TMC_HEND, TMC_HSTRT, TMC_SGT, - TMC_MSCNT + TMC_MSCNT, + TMC_INTERPOLATE }; enum TMC_drv_status_enum : char { TMC_DRV_CODES, @@ -553,6 +554,7 @@ case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; + case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break; default: break; } } @@ -588,6 +590,7 @@ SERIAL_ECHOPGM("/256"); } break; + case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break; default: break; } } @@ -603,6 +606,7 @@ case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break; case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('*'); break; case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('*'); break; + case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break; default: break; } } @@ -644,6 +648,12 @@ #if HAS_DRIVER(TMC2660) static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { } + static void _tmc_status(TMC2660Stepper &st, const TMC_debug_enum i) { + switch (i) { + case TMC_INTERPOLATE: serialprint_truefalse(st.intpol()); break; + default: break; + } + } #endif template @@ -902,6 +912,7 @@ #endif TMC_REPORT("stealthChop", TMC_STEALTHCHOP); TMC_REPORT("msteps\t", TMC_MICROSTEPS); + TMC_REPORT("interp\t", TMC_INTERPOLATE); TMC_REPORT("tstep\t", TMC_TSTEP); TMC_REPORT("PWM thresh.", TMC_TPWMTHRS); TMC_REPORT("[mm/s]\t", TMC_TPWMTHRS_MMS); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 3587d82cda..bb717ba097 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1608,6 +1608,54 @@ #define Y_SPI_SENSORLESS Y_SENSORLESS #define Z_SPI_SENSORLESS Z_SENSORLESS #endif + #ifndef X_INTERPOLATE + #define X_INTERPOLATE INTERPOLATE + #endif + #ifndef X2_INTERPOLATE + #define X2_INTERPOLATE INTERPOLATE + #endif + #ifndef Y_INTERPOLATE + #define Y_INTERPOLATE INTERPOLATE + #endif + #ifndef Y2_INTERPOLATE + #define Y2_INTERPOLATE INTERPOLATE + #endif + #ifndef Z_INTERPOLATE + #define Z_INTERPOLATE INTERPOLATE + #endif + #ifndef Z2_INTERPOLATE + #define Z2_INTERPOLATE INTERPOLATE + #endif + #ifndef Z3_INTERPOLATE + #define Z3_INTERPOLATE INTERPOLATE + #endif + #ifndef Z4_INTERPOLATE + #define Z4_INTERPOLATE INTERPOLATE + #endif + #ifndef E0_INTERPOLATE + #define E0_INTERPOLATE INTERPOLATE + #endif + #ifndef E1_INTERPOLATE + #define E1_INTERPOLATE INTERPOLATE + #endif + #ifndef E2_INTERPOLATE + #define E2_INTERPOLATE INTERPOLATE + #endif + #ifndef E3_INTERPOLATE + #define E3_INTERPOLATE INTERPOLATE + #endif + #ifndef E4_INTERPOLATE + #define E4_INTERPOLATE INTERPOLATE + #endif + #ifndef E5_INTERPOLATE + #define E5_INTERPOLATE INTERPOLATE + #endif + #ifndef E6_INTERPOLATE + #define E6_INTERPOLATE INTERPOLATE + #endif + #ifndef E7_INTERPOLATE + #define E7_INTERPOLATE INTERPOLATE + #endif #endif #if (HAS_E_DRIVER(TMC2660) \ diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index ad11046f62..c33581d132 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -36,7 +36,7 @@ #include enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; -#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST) +#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST, ST##_INTERPOLATE) // IC = TMC model number // ST = Stepper object letter @@ -131,13 +131,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC2130) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { st.begin(); CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); @@ -166,13 +166,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC2160) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { st.begin(); CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); @@ -484,7 +484,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC2208) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { TMC2208_n::GCONF_t gconf{0}; gconf.pdn_disable = true; // Use UART gconf.mstep_reg_select = true; // Select microsteps with UART @@ -496,7 +496,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; TMC2208_n::CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; // blank_time = 24 chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); @@ -526,7 +526,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC2209) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { TMC2208_n::GCONF_t gconf{0}; gconf.pdn_disable = true; // Use UART gconf.mstep_reg_select = true; // Select microsteps with UART @@ -538,7 +538,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; TMC2208_n::CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; // blank_time = 24 chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); @@ -568,7 +568,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC2660) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init, const bool interpolate) { st.begin(); TMC2660_n::CHOPCONF_t chopconf{0}; @@ -582,7 +582,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; st.rms_current(mA); st.microsteps(microsteps); TERN_(SQUARE_WAVE_STEPPING, st.dedge(true)); - st.intpol(INTERPOLATE); + st.intpol(interpolate); st.diss2g(true); // Disable short to ground protection. Too many false readings? TERN_(TMC_DEBUG, st.rdsel(0b01)); } @@ -590,13 +590,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC5130) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { st.begin(); CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); @@ -625,13 +625,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #if HAS_DRIVER(TMC5160) template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { st.begin(); CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; chopconf.toff = chop_init.toff; - chopconf.intpol = INTERPOLATE; + chopconf.intpol = interpolate; chopconf.hend = chop_init.hend + 3; chopconf.hstrt = chop_init.hstrt - 1; TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true); From f83bbce3a3f98bb91871270435cb8ceed6dc34ff Mon Sep 17 00:00:00 2001 From: George Fu Date: Thu, 22 Oct 2020 19:29:29 +0800 Subject: [PATCH 4/4] Fix TMC serial port for FYSETC AIO_II (#19842) --- Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h index d2c587beb8..bab6182e4f 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h @@ -93,10 +93,10 @@ // // Hardware serial with switch // - #define X_HARDWARE_SERIAL MSerial1 - #define Y_HARDWARE_SERIAL MSerial1 - #define Z_HARDWARE_SERIAL MSerial1 - #define E0_HARDWARE_SERIAL MSerial1 + #define X_HARDWARE_SERIAL MSerial2 + #define Y_HARDWARE_SERIAL MSerial2 + #define Z_HARDWARE_SERIAL MSerial2 + #define E0_HARDWARE_SERIAL MSerial2 // The 4xTMC2209 module doesn't have a serial multiplexer and // needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0 @@ -106,6 +106,9 @@ #define SERIAL_MUL_PIN2 PB12 #endif + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 + #endif //