Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lerdge: ST7796S_INVERTED, Pins & Variant changes #22658

Merged
merged 32 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
99fec76
Lerdge K: Fix LERDGE_ST7796 TFT_DRIVER
tpruvot Aug 28, 2021
2a66043
Tweak TFT_*_PINs
thinkyhead Aug 28, 2021
50a4507
Reorg SD pins and adjust Lerdge X ones too
tpruvot Aug 29, 2021
0e6dcb3
Update Lerdge S, closer to the K (F407ZG too)
tpruvot Aug 29, 2021
09edbaa
Variant: Comment wrong pin definitions
tpruvot Aug 29, 2021
ff57631
pio: Allow to unset/ignore board_build.encrypt from parent env
tpruvot Aug 29, 2021
c2ac5c3
Undef SPI SD pins with SDIO enabled, not required
tpruvot Aug 29, 2021
d0a330e
Add missing SDIO pinmap in variant
tpruvot Aug 29, 2021
a6e9dab
Same SDIO pins logic for X & S
tpruvot Aug 29, 2021
7ad6e78
Remove SDSS -1, was only req. for F1 HAL
tpruvot Aug 29, 2021
a40481f
Prepare the I2C EEPROM/F-RAM for the Lerdge S
tpruvot Aug 29, 2021
1754b53
Lerdge S comments & cleanup
tpruvot Aug 29, 2021
97c2fe4
LerdgeK: Fix commented CS pins, same ones as UART
tpruvot Aug 29, 2021
14f5d70
Add LED Connector pin, to remember the pin
tpruvot Aug 29, 2021
34c73e2
Tune LEDs comments, 2 connectors :p
tpruvot Aug 29, 2021
ddfcaeb
SD without SDIO need SOFTWARE_SPI
tpruvot Aug 30, 2021
bed668f
Conflicting TIM6 used by Marlin, add notes in variant
tpruvot Aug 30, 2021
866c278
XPT2046 Touch INT pin is wired
tpruvot Aug 30, 2021
a24a64b
Variant: Allow to override timers, X S & K are different
tpruvot Aug 31, 2021
d3a827f
Run formatter
thinkyhead Aug 31, 2021
adff448
One less TFT driver name
thinkyhead Aug 31, 2021
afc0cd8
variant: add missing EXTI module, and move SRAM one
tpruvot Aug 31, 2021
240298e
Ex-Motor is not E2, can be Z2 or even X2/Y2
tpruvot Aug 31, 2021
e4f0278
oups, typo
tpruvot Aug 31, 2021
f340f51
view PR CI :p
tpruvot Aug 31, 2021
d3158f2
tweak newpanel items
thinkyhead Aug 31, 2021
3fad932
Ensure EXTI in all variants
thinkyhead Aug 31, 2021
afea7a2
Combine some TFTs, add a resolution
thinkyhead Aug 31, 2021
549a2ce
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/22658
thinkyhead Sep 1, 2021
c820a56
Final tweaks
thinkyhead Sep 1, 2021
a9f4e81
Update stm32f4.ini
thinkyhead Sep 1, 2021
f7ff137
Avoid AUTO where possible
thinkyhead Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,10 @@
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
#define TFT_INTERFACE_SPI
#elif ENABLED(LERDGE_TFT35) // ST7796
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
#define TFT_INTERFACE_FSMC
#elif ENABLED(ANET_ET5_TFT35) // ST7796
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft_io/tft_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#if TFT_DRIVER == ST7789 || TFT_DRIVER == AUTO
#include "st7789v.h"
#endif
#if TFT_DRIVER == ST7796 || TFT_DRIVER == AUTO
#if TFT_DRIVER == ST7796 || TFT_DRIVER == LERDGE_ST7796 || TFT_DRIVER == AUTO
#include "st7796s.h"
#endif
#if TFT_DRIVER == R61505 || TFT_DRIVER == AUTO
Expand Down
54 changes: 32 additions & 22 deletions Marlin/src/pins/stm32f4/pins_LERDGE_K.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,42 +72,42 @@
#define X_DIR_PIN PB10
#define X_ENABLE_PIN PG0
//#ifndef X_CS_PIN
// #define X_CS_PIN PE0
// #define X_CS_PIN PB2
//#endif

#define Y_STEP_PIN PF14
#define Y_DIR_PIN PF15
#define Y_ENABLE_PIN PF13
//#ifndef Y_CS_PIN
// #define Y_CS_PIN PE1
// #define Y_CS_PIN PE2
//#endif

