SerialException while printing

What is the problem?

Constant disconnections occur while attempting to print

What did you already try to solve it?

Tried 3 differents USB A to USB C cables.
Cut the red 5v cable of the USB cable
Moved power cables to different plugs of a UPS; Raspberry pi is connected to the standard UPS output (battery and power stabilization) and the printer only to the power stabilization.
Tried using a USB HUB with power connection (disconnects faster?).
Tried safe mode
Also tried disconnecting the Raspberry Pi camera.

No refrigerator, air conditioner, microwave nearby.

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20230814145536.zip (2.3 MB)

Additional information about your setup

OctoPrint 1.9.2
OctoPi 1.0
Anycubic Kobra Neo with Firmware 1.3.3
Raspberry Pi Zero 2W (bought last week, installed system since Saturday night using Pi Imager and new camera stack (I have Raspberry Pi Camera Module 3)
Official Raspberry Pi MicroUSB PSU 5.1V 2.5A
New SD Card (bought 2 months ago with no use)

There is not a lot to go on in your logs.
There is this:

2023-08-14 14:53:08,938 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2023-08-14 14:54:42,001 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
  File "/home/dievexx/oprint/lib/python3.9/site-packages/octoprint/util/comm.py", line 4081, in _readline
    ret = self._serial.readline()
  File "/home/dievexx/oprint/lib/python3.9/site-packages/octoprint/util/comm.py", line 6832, in readline
    c = self.read(1)
  File "/home/dievexx/oprint/lib/python3.9/site-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?)

But that is just saying what you already know. The Serial comm is failing.

Turn on the serial.log and send that so we can see what it received. That said, it is not likely to really help, most of these issues are cable/noise related.

Did you search the forums for related issues. I know there is a lot out there.

Some other general things to consider... All found in many other posts.. also not an exaustive list on the topic.

Are you using a good quality cable?
Is the cable as short as it can be?
Is the cable shielded?
Does the cable running past the servo cables? Does it have a ferrite bead on it? (I have neve needed this one but some say it has fixed there issues.)

There is also a featured post that is directly related but easy to miss.
Are you blocking the power line form the printer to the Pi? There are multiple ways to solve this.
This thread has a number of them listed.. From the quick and risky to the costly and unnecessary. Also a few in the middle ground.

Possibly a PSU problem. The Pi needs a stable PSU. Especially when using the serial port.

A lot of these supplies that are sold as compatible are really not that great. I bought a few that gave figures of 3A, only to find in the small print on the PSU that that current is at a Voltage other than the 5V required by the Pi.

In the end I just bought one from the PiHut. Now no more problems with the PSU or serial ports.

I'm using the Official Raspberry Pi PSU

Already tried the solution provided in that link. I've cutted the 5V red wire.

Are you using a good quality cable? Ugreen cable from Amazon.
Is the cable as short as it can be? Tried with 3m and 50cm cable.
Is the cable shielded? Yes, I saw the metallic paper over the cable while cutting the 5v cable.

What do u mean with this:

I have not any USB A to USB C with ferrite

I will keep searching for more posts in the forum to see if I can solve this.. :smiling_face_with_tear:

When the serial throws an exception, It usually means there is a failed data packet and the only thing that can cause that is the sending machine. In this case the Pi or the leads or connectors on the Printer and the Pi or the printer itself.

Out of interest are you running the camera and at what resolution?

As a test, disconnect the camera as this can draw a lot of current, depending on resolution. There have been reports of the Pi zero getting somewhat toasty, which in turn would cause the supply to glitch.

You need to enable the serial log to help track this down.

Printed this: OctoPrint disconnect fix (SerialException) by Mikael70 - Thingiverse no fix yet.
Got a new USB cable with a ferrite in both ends and didn't fix it...
Also got a bunch of Ferrite cores from amazon and put at the printer's power cable and every device connected to the UPS.

All my new previous tests were made with the camera disconnected.

Raspberry Pi Zero gets sometimes 70ºC maybe the issue comes from that???

EDIT: new systeminfo with serial.log enabled

Please always attach your updated logs to your most recent post. Because:

  • There is nor wild scrolling around (regular readers always get the most resent posts shown.
  • The old logs are still there for comparison
  • The reader knows what is the newest

The serial.log gives this:

2023-08-17 19:10:18,136 - Unexpected error while reading serial port, please consult octoprint.log for details: SerialException: 'device reports readiness to read but returned no data (device disconnected or multiple access on port?)' @ comm.py:_readline:4081
2023-08-17 19:10:18,137 - Please see https://faq.octoprint.org/serialerror for possible reasons of this.
2023-08-17 19:10:18,161 - Changing monitoring state from "Printing" to "Offline after error"
2023-08-17 19:10:18,191 - Connection closed, closing down monitor

And the octoprint.log:

2023-08-17 19:10:18,075 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
  File "/home/dievexx/oprint/lib/python3.9/site-packages/octoprint/util/comm.py", line 4081, in _readline
    ret = self._serial.readline()
  File "/home/dievexx/oprint/lib/python3.9/site-packages/octoprint/util/comm.py", line 6832, in readline
    c = self.read(1)
  File "/home/dievexx/oprint/lib/python3.9/site-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?)

In short words: The printer denied communication.

Or just the USB chip on the Pi Zero. 70°C is quite hot, almost too hot.

In that case.. how this can be solved?

I'm testing with a really big fan pointing to the pi to see if the issue is heat related.

Heat sinks on the chips help quite a lot.

Actual firmware. But first try with cooling

I can confirm that it is not a heating problem, it is currently working at 45ºC.

Today I have been able to print 2 things, after putting (more) ferrites and all the other changes, the disconnection problem only appears now when I have the camera connected to the Raspi Zero, if I disconnect it the SerialException failures do not occur, however the camera works correctly I do not understand very well why, any idea?

EDIT: Today the same issue... SerialException without camera connected ....

I'm running out of ideas, the firmware the printer uses is 1.3.3 (last uploaded by Anycubic). GitHub - ANYCUBIC-3D/Kobra_Neo

I had the same issue with a Anet ET4 that was disconnecting and I tried multiple solutions to no avail. I fixed it by bypassing the USB to serial chip and interfacing the Pi directly to the serial interface of the controller and it has been flawless since. If your printer has a spare serial port it's fairly easy to do as long as you can enable the serial port , if not then you hack it like I did by connecting to the serial pins of the chip and disabling the chip by desoldering the +5v ,however it's delicate work since the pins are very close together. BTW the USB to serial chip is the CH340G and the pins you have to connect to are pin 1-gnd,2-tx,3-rx, and the +5 is pin 16. Good luck.

Thank you very much for your answer, could you give me more details of the process or where I could find them??

I checked the motherboard for your printer and it does use the CH340G chip and I don`t see any spare serial ports, so you can do like I did , connect to pin 1,2,3 of the chip and disconnect pin 16. If that looks to be to complex for you then your only solution is to print from SD card or change your board for another model.

I think you and I have the same issue, but with different setup. So I'm thinking it's more software than hardware. I have never experienced this until my last print. And my setup hasn't changed. Only software updates. (https://community.octoprint.org/t/print-stop-after-serial-connection-lost-due-to-unknown-error/53529/2)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.