Skip to content

Commit

Permalink
Simplication and add J2 connector
Browse files Browse the repository at this point in the history
Reformatage differents parts:
-TMC2209 Serial one wire
-XPT20046 Touch Screen
-SdCard and card socket
  • Loading branch information
Foxies-CSTL authored and dpreed committed Feb 5, 2021
1 parent 788d720 commit 45bce2d
Showing 1 changed file with 110 additions and 90 deletions.
200 changes: 110 additions & 90 deletions Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@
#if NOT_TARGET(__STM32F1__, STM32F1xx)
#error "Oops! Select an STM32F1 board in 'Tools > Board.'"
#elif HOTENDS > 1 || E_STEPPERS > 1
#error "FLSUN HiSpeedV1 only supports one hotend / E-stepper. Comment out this line to continue."
#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"

#define BOARD_NO_NATIVE_USB

// Avoid conflict with TIMER_SERVO when using the STM32 HAL
#define TEMP_TIMER 5

//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
//
Expand All @@ -53,19 +50,15 @@
//
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define 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 MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#endif

//
// SPI
// Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface.
//
#define SD_SCK_PIN PB13 // SPI2
#define SD_MISO_PIN PB14 // SPI2
#define SD_MOSI_PIN PB15 // SPI2
#define SPI_DEVICE 2
#define SPI_DEVICE 2

// SPI Flash
#define HAS_SPI_FLASH 1
Expand Down Expand Up @@ -120,8 +113,13 @@
* Several wiring options are provided below, defaulting to
* to the most compatible.
*/
#if HAS_TMC_UART

//
// Drivers
//
#if HAS_TMC220x
#define TMC_BAUD_RATE 19200
<<<<<<< HEAD
#ifdef HARDWARE_SERIAL /* TMC2209 */
/**
* HardwareSerial with one pin for four drivers.
Expand All @@ -130,8 +128,6 @@
* jumper configuration. Uses only one I/O pin like PA10/PA9/PC7/PA8.
* Install the jumpers in the following way, for example:
*/
// The 4xTMC2209 module doesn't have a serial multiplexer and
// needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
#define X_SLAVE_ADDRESS 3 // | | :
#define Y_SLAVE_ADDRESS 2 // : | :
#define Z_SLAVE_ADDRESS 1 // | : :
Expand All @@ -143,15 +139,6 @@
#define Y_SERIAL_RX_PIN PA8 // IO0
#define Z_SERIAL_TX_PIN PA8 // IO0
#define Z_SERIAL_RX_PIN PA8 // IO0
#ifdef ESP_WIFI
//Module ESP-WIFI
#define ESP_WIFI_MODULE_COM 2
#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE
#define ESP_WIFI_MODULE_RESET_PIN PA5
#define ESP_WIFI_MODULE_ENABLE_PIN -1
#define ESP_WIFI_MODULE_TXD_PIN PA9
#define ESP_WIFI_MODULE_RXD_PIN PA10
#endif
#else /* TMC220x */
// SoftwareSerial with one pin per driver
// Compatible with TMC2208 and TMC2209 drivers
Expand All @@ -166,6 +153,21 @@
#define Z_SERIAL_TX_PIN PC7 // IO1
#define Z_SERIAL_RX_PIN PC7 // IO1
#endif
=======

/**
* HardwareSerial with one pin for four drivers.
* The 4xTMC2209 module doesn't have a serial multiplexer and
* needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
* and proper jumper configuration.
* Uses only one I/O pin like PA10/PA9/PC7/PA8.
* Install the jumpers in the following way, for example:
*/
//#define X_SLAVE_ADDRESS 3 // * * . JP0, JP1
//#define Y_SLAVE_ADDRESS 2 // . * . JP1
//#define Z_SLAVE_ADDRESS 1 // * . . JP0
//#define E0_SLAVE_ADDRESS 0 // . . .
>>>>>>> d70922febb (Simplication and add J2 connector)

#else
// Motor current PWM pins
Expand All @@ -176,22 +178,22 @@
#define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 }
#endif

/**
* MKS Robin_Wifi or another ESP8266 module
*
* __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 ̄ ̄
*/
// Module ESP-WIFI
#define ESP_WIFI_MODULE_COM 2 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this
/**
* MKS Robin_Wifi or another ESP8266 module
*
* __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 ̄ ̄
*/
//Module ESP-WIFI
#define ESP_WIFI_MODULE_COM 2 // 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 PA5 // WIFI CTRL/RST
#define ESP_WIFI_MODULE_ENABLE_PIN -1
Expand All @@ -203,7 +205,6 @@
// 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
Expand Down Expand Up @@ -238,25 +239,26 @@
#define POWER_LOSS_PIN PA2 // PW_DET (UPS) MKSPWC
#endif