#define Z_STEP_PIN PF11
#define Z_DIR_PIN PF12
#define Z_ENABLE_PIN PC5
//#ifndef Z_CS_PIN
// #define Z_CS_PIN PE2
// #define Z_CS_PIN PE3
//#endif

#define E0_STEP_PIN PC14
#define E0_DIR_PIN PC13
#define E0_ENABLE_PIN PC15
//#ifndef E0_CS_PIN
// #define E0_CS_PIN PE3
// #define E0_CS_PIN PE4
//#endif

#define E1_STEP_PIN PF1
#define E1_DIR_PIN PF0
#define E1_ENABLE_PIN PF2
//#ifndef E1_CS_PIN
// #define E1_CS_PIN PE4
// #define E1_CS_PIN PE1
//#endif

//#define E2_STEP_PIN PF4 // best guess
//#define E2_DIR_PIN PF3 // best guess
//#define E2_ENABLE_PIN PF5 // best guess
//#ifndef E2_CS_PIN
// #define E2_CS_PIN PB2 // best guess
// #define E2_CS_PIN PE0
//#endif

#if HAS_TMC_UART
Expand Down Expand Up @@ -211,35 +211,40 @@
//
#define SDIO_SUPPORT
#define SDIO_CLOCK 4800000
#define SD_DETECT_PIN PA8
#if DISABLED(SDIO_SUPPORT)
#define SOFTWARE_SPI
#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11
#define SDSS PC11
#endif

//
// Misc. Functions
//
#define SDSS PC11
#define LED_PIN PA15 // Alive
#define LED_PIN PA15 // Status LED
//#define LED_PIN PB6 // LED Connector
#define PS_ON_PIN PA4
#define KILL_PIN -1
#define KILL_PIN -1
#define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT

#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11

#define SD_DETECT_PIN PA8
#define BEEPER_PIN PC7

//
// TFT with FSMC interface
//
#if HAS_FSMC_TFT
//#define TFT_DRIVER LERDGE_ST7796
#undef TFT_DRIVER
#define TFT_DRIVER LERDGE_ST7796

#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3

#define TFT_CS_PIN PD7
#define TFT_RS_PIN PD11
#define FSMC_CS_PIN PD7
#define FSMC_RS_PIN PD11

#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN

#define TOUCH_CS_PIN PG15
#define TOUCH_SCK_PIN PB3
Expand All @@ -248,7 +253,12 @@
#endif

#if IS_NEWPANEL
#define BTN_EN1 PG10
#define BTN_EN2 PG11
#define BTN_EN1 PG11
#define BTN_EN2 PG10
#define BTN_ENC PG9
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2
#endif

#define BEEPER_PIN PC7
#endif
75 changes: 46 additions & 29 deletions Marlin/src/pins/stm32f4/pins_LERDGE_S.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#define STEP_TIMER 4
#define TEMP_TIMER 2

//#define I2C_EEPROM

// USB Flash Drive support
#define HAS_OTG_USB_HOST_SUPPORT

Expand Down Expand Up @@ -150,64 +148,83 @@
//
// Misc. Functions
//
#define SDSS PC11 // SD is working using SDIO, not sure if this definition is needed?
#define LED_PIN PC6 // Mainboard soldered green LED
#define PS_ON_PIN PB2 // Board has a power module connector
#define KILL_PIN -1 // There is no reset button on the LCD
#define POWER_LOSS_PIN -1 // PB2 could be used for this as well
#define KILL_PIN -1 // There is no reset button on the LCD
#define POWER_LOSS_PIN -1 // PB2 could be used for this as well

//
// SD support
//
#define SDIO_SUPPORT
#define SDIO_CLOCK 4800000

#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11

#define SD_DETECT_PIN PG15
#if DISABLED(SDIO_SUPPORT)
#define SOFTWARE_SPI
#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11
#define SDSS PC11
#endif

//
// Persistent Storage
// If no option is selected below the SD Card will be used
// (this section modelled after pins_LONGER3D_LK.h)
// Warning: Not tested yet! Pins traced with multimeter, mistakes are possible
// Prefer the I2C one (F-RAM) to store marlin settings, SPI one is not working yet

//#define SPI_EEPROM
//#define I2C_EEPROM

