Octoprint connects to Serial Port but does not connect to printer. Likely a timeout issue


What is the problem?
It appears that Octoprint will connect to my serial port, however it times out after a short while, then says no connection.

There was a timeout while trying to connect to the printer
Changing monitoring state from "Connecting" to "Offline"
Connection closed, closing down monitor

What did you already try to solve it?

I have tried switching between auto and 115200 Baud Rates, as well as Auto and ttyUSB0 for the Serial Port.
I double checked that the serial output is open on the Pi as well.
Still no luck.

Additional information about your setup

I am using a JG Aurora Z-603S with a Raspi B V1.2.

Running OctoPrint 1.3.8 running on OctoPi 0.15.1

octoprint.log (91.7 KB)

Thank you for your time. Any help is appreciated.


This is kind of interesting...

2018-06-20 22:22:09,217 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Detecting baudrate"
2018-06-20 22:22:09,318 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0 [x12]
2018-06-20 22:22:36,578 - octoprint.util.comm - ERROR - Something crashed inside the serial connection loop, please report this in OctoPrint's bug tracker:
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 1880, in _monitor
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/serialposix.py", line 577, in write
    raise SerialException('write failed: {}'.format(e))
SerialException: write failed: (9, 'Bad file descriptor')


serial.log (866 Bytes)


Not only that, I'd say this is the cause of the issues. It's falling on its face during baudrate detection since the serial port doesn't allow reconfiguration (and later writing) for some reason. And the error handling of that needs to be extended to be able to handle this fatal issue of the file descriptor being reported as bad.

With that being said - I'd check the output of dmesg to check what's going on here underneath OctoPrint, it certainly doesn't look like the serial device is stable.


Thank you for the reply!

Although I'm fairly familiar with electronics and things, when you say the serial device is unstable, are you referring to the raspi or the printer?

Thank you


The printer. Or rather, the printer's connection the OS that OctoPrint is running on. At least that's what my current hunch is based on the errors you are seeing, the output of dmesg (when logged into your Pi via SSH) when it happens might shed some more light on things.


It would be interesting to see what the file descriptor is in this case.

Remote in with ssh

Once in, try dmesg from the prompt, bring it back here, click that "</>" button above this box and insert what it said.