/**
* Connector J2
//
//
/** Connector J2
* -------
* DIO O|1 2|O 3v3
* CSK O|3 5|O GND
* RST O|5 6|O GND
* -------
*/
//#define SW_DIO PA13
//#define SW_CLK PA14
//#define SW_RST NRST // (14)
* /
//SW_DIO PA13 //
//SW_CLK PA14 //
//SW_RST NRST //(14)
//
// 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
#define KILL_PIN_INVERTING true //
//#define PS_ON_PIN PA3 // PW_CN /PW_OFF
#endif
#define MT_DET_1_PIN PA4 // MT_DET
Expand All @@ -269,7 +271,7 @@
//#define LED_PIN PB2 // BOOT1
#if ENABLED(NEOPIXEL_LED)
#define LED_PWM PC7 // IO1
#define LED_PWM PC7 // IO1
#ifndef NEOPIXEL_PIN
#define NEOPIXEL_PIN LED_PWM // USED WIFI IO0/IO1 PIN
#endif
Expand All @@ -278,24 +280,23 @@
//
// SD Card
//
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#define SDIO_CLOCK 4500000 // 4.5 MHz
#define SDIO_READ_RETRIES 16
// Use the on-board card socket labeled SD_Extender
#if SD_CONNECTION_IS(CUSTOM_CABLE)
#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN -1
#define SD_DETECT_PIN PD12 // SD_CD (if -1 no detection)
#else
#define SDIO_SUPPORT
#define SDIO_CLOCK 4500000 // 4.5 MHz
#define SDIO_READ_RETRIES 16
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PC11
#if ENABLED(SDIO_SUPPORT)
#define SCK_PIN PB13 // SPI2
#define MISO_PIN PB14 // SPI2
#define MOSI_PIN PB15 // SPI2
#define SD_DETECT_PIN -1 // SD_CD (-1 active refresh)
#define SS_PIN PC2
#else // Use the on-board card socket labeled SD_Extender
#define SCK_PIN PC12
#define MISO_PIN PC8
#define MOSI_PIN PD2
#define SS_PIN -1
#define ONBOARD_SD_CS_PIN PC11
#define SDSS PD2
#define SD_DETECT_PIN PD12 // SD_CD (if -1 no detection)
#endif
//
Expand All @@ -309,48 +310,67 @@
#error "FLSun HiSpeed default BEEPER_PIN is not a SPEAKER."
#endif
#if HAS_FSMC_TFT || HAS_GRAPHICAL_TFT
#define TFT_CS_PIN PD7 // NE4
#define TFT_RS_PIN PD11 // A0
#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.
*/

// QQS-Pro uses MKS Robin TFT v2.0 320x240

// Shared FSMC Configs
#if HAS_FSMC_TFT
/**
* 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.
*/
//#define TFT_RESET_PIN PC6 // FSMC_RST
#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 FSMC_CS_PIN TFT_CS_PIN // NE4
#define FSMC_RS_PIN TFT_RS_PIN // A0

#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 ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI)
#define TFT_BUFFER_SIZE 14400

#ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION 12033
#endif
#ifndef XPT2046_Y_CALIBRATION
#define XPT2046_Y_CALIBRATION -9047
#endif
#ifndef XPT2046_X_OFFSET
#define XPT2046_X_OFFSET -30
#endif
#ifndef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET 254
#endif

#ifdef TFT_CLASSIC_UI
#define TFT_MARLINBG_COLOR 0x3186 // Grey
#define TFT_MARLINUI_COLOR 0xC7B6 // Green
#define TFT_MARLINUI_COLOR 0xFFFF // White
#define TFT_BTARROWS_COLOR 0xDEE6 // Yellow
#define TFT_BTOKMENU_COLOR 0x145F // Cyan
#endif
#define TFT_BUFFER_SIZE 14400
#elif HAS_GRAPHICAL_TFT
#define TFT_RESET_PIN PC6
#define TFT_BACKLIGHT_PIN PD13
#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
#define TOUCH_INT_PIN -1
#endif

0 comments on commit 45bce2d

Please sign in to comment.