#if ENABLED(SPI_EEPROM)
// Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
// SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#elif ENABLED(I2C_EEPROM)
// FM24CL64BG (CYP1813) 64Kbit F-RAM
#define SOFT_I2C_EEPROM // Force the use of Software I2C
#define I2C_SDA_PIN PG13
#define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
#define MARLIN_EEPROM_SIZE 0x10000
#else
#define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM
#endif

//
// LCD / Controller
// TFT with FSMC interface
//
#if HAS_FSMC_TFT
#undef TFT_DRIVER
#define TFT_DRIVER LERDGE_ST7796

#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3

// The LCD is initialized in FSMC mode
#define BEEPER_PIN PD13
#define FSMC_CS_PIN PD7
#define FSMC_RS_PIN PD11

#define BTN_EN1 PC14
#define BTN_EN2 PC15
#define BTN_ENC PC13
#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN

#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3
#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4
#endif

#define TFT_CS_PIN PD7 // TFT works
#define TFT_RS_PIN PD11 // TFT works
#if IS_NEWPANEL
#define BTN_EN1 PC15
#define BTN_EN2 PC14
#define BTN_ENC PC13
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2
#endif

#define BEEPER_PIN PD13
#endif

// There is touch, but calibration is off
#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4
69 changes: 41 additions & 28 deletions Marlin/src/pins/stm32f4/pins_LERDGE_X.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,47 +113,60 @@
//#define CASE_LIGHT_PIN_DO -1
//#define NEOPIXEL_PIN -1

//
// SD support (On board)
//
#define SDIO_SUPPORT
#define SD_DETECT_PIN PA8
#define SDIO_CLOCK 4800000
#if DISABLED(SDIO_SUPPORT)
#define SOFTWARE_SPI
#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11
#define SDSS PC11
#endif

//
// Misc. Functions
//
#define SDSS PC11
#define LED_PIN PC7 // Alive
#define PS_ON_PIN -1
#define KILL_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1

// Lerdge supports auto-power off and power loss sense through a single pin.
#define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT

#define SD_SCK_PIN PC12
#define SD_MISO_PIN PC8
#define SD_MOSI_PIN PD2
#define SD_SS_PIN PC11

//
// SD support
// TFT with FSMC interface
//
#define SDIO_SUPPORT
#define SD_DETECT_PIN PA8
#define SDIO_CLOCK 4800000
#if HAS_FSMC_TFT
#undef TFT_DRIVER
#define TFT_DRIVER LERDGE_ST7796

//
// LCD / Controller
//
#define FSMC_CS_PIN PD7
#define FSMC_RS_PIN PD11

// The LCD is initialized in FSMC mode
#define BEEPER_PIN PD12
#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3

#define BTN_EN1 PE3
#define BTN_EN2 PE4
#define BTN_ENC PE2
#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN

#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3
#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4
#endif

#define TFT_CS_PIN PD7
#define TFT_RS_PIN PD11
#if IS_NEWPANEL
#define BTN_EN1 PE4
#define BTN_EN2 PE3
#define BTN_ENC PE2
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2
#endif

#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4
#define BEEPER_PIN PD12
#endif
5 changes: 3 additions & 2 deletions buildroot/share/PlatformIO/scripts/lerdge.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def encrypt(source, target, env):
renamed.close()

if 'encrypt' in board.get("build").keys():
marlin.add_post_action(encrypt);
if board.get("build.encrypt") != "":
marlin.add_post_action(encrypt)
else:
print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter")
exit(1);
exit(1)
3 changes: 2 additions & 1 deletion buildroot/share/PlatformIO/scripts/offset_and_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
def encrypt(source, target, env):
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))

marlin.add_post_action(encrypt);
if board.get("build.encrypt") != "":
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
marlin.add_post_action(encrypt)

#
# For build.rename simply rename the firmware file.
Expand Down
18 changes: 18 additions & 0 deletions buildroot/share/PlatformIO/variants/MARLIN_LERDGE/PeripheralPins.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,21 @@ const PinMap PinMap_USB_OTG_HS[] = {
{NC, NP, 0}
};
#endif

//*** SD ***

#ifdef HAL_SD_MODULE_ENABLED
WEAK const PinMap PinMap_SD[] = {
//{PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4
//{PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5
//{PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6
//{PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7
{PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0
{PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1
{PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2
{PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3
{PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK
{PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD
{NC, NP, 0}
};
#endif
Loading