Skip to content

Commit

Permalink
Improved MKS Robin support (MarlinFirmware#19333)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin-DUBREUIL authored and dpreed committed Feb 5, 2021
1 parent 9c0fe3c commit 8c95cab
Showing 1 changed file with 91 additions and 31 deletions.
122 changes: 91 additions & 31 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@
#define DISABLE_JTAG

//
// Enable SD EEPROM to prevent infinite boot loop
// EEPROM
//
#ifdef ARDUINO_ARCH_STM32
#define FLASH_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
#ifdef ARDUINO_ARCH_STM32
#define FLASH_EEPROM_EMULATION
#else
#define SDCARD_EEPROM_EMULATION
#endif
#endif

#if ENABLED(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)
#else
#define SDCARD_EEPROM_EMULATION
#endif

//
Expand Down Expand Up @@ -102,27 +107,56 @@
#define TEMP_BED_PIN PC0 // TB1

//
// Heaters / Fans
// Heaters
//
#define HEATER_0_PIN PC7 // HEATER1
#define HEATER_1_PIN PA6 // HEATER2
#define HEATER_BED_PIN PC6 // HOT BED

//
// 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 PE6 // TC2 - CS2

//
// Filament runout sensor
//
#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
#define FIL_RUNOUT_PIN PF11 // MT_DET

//
// Piezzoelectric speaker
//
#define BEEPER_PIN PC13

//
// Activity LED
//
#define LED_PIN PB2

//
// ESP12-S Wi-Fi module
//
#define WIFI_IO0_PIN PG1

//
// LCD screen
//
#if HAS_FSMC_TFT
/**
* Note: MKS Robin TFT screens use various TFT controllers
Expand Down Expand Up @@ -151,6 +185,7 @@

#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 2
#define TFT_BUFFER_SIZE 14400
#endif

#if NEED_TOUCH_PINS
Expand All @@ -161,6 +196,7 @@
#define TOUCH_INT_PIN -1
#endif

// SPI2 is shared by LCD touch driver and flash
// SPI1(PA7) & SPI3(PB5) not available
#define SPI_DEVICE 2

Expand Down Expand Up @@ -193,31 +229,55 @@
#define SD_DETECT_PIN -1
#endif

//
// Trinamic TMC2208/2209 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.
*
* When using up to four TMC2209 drivers, hardware serial is recommented on
* MSerial0 or MSerial1.
*
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
* 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 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

// Reduce baud rate for software serial reliability
#if HAS_TMC_SW_SERIAL

//#define TMC_HARDWARE_SERIAL
#if ENABLED(TMC_HARDWARE_SERIAL)
#define X_HARDWARE_SERIAL MSerial0
#define X2_HARDWARE_SERIAL MSerial0
#define Y_HARDWARE_SERIAL MSerial0
#define Y2_HARDWARE_SERIAL MSerial0
#define Z_HARDWARE_SERIAL MSerial0
#define Z2_HARDWARE_SERIAL MSerial0
#define E0_HARDWARE_SERIAL MSerial0
#define E1_HARDWARE_SERIAL MSerial0
#endif

//#define TMC_SOFTWARE_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
#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

0 comments on commit 8c95cab

Please sign in to comment.