Ender 3 V2 loses serial connection when printing

What is the problem?

Ender 3 V2 loses serial connection 30-45 minutes into any print. Seems to be caused by the motor movement, as heating and idling do not cause any problems. I am running OctoPrint from a laptop with Ubuntu.

What did you already try to solve it?

  • Changed USB cable and port
  • Blocked 5V pin on USB cable
  • Updated firmware
  • Updated OctoPrint

I managed to get something that works by uploading files to an SD card inside the printer, then printing from that. However, this method has a host of problems, most notably occasional file corruption (possibly related to bad serial connection?) and awful upload speeds.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, what kind of hardware precisely, ...)

  • Ender 3 V2
    • Latest firmware from GitHub
  • Ubuntu 20.04.02 LTS
    • OctoPrint 1.5.3
    • Running on an Dell Inspiron 6400 laptop

Hello @PerfectlyInternal !

This issue with the Ender 3 printers occur here all the time.

Uploading a file from OctoPrint to the printers SD card usually works as printing: line after line. That is why it takes its time.

Anyhow, can you share the logs?

Here is octoprint.log just before losing connection. Every time it disconnects like this, with a SerialException. This section in particular was during a print running from the SD card, so the motors were definitely moving when the server lost connection.

2021-01-31 23:30:38,857 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Opening serial connection"
2021-01-31 23:30:38,858 - octoprint.plugins.meatpack - INFO - [Serial]: Cannot query packing state -- port not open.
2021-01-31 23:30:38,858 - octoprint.plugins.meatpack - INFO - [Serial]: Cannot query packing state -- port not open.
2021-01-31 23:30:38,886 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial connection" to "Connecting"
2021-01-31 23:30:38,894 - octoprint.plugins.meatpack - INFO - [Serial]: Config var [Enabled] synchronized (=enabled).
2021-01-31 23:30:38,894 - octoprint.plugins.meatpack - INFO - [Serial]: Config var [NoSpaces] synchronized (=enabled).
2021-01-31 23:30:38,894 - octoprint.plugins.meatpack - INFO - [Serial]: MeatPack configuration successfully synchronized and confirmed between host/device.
2021-01-31 23:30:38,895 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-01-31 23:30:38,997 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-01-31 23:30:39,015 - octoprint.util.comm - INFO - Changing monitoring state from "Connecting" to "Operational"
2021-01-31 23:30:39,086 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-01-31 23:30:39,254 - octoprint.util.comm - INFO - Printer reports firmware name "Marlin bugfix-2.0.x (Jan 31 2021"
2021-01-31 23:30:39,271 - octoprint.util.comm - INFO - Firmware states that it supports temperature autoreporting
2021-01-31 23:30:39,304 - octoprint.util.comm - INFO - Externally triggered heatup detected
2021-01-31 23:30:39,648 - octoprint.plugins.tracking - INFO - Sent tracking event printer_connected, payload: {'firmware_name': 'Marlin bugfix-2.0.x (Jan 31 2021', 'printer_port': '/dev/ttyUSB0', 'printer_baudrate': 115200}
2021-01-31 23:30:41,860 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-01-31 23:30:41,864 - octoprint.util.comm - INFO - Telling the printer to set the busy interval to our "communicationBusy" timeout - 1s = 2s
2021-01-31 23:33:53,470 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.1.54
2021-01-31 23:43:44,593 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
  File "/home/octoprint/python_venvs/octoprint1/lib/python3.8/site-packages/octoprint/util/comm.py", line 3831, in _readline
    ret = self._serial.readline()
  File "/home/octoprint/python_venvs/octoprint1/lib/python3.8/site-packages/OctoPrint_MeatPack/packing_serial.py", line 182, in readline
    read = super(PackingSerial, self).readline(**kwargs)
  File "/home/octoprint/python_venvs/octoprint1/lib/python3.8/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?)
2021-01-31 23:43:44,595 - octoprint.util.comm - ERROR - Please see https://faq.octoprint.org/serialerror for possible reasons of this.
2021-01-31 23:43:44,602 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Offline (Error: SerialException: 'device reports readiness to read but returned no data (device disconnected or multiple access on port?)' @ comm.py:_readline:3831)"
2021-01-31 23:43:44,608 - octoprint.plugins.action_command_notification - INFO - Notifications cleared

Seems to be an issue with the "MeatPack" plugin. Don't know if the author, Scott, is on this forum, but I recommend taking it to the plugin GitHub repository. There already seems to be an issue that seems to be related; OctoPrint unable to connect to printer when plug-in is enabled Β· Issue #12 Β· scottmudge/OctoPrint-MeatPack Β· GitHub. It's probably a good idea to comment in there that you have the same issue, read the previous comments, and post your log there as well. Good luck :slight_smile:

Good catch on that, @scottmudge is on the forums. That would have been a really really useful thing to mention in the initial post, since it is basically re-writing the serial comms.

@PerfectlyInternal Test in safe mode, for sure, upload the full log (not just a snippet - the whole thing) and get in touch with the author. They've got some knowledgeable people from Marlin helping on that issue. They've apparently re-written a lot of the serial comms (source) in bugfix, which comes to my second recommendation:

If something is broken in a Marlin nightly build, roll back the the stable branch. They are not meant for production.

^ This tells us absolutely nothing about your firmware build.

1 Like

I installed MeatPack in hopes of improving SD upload speeds, the problem of losing serial connection was there well before it.

Well, the error shows MeatPack being part of the problem. Does it happen in safe mode as well?

1 Like

You need an appropriate firmware for MeatPack. It does not work with every Marlin firmware.

2 Likes

Can you check the messages log when the issue occurs?

I see on my log usb disconnections.

Bye

SSH to octopi.local

sudo apt-get update
sudo apt-get install libusb-dev

git clone https://github.com/mvp/uhubctl.git
cd uhubctl
make 
sudo make install
=====================
list connect usb devices:
sudo uhubctl

Current status for hub 1-1 [0424:2514, USB 2.00, 4 ports, ppps]
  Port 1: 0503 power highspeed enable connect [0424:2514, USB 2.00, 3 ports, ppps]
  Port 2: 0100 power
  Port 3: 0000 off
  Port 4: 0100 power

sudo uhubctl -l 1-1 -p 3 -a 0 ; port 3 switch off
sudo uhubctl -l 1-1 -p 3 -a 1 ; port 3 switch on

Connect USB cable Ender 3v2 to powerd off port Octopi.

This workt for me.

I never had this issue since I got my Ender 3, but I run into it few weeks ago.
It might be EMI by chance or it might be caused by a firmware update I did. I updated from stock (Creality 1.1.6.2) to Marlin 1.1.9 with MeshBedleveling.

However I solved this problem (so far) the following way:
(firmware downgrade was not an option)

  • removed the tape on the 5v line of the usb cable
  • add uhubctl (see post before) to /etc/rc.local, so power gets disconnected at boot:
/usr/sbin/uhubctl -a off -l 1-1 -p 2
  • at this moment Octoprint won't connect to the printer anymore, so usb power (in terms of uhubctl - it works by insulating the usb 5V line with tape) is needed for a serial connection and printing
  • using Octorprint-Plugins such as tasmota, System command Editor, Shutdown Printer I enable usb power (uhubctl) after powering up the printer and before the printer gets connected (tasmota Plugin) and disable usb power after serial disconnect and before powering off the printer
  • until now Octoprint never lost the serial connection
  • Octoprint just annoys me about the low voltage of the PI which only occurs one time at boot