Improved MKS Robin support (#19333)

This commit is contained in:
TheCodeExorcist 2021-01-07 04:13:15 +01:00 committed by Scott Lahteine
parent 92eee0386f
commit 074d3f6266

View File

@ -42,15 +42,20 @@
#define DISABLE_JTAG #define DISABLE_JTAG
// //
// Enable SD EEPROM to prevent infinite boot loop // EEPROM
// //
#ifdef ARDUINO_ARCH_STM32 #if NO_EEPROM_SELECTED
#ifdef ARDUINO_ARCH_STM32
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION
#else
#define SDCARD_EEPROM_EMULATION
#endif
#endif
#if ENABLED(FLASH_EEPROM_EMULATION)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE) #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE)
#else
#define SDCARD_EEPROM_EMULATION
#endif #endif
// //
@ -102,27 +107,56 @@
#define TEMP_BED_PIN PC0 // TB1 #define TEMP_BED_PIN PC0 // TB1
// //
// Heaters / Fans // Heaters
// //
#define HEATER_0_PIN PC7 // HEATER1 #define HEATER_0_PIN PC7 // HEATER1
#define HEATER_1_PIN PA6 // HEATER2 #define HEATER_1_PIN PA6 // HEATER2
#define HEATER_BED_PIN PC6 // HOT BED #define HEATER_BED_PIN PC6 // HOT BED
//
// Fan
//
#define FAN_PIN PA7 // FAN #define FAN_PIN PA7 // FAN
/** //
* Note: MKS Robin board is using SPI2 interface. Make sure your stm32duino library is configured accordingly // Thermocouples
*/ //
//#define MAX6675_SS_PIN PE5 // TC1 - CS1 //#define MAX6675_SS_PIN PE5 // TC1 - CS1
//#define MAX6675_SS_PIN PE6 // TC2 - CS2 //#define MAX6675_SS_PIN PE6 // TC2 - CS2
#define POWER_LOSS_PIN PA2 // PW_DET //
#define PS_ON_PIN PA3 // PW_OFF // Filament runout sensor
//
#define FIL_RUNOUT_PIN PF11 // MT_DET #define FIL_RUNOUT_PIN PF11 // MT_DET
//
// Power loss detection
//
#define POWER_LOSS_PIN PA2 // PW_DET
//
// Power supply control
//
#define PS_ON_PIN PA3 // PW_OFF
//
// Piezzoelectric speaker
//
#define BEEPER_PIN PC13 #define BEEPER_PIN PC13
//
// Activity LED
//
#define LED_PIN PB2 #define LED_PIN PB2
//
// ESP12-S Wi-Fi module
//
#define WIFI_IO0_PIN PG1
//
// LCD screen
//
#if HAS_FSMC_TFT #if HAS_FSMC_TFT
/** /**
* Note: MKS Robin TFT screens use various TFT controllers * Note: MKS Robin TFT screens use various TFT controllers
@ -151,6 +185,7 @@
#define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 2 #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
#define TFT_BUFFER_SIZE 14400
#endif #endif
#if NEED_TOUCH_PINS #if NEED_TOUCH_PINS
@ -161,6 +196,7 @@
#define TOUCH_INT_PIN -1 #define TOUCH_INT_PIN -1
#endif #endif
// SPI2 is shared by LCD touch driver and flash
// SPI1(PA7) & SPI3(PB5) not available // SPI1(PA7) & SPI3(PB5) not available
#define SPI_DEVICE 2 #define SPI_DEVICE 2
@ -193,31 +229,55 @@
#define SD_DETECT_PIN -1 #define SD_DETECT_PIN -1
#endif #endif
//
// Trinamic TMC2208/2209 UART
//
#if HAS_TMC_UART #if HAS_TMC_UART
/** /**
* TMC2208/TMC2209 stepper drivers * This board does not have dedicated TMC UART pins. Custom wiring is needed.
* You may uncomment one of the options below, or add it to your Configuration.h.
* *
* Hardware serial communication ports. * When using up to four TMC2209 drivers, hardware serial is recommented on
* If undefined software serial is used according to the pins below * MSerial0 or MSerial1.
*
* When using TMC2208 or more than four drivers, SoftwareSerial will be needed,
* to provide dedicated pins for each drier.
*/ */
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//#define E1_HARDWARE_SERIAL MSerial1
// Unused servo pins may be repurposed with SoftwareSerialM //#define TMC_HARDWARE_SERIAL
//#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6 #if ENABLED(TMC_HARDWARE_SERIAL)
//#define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN -- XS2 - 5 #define X_HARDWARE_SERIAL MSerial0
//#define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN -- XS1 - 6 #define X2_HARDWARE_SERIAL MSerial0
//#define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN -- XS1 - 5 #define Y_HARDWARE_SERIAL MSerial0
//#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN #define Y2_HARDWARE_SERIAL MSerial0
//#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN #define Z_HARDWARE_SERIAL MSerial0
//#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN #define Z2_HARDWARE_SERIAL MSerial0
//#define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN #define E0_HARDWARE_SERIAL MSerial0
#define E1_HARDWARE_SERIAL MSerial0
#endif
// Reduce baud rate for software serial reliability //#define TMC_SOFTWARE_SERIAL
#if HAS_TMC_SW_SERIAL #if ENABLED(TMC_SOFTWARE_SERIAL)
#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6
#define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN -- XS2 - 5
#define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN -- XS1 - 6
#define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN -- XS1 - 5
#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN
#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN
#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN
#define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN
#define TMC_BAUD_RATE 19200 #define TMC_BAUD_RATE 19200
#endif #endif
#endif #endif
//
// W25Q64 64Mb (8MB) SPI flash
//
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x800000 // 8MB
#define W25QXX_CS_PIN PG9
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#endif