1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

Initial Longer3D LK1/2 (Alfawise U20/U20+/U30) support (#14597)

This commit is contained in:
Tanguy Pruvot 2019-07-15 01:05:24 +02:00 committed by Scott Lahteine
parent 475ccfad62
commit 45bde333d5
15 changed files with 5198 additions and 12 deletions

View File

@ -24,6 +24,7 @@ env:
- TEST_PLATFORM="teensy35" - TEST_PLATFORM="teensy35"
- TEST_PLATFORM="linux_native" - TEST_PLATFORM="linux_native"
- TEST_PLATFORM="esp32" - TEST_PLATFORM="esp32"
- TEST_PLATFORM="alfawise_U20"
addons: addons:
apt: apt:

View File

@ -264,6 +264,7 @@
#define BOARD_JGAURORA_A5S_A1 4010 // JGAurora A5S A1 (STM32F103ZET6) #define BOARD_JGAURORA_A5S_A1 4010 // JGAurora A5S A1 (STM32F103ZET6)
#define BOARD_FYSETC_AIO_II 4011 // FYSETC AIO_II #define BOARD_FYSETC_AIO_II 4011 // FYSETC AIO_II
#define BOARD_FYSETC_CHEETAH 4012 // FYSETC CHEETAH #define BOARD_FYSETC_CHEETAH 4012 // FYSETC CHEETAH
#define BOARD_LONGER3D_LK 4013 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
// //
// ARM Cortex-M4F // ARM Cortex-M4F

View File

@ -1540,7 +1540,11 @@ void Temperature::updateTemperaturesFromRawValues() {
#endif #endif
// Init fans according to whether they're native PWM or Software PWM // Init fans according to whether they're native PWM or Software PWM
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) #ifdef ALFAWISE_UX0
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
#else
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
#endif
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
#define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P) #define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
#else #else
@ -1563,7 +1567,6 @@ void Temperature::updateTemperaturesFromRawValues() {
#define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P) #define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P)
#endif #endif
/** /**
* Initialize the temperature manager * Initialize the temperature manager
* The manager is implemented by periodic calls to manage_heater() * The manager is implemented by periodic calls to manage_heater()
@ -1590,8 +1593,13 @@ void Temperature::init() {
#endif #endif
#if HAS_HEATER_0 #if HAS_HEATER_0
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING); #ifdef ALFAWISE_UX0
OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING);
#else
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
#endif
#endif #endif
#if HAS_HEATER_1 #if HAS_HEATER_1
OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING); OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
#endif #endif
@ -1607,9 +1615,15 @@ void Temperature::init() {
#if HAS_HEATER_5 #if HAS_HEATER_5
OUT_WRITE(HEATER_5_PIN, HEATER_5_INVERTING); OUT_WRITE(HEATER_5_PIN, HEATER_5_INVERTING);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING); #ifdef ALFAWISE_UX0
OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING);
#else
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
#endif
#endif #endif
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
OUT_WRITE(HEATER_CHAMBER_PIN, HEATER_CHAMBER_INVERTING); OUT_WRITE(HEATER_CHAMBER_PIN, HEATER_CHAMBER_INVERTING);
#endif #endif

View File

@ -450,6 +450,8 @@
#include "stm32/pins_CHITU3D.h" // STM32F1 env:STM32F1 #include "stm32/pins_CHITU3D.h" // STM32F1 env:STM32F1
#elif MB(GTM32_PRO_VB) #elif MB(GTM32_PRO_VB)
#include "stm32/pins_GTM32_PRO_VB.h" // STM32F1 env:STM32F1 #include "stm32/pins_GTM32_PRO_VB.h" // STM32F1 env:STM32F1
#elif MB(LONGER3D_LK)
#include "stm32/pins_LONGER3D_LK.h" // STM32F1 env:alfawise_U20
#elif MB(MORPHEUS) #elif MB(MORPHEUS)
#include "stm32/pins_MORPHEUS.h" // STM32F1 env:STM32F1 #include "stm32/pins_MORPHEUS.h" // STM32F1 env:STM32F1
#elif MB(MKS_ROBIN) #elif MB(MKS_ROBIN)

View File

@ -0,0 +1,160 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* ALFAWISE U30 (STM32F103VET6) board pin assignments
*/
#if !defined(__STM32F1__) && !defined(STM32F1xx)
#error "Oops! Select a STM32F1 board in 'Tools > Board.'"
#elif HOTENDS > 1 || E_STEPPERS > 1
#error "LONGER3D only supports 1 hotend / E-stepper. Comment out this line to continue."
#endif
#define BOARD_NAME "Longer3D"
#define ALFAWISE_UX0 // Common to all Alfawise STM32F1 boards
// Release PB4 (STEP_X_PIN) from JTAG NRST role.
//#define DISABLE_DEBUG // > Hobi : We still want to debug with STLINK...
#define DISABLE_JTAG // we free the jtag pins (PA15) but keep STLINK
//
// Limit Switches
//
#define X_STOP_PIN PC1 // pin 16
//#define X_MAX_PIN PC0 // pin 15 Used as filament sensor on Alfawise setup
#define Y_MIN_PIN PC15 // pin 9
//#define Y_MAX_PIN PC14 // pin 8 Unused in stock Alfawise setup
#define Z_MIN_PIN PE6 // pin 5 Standard Endstop or Z_Probe endstop function
//#define Z_MAX_PIN PE5 // pin 4 Unused in stock Alfawise setup
// May be used for BLTouch Servo function on older variants (<= V08)
//
// Steppers
//
#define X_ENABLE_PIN PB5 // pin 91
#define X_STEP_PIN PB4 // pin 90
#define X_DIR_PIN PB3 // pin 89
#define Y_ENABLE_PIN PB8 // pin 95
#define Y_STEP_PIN PB7 // pin 93
#define Y_DIR_PIN PB6 // pin 92
#define Z_ENABLE_PIN PE1 // pin 98
#define Z_STEP_PIN PE0 // pin 97
#define Z_DIR_PIN PB9 // pin 96
#define E0_ENABLE_PIN PE4 // pin 3
#define E0_STEP_PIN PE3 // pin 2
#define E0_DIR_PIN PE2 // pin 1
//
// Temperature Sensors
//
#define TEMP_0_PIN PA0 // pin 23 (Nozzle 100K/3950 thermistor)
#define TEMP_BED_PIN PA1 // pin 24 (Hot Bed 100K/3950 thermistor)
//
// Heaters / Fans
//
#define HEATER_0_PIN PD3 // pin 84 (Nozzle Heat Mosfet)
#define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet)
#define FAN_PIN PA15 // pin 77 (4cm Fan)
#define FAN_SOFT_PWM // Required to avoid issues with heating or STLink
#define FAN_MIN_PWM 35 // Fan will not start in 1-30 range
#define FAN_MAX_PWM 255
// Filament Sensor
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN PC0 // XMAX plug on PCB used as filament runout sensor on Alfawise boards (inverting true)
#endif
//#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor
// Can drive a PC Buzzer, if connected between PWM and 5V pins
#define LED_PIN PC2 // pin 17
//
// PWM
//
//#define NUM_SERVOS 1
//#define SERVO0_TIMER_NUM 1 // General or Adv. timer to use for the servo PWM (2 & 5 are reserved)
#define SERVO0_PWM_OD
#define SERVO0_PIN PD13 // Open drain PWM pin on the V0G (GND or floating 5V)
//#define SERVO0_PIN PE5 // Pulled up PWM pin on the V08 (3.3V or 0)
/**
* Note: Alfawise screens use various TFT controllers. Supported screens
* are based on the ILI9342, ILI9328 and ST7798V. 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.
*/
#pragma once
#define LCD_RESET_PIN PC4 // pin 33
#define LCD_BACKLIGHT_PIN PD12 // pin 59
#define FSMC_CS_PIN PD7 // pin 88 = FSMC_NE1
#define FSMC_RS_PIN PD11 // pin 58 A16 Register. Only one address needed
#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 DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h
#define DOGLCD_SCK -1
/**
* Note: Alfawise U20/U30 boards DON'T use SPI2, as the hardware designer
* mixed up MOSI and MISO pins. SPI is managed in SW, and needs pins
* declared below.
*/
#if ENABLED(TOUCH_BUTTONS)
#define TOUCH_CS_PIN PB12 // pin 51 SPI2_NSS
#define TOUCH_SCK_PIN PB13 // pin 52
#define TOUCH_MOSI_PIN PB14 // pin 53
#define TOUCH_MISO_PIN PB15 // pin 54
#define TOUCH_INT_PIN PC6 // pin 63 (PenIRQ coming from ADS7843)
#define BTN_ENC PB0 // pin 35 unconnected pin on Alfawise. (PC13 to try)
#define BTN_EN1 -1 // Real pin is needed to enable encoder's push button
#define BTN_EN2 -1 // functionality used by touch screen
#endif
//
// SPI1 (EEPROM W25Q64 + DAC OUT)
//
#undef E2END
#define E2END 0x7FF // EEPROM end address (reserve 2kB on sd/sram, real spi one is 8MB/64Mbits)
/*
#define SPI_EEPROM 1 // If commented this will create a file on the SD card as a replacement
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PC5 // pin 34
//#define EEPROM_SCK BOARD_SPI1_SCK_PIN // PA5 pin 30
//#define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31
//#define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32
*/

View File

@ -109,11 +109,15 @@
#define LED_PIN PB2 #define LED_PIN PB2
/** /**
* Note: MKS Robin TFT screens may have different TFT controllers * Note: MKS Robin TFT screens use various TFT controllers. Supported screens
* If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization. * are based on the ILI9342, ILI9328 and ST7798V. Define init sequences for
* other screens in u8g_dev_tft_320x240_upscale_from_128x64.cpp
* *
* Enabling 'LCD_RESET_PIN' causes flickering when entering the LCD menu due to LCD controller reset. * If the screen stays white, disable 'LCD_RESET_PIN'
* Reset feature was designed to "revive the LCD if static electricity killed it." * 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 LCD_RESET_PIN PF6 //#define LCD_RESET_PIN PF6
#define LCD_BACKLIGHT_PIN PG11 #define LCD_BACKLIGHT_PIN PG11

View File

@ -101,8 +101,9 @@
//#define LED_PIN PB2 //#define LED_PIN PB2
/** /**
* Note: MKS Robin TFT screens may have different TFT controllers * Note: MKS Robin TFT screens use various TFT controllers.
* If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization. * If the screen stays white, disable 'LCD_RESET_PIN'
* to let the bootloader init the screen.
*/ */
#define LCD_RESET_PIN PF6 #define LCD_RESET_PIN PF6
#define NO_LCD_REINIT // Suppress LCD re-initialization #define NO_LCD_REINIT // Suppress LCD re-initialization

View File

@ -103,8 +103,9 @@
#define LED_PIN PB2 #define LED_PIN PB2
/** /**
* Note: MKS Robin TFT screens may have different TFT controllers * Note: MKS Robin TFT screens use various TFT controllers.
* If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization. * If the screen stays white, disable 'LCD_RESET_PIN'
* to let the bootloader init the screen.
*/ */
#define LCD_RESET_PIN PF6 #define LCD_RESET_PIN PF6
#define NO_LCD_REINIT // Suppress LCD re-initialization #define NO_LCD_REINIT // Suppress LCD re-initialization

View File

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

View File

@ -0,0 +1,26 @@
Import("env")
# Relocate firmware from 0x08000000 to 0x08010000
for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
env['CPPDEFINES'].remove(define)
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/alfawise_Ux0.ld")
# Encrypt ${PROGNAME}.bin and save it as 'project.bin'
def encrypt(source, target, env):
import os
firmware = open(target[0].path, "rb")
marlin_alfa = open(target[0].dir.path +'/project.bin', "wb")
length = os.path.getsize(target[0].path)
position = 0
try:
while position < length:
byte = firmware.read(1)
marlin_alfa.write(byte)
position += 1
finally:
firmware.close()
marlin_alfa.close()
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# Build tests for STM32F103VET6
#
# exit on first failure
set -e
use_example_configs Alfawise/U20
opt_set MOTHERBOARD BOARD_LONGER3D_LK
opt_set SERIAL_PORT 1
exec_test $1 $2 "Full-featured U20 config"
# cleanup
restore_configs

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* Custom Status Screen bitmap
*
* Place this file in the root with your configuration files
* and enable CUSTOM_STATUS_SCREEN_IMAGE in Configuration.h.
*
* Use the Marlin Bitmap Converter to make your own:
* http://marlinfw.org/tools/u8glib/converter.html
*/
#pragma once
//
// Status Screen Logo bitmap
//
#define STATUS_LOGO_Y 0
#define STATUS_LOGO_WIDTH 38
static unsigned char status_logo_bmp[] PROGMEM = {
B11111111,B11111111,B11111111,B11111111,B11111100,
B10000000,B00000000,B00010000,B00000111,B11111100,
B10000000,B00000000,B00010000,B00000000,B11111100,
B10000000,B00000000,B00110000,B00000000,B01111100,
B10000000,B00000000,B00110000,B00000000,B00111100,
B10000000,B00000000,B01110000,B00000000,B00011100,
B11111111,B10000000,B01110000,B00000000,B00001100,
B11111111,B10000000,B11110000,B11100000,B00001100,
B11111111,B00000000,B11110000,B11111000,B00001100,
B11111111,B00000001,B11110000,B11111100,B00000100,
B11111110,B00000001,B11110000,B11010010,B00000100,
B11111110,B00000011,B11110000,B10101110,B00000100,
B11111100,B00000000,B11110000,B10101111,B00000100,
B11111100,B00000000,B00110000,B10000011,B00000100,
B11111000,B00000000,B00110000,B11111111,B00000100,
B11111000,B00000000,B00010000,B11111111,B00000100,
B11111111,B11100000,B00010000,B10111111,B00000100,
B11111111,B11110000,B00010000,B10101111,B00000100,
B11111111,B11110000,B00010000,B10101110,B00000100,
B11111111,B11110000,B00010000,B10000010,B00000100,
B10000011,B11110000,B00010000,B11111100,B00000100,
B10000001,B11110000,B00010000,B11111000,B00001100,
B10000001,B11100000,B00010000,B11100000,B00001100,
B10000000,B00000000,B00010000,B00000000,B00001100,
B10000000,B00000000,B00110000,B00000000,B00011100,
B11000000,B00000000,B00110000,B00000000,B00111100,
B11000000,B00000000,B01110000,B00000000,B01111100,
B11100000,B00000000,B11110000,B00000000,B11111100,
B11111000,B00000011,B11110000,B00000111,B11111100
};
//
// Use default bitmaps
//
#define STATUS_HOTEND_ANIM
#define STATUS_BED_ANIM
#define STATUS_LOGO_X 0
#define STATUS_HEATERS_X 50
#define STATUS_BED_X 74

View File

@ -367,6 +367,29 @@ lib_ignore = Adafruit NeoPixel, c1921b4
src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32> src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32>
monitor_speed = 250000 monitor_speed = 250000
#
# Alfawise U20 (STM32F103VET6)
#
[env:alfawise_U20]
platform = ststm32
framework = arduino
board = genericSTM32F103VE
monitor_speed = 250000
extra_scripts = buildroot/share/PlatformIO/scripts/alfawise_Ux0.py
build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
${common.build_flags} -std=gnu++14
-DSTM32F1xx -DU20 -DTS_V12
build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
lib_deps = ${common.lib_deps}
lib_ignore = c1921b4
libf3c
lib066
Adafruit NeoPixel_ID28
Adafruit NeoPixel
libf3e
TMC26XStepper
# #
# MKS Robin (STM32F103ZET6) # MKS Robin (STM32F103ZET6)
# #