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

[FR] Lerdge-K/X I²C EEPROM #21313

Closed
Evg33 opened this issue Mar 11, 2021 · 22 comments
Closed

[FR] Lerdge-K/X I²C EEPROM #21313

Evg33 opened this issue Mar 11, 2021 · 22 comments
Labels
F: EEPROM T: Feature Request Features requested by users.

Comments

@Evg33
Copy link
Contributor

Evg33 commented Mar 11, 2021

How to make I²C EEPROM work?

Chip FM24CL64 F-RAM 64K (8Kx8)
Datasheet: https://www.cypress.com/file/41656/download

Wiring:
image

A0,A1,A2 on gnd. i.e. EEPROM_DEVICE_ADDRESS 0xA0 ?
image

#define I2C_EEPROM
#define I2C_SDA_PIN                         PG13
#define I2C_SCL_PIN                         PG14
//#define EEPROM_WRITE_DELAY              10
#define EEPROM_DEVICE_ADDRESS           0xA0
//#define MARLIN_EEPROM_SIZE            0x10000 // FM24CL64 F-RAM 64K (8Kx8)
#define MARLIN_EEPROM_SIZE              0x1000  // 4KB for testing

In this case M500 gets error "Error writing to EEPROM"

I tried with BL24CXX, but it doesn't compile.

#define IIC_BL24CXX_EEPROM            // not compiling
#define IIC_EEPROM_SDA                    PG13
#define IIC_EEPROM_SCL                    PG14

What am I doing wrong ?
Need additional code for FM24CL64 ?

@Evg33 Evg33 added the T: Feature Request Features requested by users. label Mar 11, 2021
@Evg33
Copy link
Contributor Author

Evg33 commented Mar 11, 2021

p.s.: write address +1

@GMagician
Copy link
Contributor

Not sure, I haven't checked code but maybe address is shifted by code, so you may have to define it as 0x50

@Evg33
Copy link
Contributor Author

Evg33 commented Mar 11, 2021

GMagician: yes ! EEPROM_DEVICE_ADDRESS must be 0x50 ! Thank you ! (127 devices on i2c)

