Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FYSETC Cheetah 2.0 #20897

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Marlin/src/HAL/STM32/eeprom_flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
#define FLASH_UNIT_SIZE 0x20000 // 128kB
#endif

#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - (FLASH_SECTOR)) * (FLASH_UNIT_SIZE)) + 1)
#ifndef FLASH_ADDRESS_START
#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - (FLASH_SECTOR)) * (FLASH_UNIT_SIZE)) + 1)
#endif
#define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1)

#define EEPROM_SLOTS ((FLASH_UNIT_SIZE) / (MARLIN_EEPROM_SIZE))
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
#define BOARD_MKS_ROBIN_NANO_V3 4220 // MKS Robin Nano V3 (STM32F407VG)
#define BOARD_ANET_ET4 4221 // ANET ET4 V1.x (STM32F407VGT6)
#define BOARD_ANET_ET4P 4222 // ANET ET4P V1.x (STM32F407VGT6)
#define BOARD_FYSETC_CHEETAH_V20 4223 // FYSETC Cheetah V2.0

//
// ARM Cortex M7
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@
#include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_OpenBLT
#elif MB(ANET_ET4P)
#include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_OpenBLT
#elif MB(FYSETC_CHEETAH_V20)
#include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20

//
// ARM Cortex M7
Expand Down
271 changes: 271 additions & 0 deletions Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
/**
* 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 <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#if NOT_TARGET(STM32F4)
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
#endif

#define DEFAULT_MACHINE_NAME "3D Printer"

#define BOARD_INFO_NAME "FYSETC Cheetah V2.0"
#define BOARD_WEBSITE_URL "fysetc.com"

// USB Flash Drive support
//#define HAS_OTG_USB_HOST_SUPPORT

// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define FLASH_EEPROM_LEVELING

#define FLASH_SECTOR 2
#define FLASH_UNIT_SIZE 0x4000 // 16k
#define FLASH_ADDRESS_START 0x8008000
#endif

//
// Z Probe
//
#if ENABLED(BLTOUCH)
#error "You need to set jumper to 5v for Bltouch, then comment out this line to proceed."
#define SERVO0_PIN PA0
#elif !defined(Z_MIN_PROBE_PIN)
#define Z_MIN_PROBE_PIN PA0
#endif

//
// Limit Switches
//
#define X_STOP_PIN PB4
#define Y_STOP_PIN PB3
#define Z_STOP_PIN PB1

//
// Filament runout
//
#define FIL_RUNOUT_PIN PB5

//
// Steppers
//
#define X_STEP_PIN PC0
#define X_DIR_PIN PC1
#define X_ENABLE_PIN PA8

#define Y_STEP_PIN PC14
#define Y_DIR_PIN PC13
#define Y_ENABLE_PIN PC15

#define Z_STEP_PIN PB9
#define Z_DIR_PIN PB8
#define Z_ENABLE_PIN PC2

#define E0_STEP_PIN PB2
#define E0_DIR_PIN PA15
#define E0_ENABLE_PIN PD2

#if HAS_TMC_UART
#define X_HARDWARE_SERIAL Serial2
#define Y_HARDWARE_SERIAL Serial2
#define Z_HARDWARE_SERIAL Serial2
#define E0_HARDWARE_SERIAL Serial2

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#endif

//
// Heaters / Fans
//
#define HEATER_0_PIN PC6
#define HEATER_BED_PIN PC7
#ifndef FAN_PIN
#define FAN_PIN PA1
#endif
#define FAN1_PIN PC8

//
// Temperature Sensors
//
#define TEMP_BED_PIN PC5 // Analog Input
#define TEMP_0_PIN PC4 // Analog Input

//
// Misc. Functions
//
#define SDSS PA4
#define SD_DETECT_PIN PC3

#ifndef RGB_LED_R_PIN
#define RGB_LED_R_PIN PB0
#endif
#ifndef RGB_LED_G_PIN
#define RGB_LED_G_PIN PB7
#endif
#ifndef RGB_LED_B_PIN
#define RGB_LED_B_PIN PB6
#endif

/**
* _____ _____
* 5V | 1 2 | GND 5V | 1 2 | GND
* RESET | 3 4 | PC3 (SD_DETECT) (LCD_D7) PB7 | 3 4 | PB6 (LCD_D6)
* (SD_MOSI) PA7 5 6 | PC11 (BTN_EN2) (LCD_D5) PB14 5 6 | PB13 (LCD_D4)
* (SD_SS) PA4 | 7 8 | PC10 (BTN_EN1) (LCD_RS) PB12 | 7 8 | PB15 (LCD_EN)
* (SD_SCK) PA5 | 9 10| PA6 (SD_MISO) (BTN_ENC) PC12 | 9 10| PC9 (BEEPER)
* ----- -----
* EXP2 EXP1
*/

