🚸 Tronxy V10 w/ TFT_TRONXY_X5SA + MKS_ROBIN_TFT43 (#26747)

This commit is contained in:
Smokey Pell 2024-02-04 09:37:32 -06:00 committed by GitHub
parent 755b661c2d
commit 9364cbb4b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 435 additions and 364 deletions

View file

@ -37,39 +37,46 @@ LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
void TFT_FSMC::init() {
uint32_t controllerAddress;
FSMC_NORSRAM_TimingTypeDef timing, extTiming;
FMC_OR_FSMC(NORSRAM_TimingTypeDef) timing, extTiming;
uint32_t nsBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS);
// Perform the SRAM1 memory initialization sequence
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
SRAMx.Instance = FMC_OR_FSMC(NORSRAM_DEVICE);
SRAMx.Extended = FMC_OR_FSMC(NORSRAM_EXTENDED_DEVICE);
// SRAMx.Init
SRAMx.Init.NSBank = nsBank;
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
SRAMx.Init.DataAddressMux = FMC_OR_FSMC(DATA_ADDRESS_MUX_DISABLE);
SRAMx.Init.MemoryType = FMC_OR_FSMC(MEMORY_TYPE_SRAM);
#ifdef STM32F446xx
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FMC_8BIT, FMC_NORSRAM_MEM_BUS_WIDTH_8, FMC_NORSRAM_MEM_BUS_WIDTH_16);
#else
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16);
SRAMx.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
SRAMx.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
SRAMx.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
SRAMx.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
SRAMx.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
SRAMx.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
SRAMx.Init.ExtendedMode = FSMC_EXTENDED_MODE_ENABLE;
SRAMx.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
SRAMx.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
#ifdef STM32F4xx
SRAMx.Init.PageSize = FSMC_PAGE_SIZE_NONE;
#endif
SRAMx.Init.BurstAccessMode = FMC_OR_FSMC(BURST_ACCESS_MODE_DISABLE);
SRAMx.Init.WaitSignalPolarity = FMC_OR_FSMC(WAIT_SIGNAL_POLARITY_LOW);
SRAMx.Init.WrapMode = FMC_OR_FSMC(WRAP_MODE_DISABLE);
SRAMx.Init.WaitSignalActive = FMC_OR_FSMC(WAIT_TIMING_BEFORE_WS);
SRAMx.Init.WriteOperation = FMC_OR_FSMC(WRITE_OPERATION_ENABLE);
SRAMx.Init.WaitSignal = FMC_OR_FSMC(WAIT_SIGNAL_DISABLE);
SRAMx.Init.ExtendedMode = FMC_OR_FSMC(EXTENDED_MODE_ENABLE);
SRAMx.Init.AsynchronousWait = FMC_OR_FSMC(ASYNCHRONOUS_WAIT_DISABLE);
SRAMx.Init.WriteBurst = FMC_OR_FSMC(WRITE_BURST_DISABLE);
#if defined(STM32F446xx) || defined(STM32F4xx)
SRAMx.Init.PageSize = FMC_OR_FSMC(PAGE_SIZE_NONE);
#endif
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
// Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
// Can be decreased from 15-15-24 to 4-4-8 with risk of stability loss
timing.AddressSetupTime = 15;
timing.AddressHoldTime = 15;
timing.DataSetupTime = 24;
timing.BusTurnAroundDuration = 0;
timing.CLKDivision = 16;
timing.DataLatency = 17;
timing.AccessMode = FSMC_ACCESS_MODE_A;
timing.AccessMode = FMC_OR_FSMC(ACCESS_MODE_A);
// Write Timing
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
extTiming.AddressSetupTime = 8;
@ -78,9 +85,13 @@ void TFT_FSMC::init() {
extTiming.BusTurnAroundDuration = 0;
extTiming.CLKDivision = 16;
extTiming.DataLatency = 17;
extTiming.AccessMode = FSMC_ACCESS_MODE_A;
extTiming.AccessMode = FMC_OR_FSMC(ACCESS_MODE_A);
#ifdef STM32F446xx
__HAL_RCC_FMC_CLK_ENABLE();
#else
__HAL_RCC_FSMC_CLK_ENABLE();
#endif
for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++)
pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC);
@ -90,9 +101,9 @@ void TFT_FSMC::init() {
controllerAddress = FSMC_BANK1_1;
#ifdef PF0
switch (nsBank) {
case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break;
case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break;
case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break;
case FMC_OR_FSMC(NORSRAM_BANK2): controllerAddress = FSMC_BANK1_2; break;
case FMC_OR_FSMC(NORSRAM_BANK3): controllerAddress = FSMC_BANK1_3; break;
case FMC_OR_FSMC(NORSRAM_BANK4): controllerAddress = FSMC_BANK1_4; break;
}
#endif
@ -100,11 +111,11 @@ void TFT_FSMC::init() {
HAL_SRAM_Init(&SRAMx, &timing, &extTiming);
#ifdef STM32F1xx
__HAL_RCC_DMA1_CLK_ENABLE();
DMAtx.Instance = DMA1_Channel1;
#elif defined(STM32F4xx)
__HAL_RCC_DMA2_CLK_ENABLE();
#ifdef STM32F1xx
DMAtx.Instance = DMA2_Channel1;
#elif defined(STM32F4xx)
DMAtx.Instance = DMA2_Stream0;
DMAtx.Init.Channel = DMA_CHANNEL_0;
DMAtx.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
@ -124,25 +135,20 @@ void TFT_FSMC::init() {
}
uint32_t TFT_FSMC::getID() {
uint32_t id;
writeReg(0);
id = LCD->RAM;
if (id == 0)
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = readID(LCD_READ_ID4);
uint32_t id = LCD->RAM;
if (id == 0) id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) id = readID(LCD_READ_ID4);
return id;
}
uint32_t TFT_FSMC::readID(const tft_data_t inReg) {
uint32_t id;
uint32_t TFT_FSMC::readID(tft_data_t inReg) {
writeReg(inReg);
id = LCD->RAM; // dummy read
uint32_t id = LCD->RAM; // dummy read
id = inReg << 24;
id |= (LCD->RAM & 0x00FF) << 16;
id |= (LCD->RAM & 0x00FF) << 8;
id |= LCD->RAM & 0x00FF;
id |= (LCD->RAM & 0x00FF);
return id;
}
@ -155,7 +161,9 @@ bool TFT_FSMC::isBusy() {
#define __IS_DMA_CONFIGURED(__HANDLE__) ((__HANDLE__)->Instance->PAR != 0)
#endif
#ifdef __IS_DMA_CONFIGURED
if (!__IS_DMA_CONFIGURED(&DMAtx)) return false;
#endif
// Check if DMA transfer error or transfer complete flags are set
if ((__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) == 0) && (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) == 0)) return true;
@ -174,8 +182,6 @@ void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t cou
DMAtx.Init.PeriphInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count);
TERN_(TFT_SHARED_IO, while (isBusy()));
}
void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {

View file

@ -28,11 +28,7 @@
#elif defined(STM32F4xx)
#include "stm32f4xx_hal.h"
#else
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif
#ifndef HAL_SRAM_MODULE_ENABLED
#error "SRAM module disabled for the STM32 framework (HAL_SRAM_MODULE_ENABLED)! Please consult the development team."
#error "FSMC/FMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif
#ifndef LCD_READ_ID
@ -55,6 +51,12 @@ typedef struct {
__IO tft_data_t RAM;
} LCD_CONTROLLER_TypeDef;
#ifdef STM32F446xx
#define FMC_OR_FSMC(N) _CAT(FMC_, N)
#else
#define FMC_OR_FSMC(N) _CAT(FSMC_, N)
#endif
class TFT_FSMC {
private:
static SRAM_HandleTypeDef SRAMx;
@ -62,7 +64,7 @@ class TFT_FSMC {
static LCD_CONTROLLER_TypeDef *LCD;
static uint32_t readID(const tft_data_t reg);
static uint32_t readID(tft_data_t inReg);
static void transmit(tft_data_t data) { LCD->RAM = data; __DSB(); }
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
@ -94,7 +96,11 @@ class TFT_FSMC {
#ifdef STM32F1xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)
#elif defined(STM32F4xx)
#ifdef STM32F446xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_FMC)
#else
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_FSMC)
#endif
#define FSMC_BANK1_1 0x60000000U
#define FSMC_BANK1_2 0x64000000U
#define FSMC_BANK1_3 0x68000000U
@ -104,35 +110,35 @@ class TFT_FSMC {
#endif
const PinMap pinMap_FSMC[] = {
{PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00
{PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01
{PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02
{PD_1, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D03
{PE_7, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D04
{PE_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D05
{PE_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D06
{PE_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D07
{PD_14, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D00
{PD_15, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D01
{PD_0, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D02
{PD_1, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D03
{PE_7, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D04
{PE_8, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D05
{PE_9, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D06
{PE_10, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D07
#if DISABLED(TFT_INTERFACE_FSMC_8BIT)
{PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
{PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
{PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
{PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
{PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
{PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
{PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
{PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
{PE_11, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D08
{PE_12, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D09
{PE_13, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D10
{PE_14, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D11
{PE_15, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D12
{PD_8, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D13
{PD_9, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D14
{PD_10, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D15
#endif
{PD_4, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NOE
{PD_5, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NWE
{PD_4, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_NOE
{PD_5, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_NWE
{NC, NP, 0}
};
const PinMap pinMap_FSMC_CS[] = {
{PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1
{PD_7, (void *)FMC_OR_FSMC(NORSRAM_BANK1), FSMC_PIN_DATA}, // FSMC_NE1
#ifdef PF0
{PG_9, (void *)FSMC_NORSRAM_BANK2, FSMC_PIN_DATA}, // FSMC_NE2
{PG_10, (void *)FSMC_NORSRAM_BANK3, FSMC_PIN_DATA}, // FSMC_NE3
{PG_12, (void *)FSMC_NORSRAM_BANK4, FSMC_PIN_DATA}, // FSMC_NE4
{PG_9, (void *)FMC_OR_FSMC(NORSRAM_BANK2), FSMC_PIN_DATA}, // FSMC_NE2
{PG_10, (void *)FMC_OR_FSMC(NORSRAM_BANK3), FSMC_PIN_DATA}, // FSMC_NE3
{PG_12, (void *)FMC_OR_FSMC(NORSRAM_BANK4), FSMC_PIN_DATA}, // FSMC_NE4
#endif
{NC, NP, 0}
};

View file

@ -459,7 +459,7 @@
#define BOARD_OPULO_LUMEN_REV4 5242 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG)
#define BOARD_FYSETC_SPIDER_KING407 5243 // FYSETC Spider King407 (STM32F407ZG)
#define BOARD_MKS_SKIPR_V1 5244 // MKS SKIPR v1.0 all-in-one board (STM32F407VE)
#define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE)
#define BOARD_TRONXY_CXY_446_V10 5245 // TRONXY CXY-446-V10-220413/CXY-V6-191121 (STM32F446ZE)
#define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1
#define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6.
#define BOARD_I3DBEEZ9_V1 5248 // I3DBEEZ9 V1 (STM32F407ZG)

View file

@ -806,8 +806,8 @@
#include "stm32f4/pins_FYSETC_SPIDER_KING407.h" // STM32F4 env:FYSETC_SPIDER_KING407
#elif MB(MKS_SKIPR_V1)
#include "stm32f4/pins_MKS_SKIPR_V1_0.h" // STM32F4 env:mks_skipr_v1 env:mks_skipr_v1_nobootloader
#elif MB(TRONXY_V10)
#include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy
#elif MB(TRONXY_CXY_446_V10)
#include "stm32f4/pins_TRONXY_CXY_446_V10.h" // STM32F4 env:TRONXY_CXY_446_V10 env:TRONXY_CXY_446_V10_usb_flash_drive
#elif MB(CREALITY_F401RE)
#include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality
#elif MB(BLACKPILL_CUSTOM)
@ -956,6 +956,7 @@
#define BOARD_LINUX_RAMPS 99926
#define BOARD_BTT_MANTA_M4P_V1_0 99927
#define BOARD_VAKE403D 99928
#define BOARD_TRONXY_V10 99929
#if MB(MKS_13)
#error "BOARD_MKS_13 is now BOARD_MKS_GEN_13. Please update your configuration."
@ -1015,6 +1016,8 @@
#error "BOARD_LINUX_RAMPS is now BOARD_SIMULATED. Please update your configuration."
#elif MB(BTT_MANTA_M4P_V1_0)
#error "BOARD_BTT_MANTA_M4P_V1_0 is now BOARD_BTT_MANTA_M4P_V2_1. Please update your configuration."
#elif MB(TRONXY_V10)
#error "BOARD_TRONXY_V10 is now BOARD_TRONXY_CXY_446_V10. Please update your configuration."
#elif MB(VAKE403D)
#error "BOARD_VAKE403D is no longer supported in Marlin."
#elif defined(MOTHERBOARD)
@ -1053,6 +1056,7 @@
#undef BOARD_LINUX_RAMPS
#undef BOARD_BTT_MANTA_M4P_V1_0
#undef BOARD_VAKE403D
#undef BOARD_TRONXY_V10
#endif

View file

@ -0,0 +1,256 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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/>.
*
*/
/**
* BOARD_TRONXY_CXY_446_V10
*
* CXY-V6-191121 / CXY-446-V10-220413
*/
#pragma once
#include "env_validate.h"
#if EXTRUDERS > 2 || E_STEPPERS > 2 || NUM_RUNOUT_SENSORS > 2
#error "TRONXY CXY 446 V10 only supports 2 Extruders / E steppers / Filament Runout sensors."
#endif
#define BOARD_INFO_NAME "BOARD_TRONXY_CXY_446_V10"
#define DEFAULT_MACHINE_NAME "TRONXY CXY 446 V10"
#define STEP_TIMER 6
#define TEMP_TIMER 14
//
// EEPROM
//
#if NO_EEPROM_SELECTED
#define I2C_EEPROM
//#define FLASH_EEPROM_EMULATION
#undef NO_EEPROM_SELECTED
#endif
#if ENABLED(FLASH_EEPROM_EMULATION)
#define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
#define EEPROM_PAGE_SIZE (0x800U) // 2K, but will use 2x more (4K)
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
#else
#define MARLIN_EEPROM_SIZE 0x800 // 2K (FT24C16A)
#endif
//
// SPI Flash
//
#define SPI_FLASH // W25Q16
#if ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_CS_PIN PG15
#define SPI_FLASH_MOSI_PIN PB5
#define SPI_FLASH_MISO_PIN PB4
#define SPI_FLASH_SCK_PIN PB3
#endif
//
// SD Card / Flash Drive
//
#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive Support
//
// SD Card
//
#define ONBOARD_SDIO
#define SD_DETECT_PIN -1
#define SDIO_CLOCK 4500000
#define SDIO_READ_RETRIES 16
#define SDIO_D0_PIN PC8
#define SDIO_D1_PIN PC9
#define SDIO_D2_PIN PC10
#define SDIO_D3_PIN PC11
#define SDIO_CK_PIN PC12
#define SDIO_CMD_PIN PD2
//
// Limit Switches
//
#define X_STOP_PIN PC15
#define Y_STOP_PIN PC14
#if ENABLED(FIX_MOUNTED_PROBE)
#define Z_STOP_PIN PE3
#else
#define Z_STOP_PIN PC13
#endif
//
// Filament Sensors
//
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_PIN PE6
#define FIL_RUNOUT2_PIN PF12
#endif
//
// Steppers
//
#define X_ENABLE_PIN PF0
#define X_STEP_PIN PE5
#define X_DIR_PIN PF1
#define Y_ENABLE_PIN PF5
#define Y_STEP_PIN PF9
#define Y_DIR_PIN PF3
#define Z_ENABLE_PIN PA5
#define Z_STEP_PIN PA6
#define Z_DIR_PIN PF15
#define E0_ENABLE_PIN PF14
#define E0_STEP_PIN PB1
#define E0_DIR_PIN PF13
#define E1_ENABLE_PIN PG5
#define E1_STEP_PIN PD12
#define E1_DIR_PIN PG4
//
// Temperature Sensors
//
#define TEMP_0_PIN PC3
#define TEMP_1_PIN PC0
#define TEMP_BED_PIN PC2
//
// Heaters
//
#define HEATER_0_PIN PG7 // Hotend #1 Heater
#define HEATER_1_PIN PA15 // Hotend #2 Heater
#define HEATER_BED_PIN PE2
//
// Fans
//
#define FAN_SOFT_PWM_REQUIRED
#define FAN0_PIN PG0 // Part Cooling Fan #1
#define FAN1_PIN PB6 // Part Cooling Fan #2
#define FAN2_PIN PG9 // Extruder/Hotend #1 Heatsink Fan
#define FAN3_PIN PF10 // Extruder/Hotend #2 Heatsink Fan
#define CONTROLLER_FAN_PIN PD7
//
// Laser / Servos
//
#define SPINDLE_LASER_ENA_PIN PB11 // WiFi Module TXD (Pin5)
#define SPINDLE_LASER_PWM_PIN PB10 // WiFi Module RXD (Pin4)
//
// NOTE: The PWM pin definition const PinMap PinMap_PWM[] in PeripheralPins.c must be augmented here.
// See PWM_PIN(x) definition for details.
//
//
// TFT with FSMC interface
//
#if HAS_FSMC_TFT
#define TOUCH_CS_PIN PD11
#define TOUCH_SCK_PIN PB13
#define TOUCH_MISO_PIN PB14
#define TOUCH_MOSI_PIN PB15
#define TFT_RESET_PIN PB12
#define TFT_BACKLIGHT_PIN PG8
#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 FSMC_CS_PIN PG12
#define FSMC_RS_PIN PG2
#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN
#if ENABLED(TFT_LVGL_UI)
#define HAS_SPI_FLASH_FONT 1
#define HAS_GCODE_PREVIEW 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
#define HAS_LANG_SELECT_SCREEN 1
#define HAS_BAK_VIEW_IN_FLASH 0
#define HAS_LOGO_IN_FLASH 0
#elif ANY(TFT_CLASSIC_UI, TFT_COLOR_UI)
//#define TFT_DRIVER ILI9488
#define TFT_BUFFER_WORDS 14400
#endif
// Touch Screen calibration
#if ENABLED(TFT_TRONXY_X5SA)
#ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X -17181
#endif
#ifndef TOUCH_CALIBRATION_Y
#define TOUCH_CALIBRATION_Y 11434
#endif
#ifndef TOUCH_OFFSET_X
#define TOUCH_OFFSET_X 501
#endif
#ifndef TOUCH_OFFSET_Y
#define TOUCH_OFFSET_Y -9
#endif
#ifndef TOUCH_ORIENTATION
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#endif
#endif
#if ENABLED(MKS_ROBIN_TFT43)
#ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X 17184
#endif
#ifndef TOUCH_CALIBRATION_Y
#define TOUCH_CALIBRATION_Y 10604
#endif
#ifndef TOUCH_OFFSET_X
#define TOUCH_OFFSET_X -31
#endif
#ifndef TOUCH_OFFSET_Y
#define TOUCH_OFFSET_Y -29
#endif
#ifndef TOUCH_ORIENTATION
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#endif
#endif
#else
#error "TRONXY CXY 446 V10 only supports TFT with FSMC interface."
#endif
//
// Power Loss
//
#if ENABLED(PSU_CONTROL)
#define PS_ON_PIN PG10
#define POWER_LOSS_PIN PE1
#endif
//
// Misc. Functions
//
//#define LED_PIN PG10
#define BEEPER_PIN PA8

View file

@ -1,257 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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
#include "env_validate.h"
#if HOTENDS > 3 || E_STEPPERS > 3
#error "Tronxy V10 supports up to 3 hotends / E steppers."
#endif
#define BOARD_INFO_NAME "Tronxy V10"
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
#define STEP_TIMER 6
#define TEMP_TIMER 14
//
// Servos
//
//#define SERVO0_PIN PB10
//
// EEPROM
//
#if NO_EEPROM_SELECTED
#undef NO_EEPROM_SELECTED
#if TRONXY_UI > 0
#define EEPROM_AT24CXX
#else
#define FLASH_EEPROM_EMULATION
#endif
#endif
#if ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB)
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
#else
#if ENABLED(EEPROM_AT24CXX)
#define AT24CXX_SCL PB8
#define AT24CXX_SDA PB9
#define AT24CXX_WP PB7
#else
#define I2C_EEPROM // AT24C32
#endif
#define MARLIN_EEPROM_SIZE 0x1000 // 4K
#endif
//
// SPI Flash
//
//#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x200000 // 2MB
#define SPI_FLASH_CS_PIN PG15 // SPI2
#define SPI_FLASH_SCK_PIN PB3
#define SPI_FLASH_MISO_PIN PB4
#define SPI_FLASH_MOSI_PIN PB5
#endif
//
// Limit Switches
//
#define X_MIN_PIN PC15
#define X_MAX_PIN PB0
#define Y_STOP_PIN PC14
#ifndef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN PE3
#endif
#if ENABLED(DUAL_Z_ENDSTOP_PROBE)
#if NUM_Z_STEPPERS > 1 && Z_HOME_TO_MAX // Swap Z1/Z2 for dual Z with max homing
#define Z_MIN_PIN PF11
#define Z_MAX_PIN PC13
#else
#define Z_MIN_PIN PC13
#define Z_MAX_PIN PF11
#endif
#else
#ifndef Z_STOP_PIN
#define Z_STOP_PIN PC13
#endif
#endif
//
// Filament Sensors
//
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN PE6 // MT_DET
#endif
#ifndef FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN PF12
#endif
//
// Steppers
//
#define X_ENABLE_PIN PF0
#define X_STEP_PIN PE5
#define X_DIR_PIN PF1
#define Y_ENABLE_PIN PF5
#define Y_STEP_PIN PF9
#define Y_DIR_PIN PF3
#define Z_ENABLE_PIN PA5
#define Z_STEP_PIN PA6
#define Z_DIR_PIN PF15
#define E0_ENABLE_PIN PF14
#define E0_STEP_PIN PB1
#define E0_DIR_PIN PF13
#define E1_ENABLE_PIN PG5
#define E1_STEP_PIN PD12
#define E1_DIR_PIN PG4
#define E2_ENABLE_PIN PF7
#define E2_STEP_PIN PF6
#define E2_DIR_PIN PF4
//
// Temperature Sensors
//
#define TEMP_0_PIN PC3 // TH1
#define TEMP_BED_PIN PC2 // TB1
//
// Heaters / Fans
//
#define HEATER_0_PIN PG7 // HEATER1
#define HEATER_BED_PIN PE2 // HOT BED
//#define HEATER_BED_INVERTING true
#define FAN0_PIN PG0 // FAN0
#define FAN1_PIN PB6 // FAN1
#define FAN2_PIN PG9 // FAN2
#define FAN3_PIN PF10 // FAN3
#define CONTROLLER_FAN_PIN PD7 // BOARD FAN
#define FAN_SOFT_PWM_REQUIRED
//
// Laser / Spindle
//
#if HAS_CUTTER
#define SPINDLE_LASER_ENA_PIN PB11 // wifi:TX
#if ENABLED(SPINDLE_LASER_USE_PWM)
#define SPINDLE_LASER_PWM_PIN PB10 // wifi:RX-TIM2_CH3
// The PWM pin definition const PinMap PinMap_PWM[] in PeripheralPins.c must be compounded here
// See PWM_PIN(x) definition for details
#endif
#endif
//
// Misc
//
#define BEEPER_PIN PA8
//#define LED_PIN PG10
#define PS_ON_PIN PG10 // Temporarily switch the machine with LED simulation
#if ENABLED(TRONXY_BACKUP_POWER)
#define POWER_LOSS_PIN PF11 // Configure as drop-down input
#else
#define POWER_LOSS_PIN PE1 // Output of LM393 comparator, configured as pullup
#endif
//#define POWER_LM393_PIN PE0 // +V for the LM393 comparator, configured as output high
#if ENABLED(TFT_TRONXY_X5SA)
#error "TFT_TRONXY_X5SA is not yet supported."
#endif
#if 0
//
// TFT with FSMC interface
//
#if HAS_FSMC_TFT
#define TFT_RESET_PIN PB12
#define TFT_BACKLIGHT_PIN PG8
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
#define TFT_CS_PIN PG12
#define TFT_RS_PIN PG2
//#define TFT_WIDTH 480
//#define TFT_HEIGHT 320
//#define TFT_PIXEL_OFFSET_X 48
//#define TFT_PIXEL_OFFSET_Y 32
//#define TFT_DRIVER ILI9488
//#define TFT_BUFFER_WORDS 14400
#if NEED_TOUCH_PINS
#define TOUCH_CS_PIN PD11 // SPI1_NSS
#define TOUCH_SCK_PIN PB13 // SPI1_SCK
#define TOUCH_MISO_PIN PB14 // SPI1_MISO
#define TOUCH_MOSI_PIN PB15 // SPI1_MOSI
#endif
#if (LCD_CHIP_INDEX == 1 && (TRONXY_UI == 1 || TRONXY_UI == 2)) || LCD_CHIP_INDEX == 3
#define TOUCH_CALIBRATION_X -17181
#define TOUCH_CALIBRATION_Y 11434
#define TOUCH_OFFSET_X 501
#define TOUCH_OFFSET_Y -9
#elif LCD_CHIP_INDEX == 1 && TRONXY_UI == 4
#define TOUCH_CALIBRATION_X 11166
#define TOUCH_CALIBRATION_Y 17162
#define TOUCH_OFFSET_X -10
#define TOUCH_OFFSET_Y -16
#elif LCD_CHIP_INDEX == 4 && TRONXY_UI == 3
//#define TOUCH_CALIBRATION_X 8781
//#define TOUCH_CALIBRATION_Y 11773
//#define TOUCH_OFFSET_X -17
//#define TOUCH_OFFSET_Y -16
// Upside-down
#define TOUCH_CALIBRATION_X -8553
#define TOUCH_CALIBRATION_Y -11667
#define TOUCH_OFFSET_X 253
#define TOUCH_OFFSET_Y 331
#elif LCD_CHIP_INDEX == 2
#define TOUCH_CALIBRATION_X 17184
#define TOUCH_CALIBRATION_Y 10604
#define TOUCH_OFFSET_X -31
#define TOUCH_OFFSET_Y -29
#endif
#endif
#endif
//
// SD Card
//
#define ONBOARD_SDIO
#define SD_DETECT_PIN -1 // PF0, but not connected
#define SDIO_CLOCK 4500000
#define SDIO_READ_RETRIES 16

View file

@ -0,0 +1,41 @@
#
# tronxy_cxy_446_v10.py
# Build customizations for env:TRONXY_CXY_446_V10
#
import pioutil
if pioutil.is_pio_build():
import marlin, os
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
# Check whether the "update" folder exists
outpath = "update"
if not os.path.exists(outpath): os.makedirs(outpath)
# Build "fmw_tronxy.hex" and place in "update" folder
def output_target_hex():
tar_hex = f"{outpath}/fmw_tronxy.hex"
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(" ".join([
"$OBJCOPY", "-O", "ihex", "-R", ".eeprom",
"$BUILD_DIR/${PROGNAME}.elf", tar_hex
]), "Building %s" % tar_hex)
)
# Build "fmw_tronxy.bin" and place in "update" folder
def output_target_bin():
tar_bin = f"{outpath}/fmw_tronxy.bin"
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(" ".join([
"$OBJCOPY", "-O", "binary", "-R", ".eeprom",
"$BUILD_DIR/${PROGNAME}.elf", tar_bin
]), "Building %s" % tar_bin)
)
output_target_hex()
output_target_bin()

View file

@ -95,3 +95,6 @@ extends = renamed
[env:STM32F407ZE_btt_USB] ;=> STM32F407ZE_btt_usb_flash_drive
extends = renamed
[env:STM32F446_tronxy] ;=> TRONXY_CXY_446_V10
extends = renamed

View file

@ -812,17 +812,29 @@ upload_protocol = dfu
upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE"
#
# STM32F446ZET6 ARM Cortex-M4
# TRONXY_CXY_446_V10 (STM32F446ZET6 ARM Cortex-M4)
#
[env:STM32F446_tronxy]
[env:TRONXY_CXY_446_V10]
extends = stm32_variant
board = marlin_STM32F446ZET_tronxy
board_build.ldscript = buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/ldscript.ld
board_build.offset = 0x10000
board_build.rename = fmw_tronxy.bin
build_flags = ${stm32_variant.build_flags}
-DSTM32F4xx
-DSTM32F4xx -DUSE_USB_HS
-DUSE_USB_HS_IN_FS
build_unflags = ${stm32_variant.build_unflags} -fno-rtti
-DUSBCON -DUSBD_USE_CDC
-fno-threadsafe-statics -fno-exceptions
-DUSBD_USE_CDC -DUSBCON
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/tronxy_cxy_446_v10.py
#
# TRONXY_CXY_446_V10 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support
#
[env:TRONXY_CXY_446_V10_usb_flash_drive]
extends = env:TRONXY_CXY_446_V10
platform_packages = ${stm_flash_drive.platform_packages}
#
# Blackpill