But not working :(

SENDING:M500
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
....
SENDING:M261 A80 B5
echo:i2c-reply: from:80 bytes:5 data:€€€€€

@Evg33
Copy link
Contributor Author

Evg33 commented Mar 11, 2021

Hmmm. on Lerdge X with same i2c chip it working.... PR with pins later.... After testing...
Maybe I was wrong about the Lerdge-K pins. I need to check again...

@Evg33 Evg33 changed the title [FR] Lerdge-K I²C EEPROM [FR] Lerdge-K/X I²C EEPROM Mar 11, 2021
@Evg33
Copy link
Contributor Author

Evg33 commented Mar 11, 2021

Need help....
Maybe need changes in Marlin\buildroot\share\PlatformIO\variants\LERDGE\ ?
for example, here exist pins for Lerdge-X, but not exist for Lerdge-K:

//*** I2C ***
#ifdef HAL_I2C_MODULE_ENABLED
const PinMap PinMap_I2C_SDA[] = {
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PF_0, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{NC, NP, 0}
};
#endif
#ifdef HAL_I2C_MODULE_ENABLED
const PinMap PinMap_I2C_SCL[] = {
{PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{NC, NP, 0}
};
#endif

and TIMERS

#ifdef HAL_TIM_MODULE_ENABLED
const PinMap PinMap_PWM[] = {
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
//{PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
//{PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
//{PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
//{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
//{PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
//{PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
{PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
//{PA_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N
{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
//{PA_6, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1
//{PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
{PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
//{PA_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N
//{PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1
{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
//{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
//{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
{PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
//{PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N
//{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
//{PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
//{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
{PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
{PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
{PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
{PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
{PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
{PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
{PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
{PB_14, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N
{PB_14, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1
{PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
{PB_15, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
{PB_15, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2
{PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
{PC_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1
{PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
{PC_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2
{PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
{PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3
{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
{PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4
{PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
{PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
{PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
{PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
{PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
{PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
{PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
{PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
{PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
{PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
{PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
{PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
{PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
{PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
{PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
{PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1
{PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1
{NC, NP, 0}
};
#endif

@Evg33
Copy link
Contributor Author

Evg33 commented Mar 12, 2021

Who can help ?
I can test in HW.

@GMagician
Copy link
Contributor

GMagician commented Mar 12, 2021

I don't know how your board works, but have you seen #21337, give it a try

@Evg33
Copy link
Contributor Author

Evg33 commented Mar 12, 2021

I think it won't help. Lerdge-X works with this flash without problems.
But I'll try.

@Evg33
Copy link
Contributor Author

Evg33 commented Mar 13, 2021

with #21337 problem not solved on Lerdge-K :(

SENDING:M502
SENDING:M500
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
echo:Error writing to EEPROM!
...

config:

#define I2C_EEPROM
#define I2C_SCL_PIN                         PG14
#define I2C_SDA_PIN                         PG13
#define MARLIN_EEPROM_SIZE            0x10000 // FM24CL64 F-RAM 64K (8Kx8)

@dolence
Copy link

dolence commented Mar 22, 2021

Is there anything I can do to help testing this? I'm trying to move from the awful OFW to Marlin on my Lerdge K too.

@dolence
Copy link

dolence commented Mar 26, 2021

OK, I have this working on K. I 'm not very familiar with git usage and never worked with a project as large as this one, so maybe my approach wasn't the best. I will describe what I did and if anyone else can help me on sending a pull request I would be glad.
The problem is on which pins the EEPROM is wired on K. While X is using pins connected to a real hardware i2c, Lerdge K board have the chip wired to regular pins and probably do some bitbanging. After talking to Jason Nelson, he suggested me to use softi2c. I'm using SlowSoftI2CMaster together with SlowSoftWire, which is a nice wrapper to Wire library.

This is what I did:
On Marlin\platformio.ini I included this line to self resolve the SlowSoftI2CMaster library dependency.

# Feature Dependencies
#
[features]
....
SOFT_I2C_EEPROM         = SlowSoftI2CMaster
                          src_filter=+<src/feature/digipot>

Then I downloaded SlowSoftWire.cpp and SlowSoftWire.h from this github and manually copied it to Marlin.pio\libdeps\LERDGEK\SlowSoftI2CMaster.

Made this changes to Marlin\src\pins\stm32f4\pins_LERDGE_K.h

#define I2C_EEPROM
#define SOFT_I2C_EEPROM //added this to force the use of software i2c
#define I2C_SCL_PIN                         PG14
#define I2C_SDA_PIN                         PG13
#define MARLIN_EEPROM_SIZE               0x10000

On Marlin\src\HAL\shared\eeprom_if_i2c.cpp I made this changes:

#if ENABLED(I2C_EEPROM) && DISABLED(SOFT_I2C_EEPROM)
  #include <Wire.h> //use Wire library
#elif ENABLED(SOFT_I2C_EEPROM)
  #include <SlowSoftWire.h> //instead, use this softi2c to Wire wrapper
  SlowSoftWire Wire = SlowSoftWire(I2C_SDA_PIN, I2C_SCL_PIN, true);
#endif

Before the changes:
86b3062b-9ee9-4e5b-ad38-af0d077f6d8c

After the changes, so far working fine!
6080b139-6d7c-4ead-8eb4-1bf550679399

I was facing some issues with the display initialization. I can confirm this on bugfix and git main. I had to insert two lines from teh standard ST7796S initialization code to make it work properly.

Now I'm having some issues with my dual Z connected to Ex-Motor. At this moment I'm writing some details which I will update in here. Any help is appreciated.

Edit: some typos.

@GMagician
Copy link
Contributor

I see that there is some kind of soft i2c support when IIC_BL24CXX_EEPROM is enabled, maybe this can be used this the changed pinout you discovered

@dolence
Copy link

dolence commented Mar 26, 2021

I see that there is some kind of soft i2c support when IIC_BL24CXX_EEPROM is enabled, maybe this can be used this the changed pinout you discovered

I will take a look and do some code cleanup this night before I made a PR.

@dolence
Copy link

dolence commented Apr 8, 2021

If anyone wanna try, I just made a change to my fork which should solve this issue dolence/Marlin@c3940a82218e93e27157501ff35528d643a69411

Also, I would like to know if someone else is having problems with display initialization on K version 2.0.1 board.

@sanek88lbl
Copy link
Contributor

If anyone wanna try, I just made a change to my fork which should solve this issue dolence/Marlin@c3940a8

Also, I would like to know if someone else is having problems with display initialization on K version 2.0.1 board.

Hello. I downloaded your Marlin build, checked the work with epprom - it's ok.
I have Lerdge K v2.0.1 and I did not get the display working on your build. I use my last config - it worked. My config is attached.
However, I couldn't start USB OTG, I couldn't even start the build with usb_otg ga VS Code. Does it work for you? How do I do this?

conf.zip

@dolence
Copy link

dolence commented Apr 22, 2021

Hello. I downloaded your Marlin build, checked the work with epprom - it's ok.
I have Lerdge K v2.0.1 and I did not get the display working on your build. I use my last config - it worked. My config is attached.
However, I couldn't start USB OTG, I couldn't even start the build with usb_otg ga VS Code. Does it work for you? How do I do this?

Your display definition doesn't look right. If it worked, your colors are probably wrong (RGB channels inverted). Try changing TFT_DRIVER ST7796 to TFT_DRIVER LERDGE_ST7796

Are you sure you are using the bugfix-2.0.x-LerdgeK branch?
Unless we have different displays, it should be working.

I will try the USB-OTG thing and see if it works. Actually I'm having a problem with dual Z endstops and can't use my printer until it's figured out and have no idea on how to proceed, so I have decided to abandon this firmware and go back to original until someone else help to solve this #21414

@sanek88lbl
Copy link
Contributor

Your display definition doesn't look right. If it worked, your colors are probably wrong (RGB channels inverted). Try changing TFT_DRIVER ST7796 to TFT_DRIVER LERDGE_ST7796
Are you sure you are using the bugfix-2.0.x-LerdgeK branch?
Unless we have different displays, it should be working.

Yes, I used the wrong branch, but the problem was the display rotated 180 degrees and the touch screen did not work. I copied from my previous build. Now I used your branch with the correct LERDGE driver: the colors did change, but I liked it more with "TFT_DRIVER ST7796"). I also copied the settings of the touchscreen from my previous config-everything worked, thank you!)
Configuration.zip

I will try the USB-OTG thing and see if it works. Actually I'm having a problem with dual Z endstops and can't use my printer until it's figured out and have no idea on how to proceed, so I have decided to abandon this firmware and go back to original until someone else help to solve this #21414

I'll look at your problem with the second Z-axis motor.
In the meantime, I tried building a LERDGEK_USB_FLASH_DRIVE in VS code:

Processing LERDGEK_usb_flash_drive (platform: ststm32@~12.0; board: LERDGE; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
KeyError: 'usb-host-msc':
  File "C:\users\user\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 175:
    env.SConscript(item, exports="env")
  File "C:\Users\user\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\user\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\work\3d\firmware\marlin\Marlin-bugfix-2.0.x-LerdgeK\buildroot\share\PlatformIO\scripts\copy_marlin_variant_to_framework.py", line 34:
    FRAMEWORK_DIR = platform.get_package_dir(platform_name)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\platform\_packages.py", line 33:
    pkg = self.get_package(name)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\platform\_packages.py", line 30:
    return self.pm.get_package(spec or self.get_package_spec(name))
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\platform\_packages.py", line 22:
    owner=self.packages[name].get("owner"),
================================================= [FAILED] Took 0.84 seconds =================================================

Environment              Status    Duration
-----------------------  --------  ------------
LERDGEK_usb_flash_drive  FAILED    00:00:00.839
============================================ 1 failed, 0 succeeded in 00:00:00.839 ============================================

@dolence
Copy link

dolence commented Apr 22, 2021

Yes, I used the wrong branch, but the problem was the display rotated 180 degrees and the touch screen did not work. I copied from my previous build. Now I used your branch with the correct LERDGE driver: the colors did change, but I liked it more with "TFT_DRIVER ST7796"). I also copied the settings of the touchscreen from my previous config-everything worked, thank you!)

You should be able to change the display orientation this way:

/**
 * TFT Rotation. Set to one of the following values:
 *
 *   TFT_ROTATE_90,  TFT_ROTATE_90_MIRROR_X,  TFT_ROTATE_90_MIRROR_Y,
 *   TFT_ROTATE_180, TFT_ROTATE_180_MIRROR_X, TFT_ROTATE_180_MIRROR_Y,
 *   TFT_ROTATE_270, TFT_ROTATE_270_MIRROR_X, TFT_ROTATE_270_MIRROR_Y,
 *   TFT_MIRROR_X, TFT_MIRROR_Y, TFT_NO_ROTATION
 */
//#define TFT_ROTATION TFT_NO_ROTATION

@Evg33
Copy link
Contributor Author

Evg33 commented Apr 22, 2021

LERDGEK_usb_flash_drive FAILED 00:00:00.839

@sanek88lbl
Use non USB build
#21302

@slowbro
Copy link
Member

slowbro commented Jul 7, 2021

I think this was implemented in #21812.

@thisiskeithb
Copy link
Member

thisiskeithb commented Jul 7, 2021

I think this was implemented in #21812.

Yep and EEPROM pins for the Lerdge X were added in #21322.

@github-actions
Copy link

github-actions bot commented Sep 5, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F: EEPROM T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests

6 participants