shishu94 / Klipperotchy

Companion tools for klipper
GNU General Public License v3.0
7 stars 3 forks source link

Moasic won't connect to printer #6

Closed cinealfa closed 4 months ago

cinealfa commented 4 months ago

Have serial bridge setup per instructions on pizero 2w. Everything on that ends seems ok. But the mosaic doesnt connect. I have tried putting in the actually address (/dev/ttyGS0) but nothing seems to happen. When I to connect through canvas I get a device error. Any ideas?

shishu94 commented 4 months ago

Hi!! Could you share a bit more about your setup ? Which printer and OS ? Can you access the moonraker page over your network ?

cinealfa commented 4 months ago

Sure! It is a creality k1 Max running rooted Running klipper I can connect to the moonraker page with no issues and I can connect to palette through script as well. But the palette doesn't seem to detect the serial port.

192.168.1.238.pdf Moonraker v0.8.pdf

shishu94 commented 4 months ago

Thanks. Then what would be helpful is to run the bridge code in a console without logging enabled.

Can you do the following:

If you added the service part that starts the bridge automatically run the following command (this will disable it to avoid conflicts)

sudo systemctl stop serial_moonraker_bridge.service

Then proceed with running the bridge in console mode via SSH:

cd ~/Klipperotchy/tools/serial_moonraker_bridge
python3 serial_moonraker_bridge.py --baudrate=115200 --moonraker=[moonraker_IP]:7125 --serial=/dev/ttyGS0 --log=INFO 

Keep an eye on the logs, it should start with something like:

Listenning Palette
Listenning Moonraker

Once this is done, try to connect on the P3 (with 115200 baudrate and /dev/ttyAMA0 port). You should see some activity on the console like follow:

<P3>.....</P3>
<Moonraker>.....</Moonraker>

Let me know if you have anything different than that.

cinealfa commented 4 months ago

There doesn't appear to be any traffic on the serial port... root@DietPi:~# cd ~/Klipperotchy/tools/serial_moonraker_bridge root@DietPi:~/Klipperotchy/tools/serial_moonraker_bridge# python3 serial_moonraker_bridge.py --baudrate=115200 --moonraker=192.168.1.215:7125 --serial=/dev/ttyGS0 --log=INFO Listening palette Listening moonraker

I changed cables and tried again same thing.

shishu94 commented 4 months ago

The bridge seems to be running fine in both cases. It detects the serial port and moonraker. Then the only possibility is the cable which might not be a data cable (many micro usb cable are not data). You are plugging the micro usb cable on the correct port of the pi zero, the one on the left side for peripherals ?

cinealfa commented 4 months ago

Yes and I have tried several cables. next step is to try another printer and see if the mosaic is the issue.

shishu94 commented 4 months ago

No need for another printer. The problem at least for now is between the P3 and the Pi Zero. If you are sure about the cable, then it is a config problem. I noticed the parameter that I gave to connect was wrong for the port (my bad).

The correct setting should be 115200 Baud Rate and /dev/ttyACM0 COM port. P3_connect1 P3_connect2

Can you retry with that again with the bridge in console mode, with the same setup as previous command ?

Make sure sure that the Web bridge is not running as it will capture the port.

cd ~/Klipperotchy/tools/serial_moonraker_bridge
python3 serial_moonraker_bridge.py --baudrate=115200 --moonraker=[moonraker_IP]:7125 --serial=/dev/ttyGS0 --log=INFO 

Also, are you running diet pi OS or raspberry pi OS on the bridge ? And last are those 2 changes done ?

In the file config.txt at the end of the file append the line:

dtoverlay=dwc2
In the file cmdline.txt at the end of the first line append:

modules-load=dwc2,g_serial
cinealfa commented 4 months ago

I am running Dietpi os and The 2 changes are in place.

I did check with another printer and it connected imediately so the mosaic is working. I have ordered a new cable that purports to be a data cable so will try that as well. There was no change in the behavior of the Palette. One question: The provided command "cd ~/Klipperotchy/tools/serial_moonraker_bridge python3 serial_moonraker_bridge.py --baudrate=115200 --moonraker=[moonraker_IP]:7125 --serial=/dev/ttyGS0 --log=INFO" shows the port as GS0 should it be ACM0 as well?

shishu94 commented 4 months ago

On the bridge (running on the pi zero 2) the port must be ttyGS0 On the palette the port is ttyACM0

cinealfa commented 4 months ago

Good to know! The new data cable arrived and unfortunately there was no change, however after fooling around I can get it to connect..sort of. I followed you instructions to cancel the service then triy to connect to the palette -no luck. Then repeat the process and the connection happens with the following info:

Listening palette Listening moonraker INFO:root:M105 INFO:root:B:21.8 /0.0 T0:23.4 /0.0 Process Process-1: Traceback (most recent call last): File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/root/Klipperotchy/tools/serial_moonraker_bridge/serial_moonraker_bridge.py", line 45, in listenPalette line = palette_ser.readline().decode("utf-8").strip() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 595, in read raise SerialException( serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?) To be clear it only connects the second time around and only if bridge service is disabled. Is any of this helpful to you?

cinealfa commented 4 months ago

2nd Update Now it connects automatically I do not have any clue why it has started to work. I rebooted the pi and it seems to connect. but it doesnt actually do anything. For example I try to heat the hotend and it doesnt seem to send the command to the printer.

shishu94 commented 4 months ago

The logs show activity from both sides. I can see the queries from the Palette3 and the response from Moonraker. So we know that the connection is working as intended, no faulty cable and the parameters are known. Now the inconsistency. The logs show concurrent access to the serial port, which makes me believe that the service isn't stopped. I will try today to add code to the service so we can see the logs somewhere, so you don't have to stop, run the serial command etc.

cinealfa commented 4 months ago

ok I will standby

provalinf commented 4 months ago

SerialException( serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?) To be clear it only connects the second time around and only if bridge service is disabled. Is any of this helpful to you?

Just to be sure, all options are set to off in dietpi-config? image

cinealfa commented 4 months ago

That seems to be the problem! Some of the serial consoles where on. Now it seems to connect correctly! I have clogged hotend which I need to fix before I can test it. Update: Printer connects! and starts to print. However it doesnt complete the print. But the not connecting issue is closed.