/**
* _____
* (BEEPER) PC9 | 1 2 | PC12 (BTN_ENC)
* (BTN_EN1) PC10 | 3 4 | PB14 (LCD_D5/MISO)
* (BTN_EN2) PC11 5 6 | PB13 (LCD_D4/SCK)
* (LCD_RS) PB12 | 7 8 | PB15 (LCD_EN/MOSI)
* GND | 9 10| 5V
* -----
* EXP3
*/

#define EXPA1_03_PIN PB7
#define EXPA1_04_PIN PB6
#define EXPA1_05_PIN PB14
#define EXPA1_06_PIN PB13
#define EXPA1_07_PIN PB12
#define EXPA1_08_PIN PB15
#define EXPA1_09_PIN PC12
#define EXPA1_10_PIN PC9

#define EXPA2_03_PIN -1
#define EXPA2_04_PIN PC3
#define EXPA2_05_PIN PA7
#define EXPA2_06_PIN PC11
#define EXPA2_07_PIN PA4
#define EXPA2_08_PIN PC10
#define EXPA2_09_PIN PA5
#define EXPA2_10_PIN PA6

#if HAS_WIRED_LCD

#define BEEPER_PIN EXPA1_10_PIN
#define BTN_ENC EXPA1_09_PIN

#if ENABLED(CR10_STOCKDISPLAY)

#define LCD_PINS_RS EXPA1_07_PIN

#define BTN_EN1 EXPA2_08_PIN
#define BTN_EN2 EXPA2_06_PIN

#define LCD_PINS_ENABLE EXPA1_08_PIN
#define LCD_PINS_D4 EXPA1_06_PIN

// CR10_STOCKDISPLAY default timing is too fast
#undef BOARD_ST7920_DELAY_1
#undef BOARD_ST7920_DELAY_2
#undef BOARD_ST7920_DELAY_3

#elif ENABLED(MKS_MINI_12864)

#define DOGLCD_A0 EXPA1_04_PIN
#define DOGLCD_CS EXPA1_05_PIN
#define BTN_EN1 EXPA2_08_PIN
#define BTN_EN2 EXPA2_06_PIN

#else

#define LCD_PINS_RS EXPA1_07_PIN

#define BTN_EN1 EXPA2_06_PIN
#define BTN_EN2 EXPA2_08_PIN

#define LCD_PINS_ENABLE EXPA1_08_PIN
#define LCD_PINS_D4 EXPA1_06_PIN

#if ENABLED(FYSETC_MINI_12864)
#define DOGLCD_CS EXPA1_08_PIN
#define DOGLCD_A0 EXPA1_07_PIN
//#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN EXPA1_06_PIN // Must be high or open for LCD to operate normally.
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
#ifndef RGB_LED_R_PIN
#define RGB_LED_R_PIN EXPA1_05_PIN
#endif
#ifndef RGB_LED_G_PIN
#define RGB_LED_G_PIN EXPA1_04_PIN
#endif
#ifndef RGB_LED_B_PIN
#define RGB_LED_B_PIN EXPA1_03_PIN
#endif
#elif ENABLED(FYSETC_MINI_12864_2_1)
#define NEOPIXEL_PIN EXPA1_05_PIN
#endif
#endif // !FYSETC_MINI_12864

#if IS_ULTIPANEL
#define LCD_PINS_D5 EXPA1_05_PIN
#define LCD_PINS_D6 EXPA1_04_PIN
#define LCD_PINS_D7 EXPA1_03_PIN

#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
#endif

#endif

#endif

#endif // HAS_WIRED_LCD

// Alter timing for graphical display
#if HAS_MARLINUI_U8GLIB
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(96)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(48)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(600)
#endif
#endif

#if ENABLED(TOUCH_UI_FTDI_EVE)
#define BEEPER_PIN EXPA1_10_PIN
#define CLCD_MOD_RESET EXPA2_08_PIN
#define CLCD_SPI_CS EXPA2_06_PIN
#endif
66 changes: 66 additions & 0 deletions buildroot/share/PlatformIO/boards/FYSETC_CHEETAH_V20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xx",
"f_cpu": "84000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"ldscript": "stm32f401rc.ld",
"mcu": "stm32f401rct6",
"variant": "FYSETC_CHEETAH_V20"
},
"debug": {
"jlink_device": "STM32F401RC",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F401RC (64k RAM. 256k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x800C000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.fysetc.com",
"vendor": "Generic"
}
9 changes: 9 additions & 0 deletions buildroot/share/PlatformIO/scripts/fysetc_cheetah_v20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os
Import("env")

custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/FYSETC_CHEETAH_V20/ldscript.ld")
for i, flag in enumerate(env["LINKFLAGS"]):
if "-Wl,-T" in flag:
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
elif flag == "-T":
env["LINKFLAGS"][i + 1] = custom_ld_script
Loading