Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
9.58k stars 5.34k forks source link

BigTreetech TFT 24 not working #2231

Closed erik23de closed 3 years ago

erik23de commented 4 years ago

Hi,

Tried to set up Klippy on an skr 1.3 (from the example- configs), copy & pasted the Preprap GLCD into the config. Usually, testet with 3 Boards, Marlin and Repetier, the BigTreetech TFT 24 (and 35) works as a 12864 GLDC like a charm (First Display I'm really happy with). But it does not with Klipper, Screen stays empty (but reset switch works). Wiring is okay, it works with Marlin on the same board. What did I wrong?

klippy.zip

basha318i commented 4 years ago

Hello, I managed to get it working after changing SPI_ReEnable(!!(GPIOB->IDR & (1<<13))); to SPI_ReEnable(1) but again still with some artefacts. this is how it looks on a BTT TFT35 V3.0 connected to an SKR 1.4 Turbo. IMG_7694 I'm not sure if it's just me or everyone is having this, but it looks really dull; like the font needs to be changed & made smaller; also I believe there's a better way of arranging stuff, similar to the Marlin Simulation, maybe?

github-actions[bot] commented 3 years ago

Hello,

It looks like there hasn't been any recent updates on this Klipper github issue. If you created this issue and no longer consider it open, then please login to github and close the issue. Otherwise, if there is no further activity on this thread then it will be automatically closed in a few days.

Best regards,

~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

derBG commented 3 years ago

Meep

DroneMang commented 3 years ago

I gave up and went with the stock reprap full display for now, if this works that would be great! I got it working with the TFT 24 but I would have to restart the firmware somewhere between 5 to 10 times to get the display to actually come up.

On Tue, Dec 8, 2020, 5:46 PM derBG notifications@github.com wrote:

Meep

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/KevinOConnor/klipper/issues/2231#issuecomment-741163425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZZJSFVMJYNS2IX2J7CTILST2UFXANCNFSM4JTMCBVQ .

github-actions[bot] commented 3 years ago

Hello,

It looks like there hasn't been any recent updates on this Klipper github issue. If you created this issue and no longer consider it open, then please login to github and close the issue. Otherwise, if there is no further activity on this thread then it will be automatically closed in a few days.

Best regards,

~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

gkatev commented 3 years ago

@github-actions Let's keep it open? :)

MarsArtis commented 3 years ago

Any further updates on this issue? What's the current state of the BTT TFT on Klipper?

Regarding "Marlin Mode" / LCD12864 emulation mode: My TFT35 E3 V3.0 came with a firmware from June, this did not seem to work with Klipper. I compiled my own firmware, which works okay. Sometimes there are artefacts and sometimes you need to go to "touch mode" first and then to Marlin mode to make it work. You can download my firmware and use it at your own risk from: https://mega.nz/file/jbBUQKIa#xXKu3-K9MmVkF6lSxHjqni2rWLsxexGOXU1E_LxA-hc

I compiled this for an TFT35 E3 V3.0 used with an Ender 3 (2020) with BTT SKR MINI E3 v2.0 firmware (note that there are two versions of the TFT35 V3.0, this one is for the fit-in replacement of the Ender 3 LCD, hence the "E3" addition).

The relevant part from printer.cfg to use this

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=PB5, EXP1_3=PA9,   EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
    EXP1_2=PA15, EXP1_4=<RST>, EXP1_6=PB9,  EXP1_8=PB15, EXP1_10=<5V>

[output_pin beeper]
pin: EXP1_1

[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2

While reading replies in several issues in the BTT TFT Firmware repository, I assume adding "read-only" support for "Touchscreen mode" should be quite simple at least the following two ways:

  1. IF OctoPrint is able to "mirror" the data sent to Klipper to another serial port, connect your TFT directly to the GPIO pins of your Raspberry Pi (RX2/TX2/GND)
  2. Re-send the commands which are sent from Octoprint to Klipper over the TFT interface of the SKR (E3) mainboards, for the BTT SKR MINI E3 v2.0 this would be pins RX2/TX2

Can you tell If this custom firmware may be used on TFT24 too, please?

teeminus commented 3 years ago

I just posted a reply to https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware/issues/290: https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware/issues/290#issuecomment-759543165

I think I fixed the issue, at least for me the TFT35v3 is now working with klipper. I also created a very stripped down and minimalistic version of the firmware that has just the ST7920 emulator left as I only use that mode.

eremid commented 3 years ago

Thanks @teeminus ! So if I want to test on my TFT35v3, i need the firmware in your fork repository and the config bellow ?

[display]
lcd_type: st7920
cs_pin: P1.19
sclk_pin: P1.20
sid_pin: P1.18
encoder_pins: ^P3.26, ^P3.25
click_pin: ^!P0.28

Thanks

teeminus commented 3 years ago

@eremid You can either use the firmware from the fork (you have to compile it yourself) or you use the precompiled binary from the stripped down firmware: https://github.com/teeminus/NoTouchScreenFirmware

I don't know if the klipper config is correct as I have a different mainboard. At least all required config entries are present, so if the pins are correct the display should work.

MarsArtis commented 3 years ago

I just posted a reply to bigtreetech/BIGTREETECH-TouchScreenFirmware#290: bigtreetech/BIGTREETECH-TouchScreenFirmware#290 (comment)

I think I fixed the issue, at least for me the TFT35v3 is now working with klipper. I also created a very stripped down and minimalistic version of the firmware that has just the ST7920 emulator left as I only use that mode.

Have tried your custom Firmware with my BIGTREE_TFT24_V1_1. After the flashing is done I get this error:

Illegal FLASH APP!

Sellecta commented 3 years ago

I tried to use it on tft24, the screen is full of artifacts, maybe I got something wrong with the pins https://photos.app.goo.gl/1nHccEQo3xTKoiyY6

dsbaars commented 3 years ago

@MarsArtis @Sellecta the firmware I provided is for TFT35 (E3) only. Like @teeminus said, you have to compile it yourself.

Sellecta commented 3 years ago

@MarsArtis @Sellecta the firmware I provided is for TFT35 (E3) only. Like @teeminus said, you have to compile it yourself.

@teeminus compiled inhttps://github.com/teeminus/NoTouchScreenFirmware for tft24 and I used it

teeminus commented 3 years ago

@MarsArtis Try compiling the firmware yourself. If that does not work either, check if the original BTT touch firmware works, I changed nothing on the compile stuff.

@Sellecta Someone else already reported that issue: https://github.com/teeminus/NoTouchScreenFirmware/issues/1 But I not quite sure what causes the problems. I am not familar with the STM32s and I don't have a TFT24 for debugging. As the code works in general (the TFT35 is running fine) I would guess the problem is causes by the TFT24 specific code (like clocks, timings, etc.).

MarsArtis commented 3 years ago

@teeminus

@MarsArtis Try compiling the firmware yourself. If that does not work either, check if the original BTT touch firmware works, I changed nothing on the compile stuff. not sure if the tools are available for OSX to compile, I'll try. Anyway I did use the precompiled binary you make and wanted to report that it's not working.

teeminus commented 3 years ago

@MarsArtis You need platformio to compile the firmware. Edit the file platformio.ini and set default_envs=BIGTREE_TFT24_V1_1 to compile the firmware for the TFT24

MarsArtis commented 3 years ago

@MarsArtis You need platformio to compile the firmware. Edit the file platformio.ini and set default_envs=BIGTREE_TFT24_V1_1 to compile the firmware for the TFT24

@teeminus Since I'm pretty new to PlatformIO I'm asking you for few tips:

  1. how to "Disable fullscreen mode to prevent pixel overlap" ?
teeminus commented 3 years ago

@MarsArtis I disabled the fullscreen mode in the last commit. Just checkout the master branch and you are good to go.

MarsArtis commented 3 years ago

@MarsArtis I disabled the fullscreen mode in the last commit. Just checkout the master branch and you are good to go.

Ok, was not sure if I had to do it only in the config.ini or in the Platformio.ini itself. I did clone your git like 15 minutes ago.

MarsArtis commented 3 years ago

Some updates about TFT24 (connected to a SKR 1.4 TURBO) Compiled from teeminus branch and now the display started without errors but with black screen and the text LCD12864 Simulator. Have disabled fullscreen in config.ini like this:

#### Marlin Mode Fullscreen Support
# Run Marlin Mode in fullscreen.
#
# NOTE: Disable is recommended for TFT24.
#
#   Options: [enable: 1, disable: 0]
marlin_fullscreen:0

#### Marlin Mode Type
# Select Marlin Mode type.
#   Options: [LCD12864: 1, LCD2004: 0]
marlin_type:1

the klipper printer.cfg lines about the LCD :

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=<GND>,
    EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
    # EXP2 header
    EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=<GND>,
    EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=<RST>, EXP2_10=<NC>

[display]
lcd_type: st7920 #BTT TFT24
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2

[output_pin beeper]
pin: EXP1_1

any suggestion on next steps?

teeminus commented 3 years ago

@MarsArtis For my SKR Pro I have the following config (as suggested in the sample-lcd.cfg):

[display] lcd_type: st7920 cs_pin: EXP1_4 sclk_pin: EXP1_5 sid_pin: EXP1_3 encoder_pins: ^EXP2_3, ^EXP2_5 click_pin: ^!EXP1_2

MarsArtis commented 3 years ago

@MarsArtis For my SKR Pro I have the following config (as suggested in the sample-lcd.cfg):

[display] lcd_type: st7920 cs_pin: EXP1_4 sclk_pin: EXP1_5 sid_pin: EXP1_3 encoder_pins: ^EXP2_3, ^EXP2_5 click_pin: ^!EXP1_2

have already tried out that, still the same black screen with text LCD12864 Simulator. Btw, I've noticed that long pressing the knob on the TFT24 I'm still given the choice to select Marlin emulator and touch. Is that right?

To make sure I've compiled correctly the platformio.ini I'll paste here the initial strings:

[platformio]
src_dir      = src
boards_dir   = buildroot/boards
Build only Target = BIGTREE_TFT24_V1_1
default_envs = BIGTREE_TFT24_V1_1

and left everything else as is.

MarsArtis commented 3 years ago

Update: I flashed by mistake the TFT28.bin on my TFT24. So correctly using the TFT24 build from teeminus branch went "better". Now the screen shows something more, but still garbled as many other people reported:

IMG_20210115_233110

teeminus commented 3 years ago

You could try the klipper st7920 driver modification that @HenrikPPersson mentioned above: https://github.com/KevinOConnor/klipper/issues/2231#issuecomment-632909375

EDIT: That code snippet does not work any longer due to changes in the klipper code. However, replacing the line self.text_framebuffer[pos:pos+len(data)] = data with

        for c in data:
            self.write_graphics(x, y, font8x14.VGA_FONT[ord(c)])
            x = x+1

works for me.

Sineos commented 3 years ago

Just tried it for BIGTREE_TFT35_E3_V3_0 on SKR 1.4T

@teeminus proposed code change improves this but is still kind of a hack and for me the screen starts freaking out once the HE fan starts. A pity, but still not a fully working solution. Anyway, thanks for the efforts. Appreciated

MarsArtis commented 3 years ago

You could try the klipper st7920 driver modification that @HenrikPPersson mentioned above: #2231 (comment)

EDIT: That code snippet does not work any longer due to changes in the klipper code. However, replacing the line self.text_framebuffer[pos:pos+len(data)] = data with

        for c in data:
            self.write_graphics(x, y, font8x14.VGA_FONT[ord(c)])
            x = x+1

works for me.

Well, I really don't know where to start about this. But If you want to instruct me I'll try.

Sineos commented 3 years ago
  1. Open the file st7920.py in klipper/klippy/extras/display for editing
  2. Find the line self.text_framebuffer[pos:pos+len(data)] = data (around line 137)
  3. Replace the above with the pice of code @teeminus posted
  4. Save the file and restart Klipper
MarsArtis commented 3 years ago

Realy thank @Sineos and @teeminus I do confirm that TFT24 is working as per your instructions. At first (maybe very tired eyes) I did not find/saw the st7920.py in klipper/klippy/extras/display.

Modded and now it's showing clearly the screen text:

TFT24 For testing purposes I warmed the nozzle to 50°C but the TFTscreen remained at 21°

moreover The mainsail webgui is reporting me dirty Klipper version,I Suppose cause of the editing: Schermata 2021-01-17 alle 11 20 59

teeminus commented 3 years ago

Glad to hear that the work around works. But I agree with @Sineos, the work around is quite hacky and I also experienced screen flicker during printing. So we need to figure out a better solution that does not require modifying the klipper code.

nicedevil007 commented 3 years ago

@teeminus

First, thank you for that "mod" :)

Unfurtunately I flashed your firmware on my BTT3.5 V3 (showed the flashing process) Then I replaced the line in klipper/klippy/extras/display/st7920.py and die a restart of Klipper and the printer itself.

Screen stays black.

MarsArtis commented 3 years ago

@teeminus now I just need to make the LCD screen actually report whats going on with printer. As said it does not refresh temperatures

mbgroot commented 3 years ago

I do confirm that TFT24 is working as per your instructions.

With what firmware?

MarsArtis commented 3 years ago

I do confirm that TFT24 is working as per your instructions.

With what firmware?

with the one provided by teeminus (you have to use his source and compile with PlatformIO). Follow the recent posts and you'll get how to

qwuille commented 3 years ago

Awesome work @teeminus ! Just tried your source and just for the sake of it, one of the new touch themes on BTT's git. Everything works as documented here, "->" sign and Celsius sign does not appear. As stated before, menu is a little garbled until you start scrolling. For me, it looks like my content is a little more squished, like the width of the content does not stretch out on the sides. But other than that, it works.

All in all, it feels that either BTT should fix better support for other firmwares than Marlin and/or we need awesome peeps that can maintain a custom firmware like @teeminus .

teeminus commented 3 years ago

I completely reimplemented the ST7920 emulator from scratch and updated my NoTouchScreenFirmware.

The firmware now works without the need to modify the Klipper ST7920 driver. All screen artifacts are gone now, both the status screen and the menu work fine now (tested on the TFT35v3). Feel free to check that out and see if the firmware works for you as well.

mbgroot commented 3 years ago

On TFT24v11 black screen...

MarsArtis commented 3 years ago

I completely reimplemented the ST7920 emulator from scratch and updated my NoTouchScreenFirmware.

The firmware now works without the need to modify the Klipper ST7920 driver. All screen artifacts are gone now, both the status screen and the menu work fine now (tested on the TFT35v3). Feel free to check that out and see if the firmware works for you as well.

did a try right now against Klipper v0.9.1-205 flashed the rebuild .bin for TFT24 but all I get is a black screen with the text NOTOUCHFW V1.1

MarsArtis commented 3 years ago

these are the first lines of the platformio.ini I've tuned for the build:

`; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html

;BIGTREE_TFT35_V3_0 ;BIGTREE_TFT35_E3_V3_0 ;BIGTREE_TFT35_B1_V3_0 ;BIGTREE_TFT43_V3_0 ;BIGTREE_TFT50_V3_0 ;BIGTREE_TFT70_V3_0 ;BIGTREE_TFT28_V3_0 ;BIGTREE_TFT24_V1_1 ;MKS_32_V1_4 ;MKS_32_V1_4_NOBL ;MKS_28_V1_0

[platformio] src_dir = src boards_dir = buildroot/boards Build only Target = BIGTREE_TFT24_V1_1 default_envs = BIGTREE_TFT24_V1_1

;Release mode ;default_envs = BIGTREE_TFT24_V1_1, BIGTREE_TFT28_V3_0, BIGTREE_TFT35_B1_V3_0, BIGTREE_TFT35_E3_V3_0, BIGTREE_TFT35_V3_0, BIGTREE_TFT43_V3_0, BIGTREE_TFT50_V3_0, BIGTREE_TFT70_V3_0, MKS_28_V1_0, MKS_32_V1_4, MKS_32_V1_4_NOBL `

the odd thing I notice is that the output BIGTREE_TFT24_V1.1.26.x.bin is just 18kb in size while the previous build was 106kb

teeminus commented 3 years ago

@mbgroot @MarsArtis I created a new branch to debug the TFT24 issues where I reverted the SPI changes. The binary has been updated as well. Please check if that works.

The size of the binary has shrinked down to 18K as the complete touch functionality has been removed. There is only the Marlin mode left.

MarsArtis commented 3 years ago

@teeminus just downloaded debug_TFT24 as suggested, compiled, flashed but still black screen with NOTOUCHFW V1.1 text notiuch

any other clue?

teeminus commented 3 years ago

Can you please have a look on the backside of the PCB which controller is used for the TFT24? Maybe there is a problem with the amount of RAM available.

Have you restarted klipper and the firmware after flashing the TFT?

MarsArtis commented 3 years ago

Can you please have a look on the backside of the PCB which controller is used for the TFT24? Maybe there is a problem with the amount of RAM available.

btt24-1 btt24-2

Have you restarted klipper and the firmware after flashing the TFT? I did

teeminus commented 3 years ago

@MarsArtis I recompiled the firmware using the original STM linker file. Maybe that helps. Could you please open a new ticket in the NoTouchScreenFirmware repo as the problem is now more related to the firmware than to klipper.

MarsArtis commented 3 years ago

@KevinOConnor

we may say that everything is now working thanks to @teeminus custom firmware. Without any Klipper hack he made a firmware that make the TFT24 works in Marlin mode withaout any glitch.

GREAT JOB

jangrewe commented 3 years ago

oooh, exciting! I'm a long-time Marlin user who converted his Artillery Sidewinder X1 to Klipper today, and the "idle" display really bothered me. Marlin Mode by itself is better than a touchscreen that's showing only wrong info.

AFAIK the SWX1 has a MKS TFT28 3.2 in there, i'm going to try your FW as soon as i'm done with all the Klipper tuning instructions.

github-actions[bot] commented 3 years ago

Hello,

It looks like there hasn't been any recent updates on this Klipper github issue. If you created this issue and no longer consider it open, then please login to github and close the issue. Otherwise, if there is no further activity on this thread then it will be automatically closed in a few days.

Best regards,

~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

sagreen83 commented 3 years ago

Is anyone actively working on adding TFT35 support (native BTT touch firmware) to Klipper?

moebis commented 3 years ago

Too bad it's not possible to bypass the marlin mode completely and built a nice color and touch interface for Klipper and TFT35

Jhyrachy commented 3 years ago

in theory is possible, the problem is the knowledge to do it