oldhui-uk / tftbridge

Bridging BigTreeTech TFT35 and Klipper
GNU General Public License v3.0
4 stars 1 forks source link

Screen keeps saying no printer attached #2

Open poudenes opened 1 month ago

poudenes commented 1 month ago

Add the tftbridge.py in the /klipper/klippy/extras folder Paste the code

Add the lines:

[tftbridge]
tft_device: /dev/ttyAMA0
tft_baud: 250000
tft_timeout: 0
klipper_device: /home/poudenes/printer_data/comms/klippy.serial
klipper_baud: 250000
klipper_timeout: 0

/dev/

ttyACM0 ttyAMA0

Baut rate corrected in the screen menu

Beside that enabled UART3 to see if this make any difference.

Nothing works.

poudenes commented 1 month ago

I have a Bigtreetech TFT-35-E3 V3.0.1 touch screen The serial cable is ok. When I check the datasheet of the touchscreen the ribbon cable have same order to add them on the RPi4

The reset part has his own connection so I can leave that one alone.

But first post still there.

poudenes commented 1 month ago
Screenshot 2024-06-05 at 14 18 52
oldhui-uk commented 4 weeks ago

@poudenes This will be a debugging task in both hardware and software. TFT35 showing "printer not connected" simply means it is not getting any response from the printer. In this case, it is not getting anything from the "bridge".

  1. I assume you are using the RS232 port of your TFT35-E3 as this is the default port that the TFT35 uses to communicate with the printer controller board (when you use Marlin). Using other UARTs on the TFT35 will involve modifying the firmware. So don't bother. You will only use 4 pins: +5V, GND, TX2, RX2. As usual in a serial port connection, you need to swap TX and RX between the 2 devices. So TX of the display will connect to RX of the RPi UART, and the display's RX will connect to the RPi's TX. Sometimes this is confusing. Swapping the TX and RX may suddenly do the magic. This is part of the hardware side debugging.
  2. Depending on which RPi you use, there may be several UARTs. Some are enabled by default. Some need editing "/boot/config.txt" to enable. This one is on the RPi4, which you may find useful: https://jason19970210.medium.com/raspberry-pi-4-with-multiple-uart-interface-4eac75f74d7c
  3. Depending on which UART on the RPi that you use, find its pins. The link above is on RPi4, which I can confirm that it works as I recently converted mine to work on a different port. Again, if you use a different RPi, you may want to Google a bit on the pins.
  4. Now on the software side: We need to find out which device on the RPi is for the UART (that connects to the TFT35). Your device is showing ttyACM0 and ttyAMA0. ttyAMA0 is usually UART0. That's what I used in my default config. You may want to dig deeper on this topic. Or maybe trying using ttyACM0 instead of ttyAMA0. Remember this should be that UART that you connect your RPi to the TFT35.
  5. "klipper_device" in the config points to the virtual printer device in Klipper. In your setup, if you do a "ls /home/poudenes/printer_data/comms", you should see the file/device "klipper.serial". If not, then you need to look arouund and see where Klipper puts/creates this virtual device.

The above listed the major things you need to check. If it is still showing "printer not connected", you may want to try the original Python script version instead of Klipper addon: https://oldhui.wordpress.com/2024/01/28/using-btt-tft35-with-klipper-in-touch-mode/

If you are going to try this, undo the "Klipper addon" part. i.e. Remove the tftbridge.py file in the Klipper addon folder. Also remove the "tftbridge" section in your printer.cfg. Then run the Python script version above. Note that in this version, the configuration is set in the early part of the script. If everything is fine, it will print out communication in both directions to the screen.

poudenes commented 3 weeks ago

Hi,

Thanks for the information. Read all the info and only what I added to enabled serial interface with specific pins

/boot/config.txt
# enable serial interface
enable_uart=1
dtoverlay=uart0,txd0_pin=8,rxd0_pin=10

Started the python script and within seconds the TFT screen was running!!

This are the settings I used in the script

tftPort='/dev/ttyS0'
tftBaud=115200
tftTimeout=0
printerPort='/home/poudenes/printer_data/comms/klippy.serial'
printerBaud=115200

It's very unstable. When I put TX to RX and RX to TX and restart Klipper get a 100% overload and hang

scoudibou commented 2 weeks ago

Hello,

I had the same trouble and resolved by using the boot/config.txt parameters from @poudenes (with ttyS0 @115200 Bauds on RPI3) and the original python script. If I try to use it as an addon with same settings, it doesn't work. So i made a service from the original script and it seems working.

Thanks both of you!!