Octoprint not connecting via /dev/ttyS0 after upgrade to 1.8.1

Since upgrading to 1.8.1, Octoprint refuses to connect to printer (BTT SKR 1.4 Turbo board). Connection is achieved via UART on Raspberry Pi 3B+ at 250000 baud. This connection has been working prior to the upgrade.

Terminal window in safe mode indicates that a SerialException is being generated when opening the port with the exception string 'Invalid Argument', which appears to be due to the speed selected. Changing to 230400 prevents the SerialException, but does not connect to the printer due to mismatched baudrate. Attempts to change the internal UART assignment with dtoverlay=pi3-miniuart-bt did not resolve this, although ttyAMA0 does not raise the SerialException for 250000.

The pyserial documentation does not include the 250000 baud rate, and I'm suspicious that an update to either the pyserial library or an underlying component of the system no longer permits the use of this speed, or at least not via this UART.

I would prefer to avoid using the USB connection or moving to a Pi 4 due to having the boards mounted in a box inside the printer without access to the USB port on the mainboard. I suspect that this will require a rebuild of Marlin to use a different baudrate, but if anybody has any other advice or alternatives I would love to hear them.

PySerial hasn't been updated since September 2020, it's quite unlikely that it has updated for you, unless you have updated from some years-old OctoPrint version - you didn't say.

Nothing's changed in OctoPrint's handling of connecting to the serial port that would significantly change things like this - there was a new option to request low latency mode in 1.7.x, but that defaults to off because it doesn't work for many people's printers.

Can you include the systeminfo bundle so we can see the actual error messages?

I upgraded from 1.8.0, but the system is several years old (logs go back to March 2020).

I believe I updated from 1.7.3 to 1.8.0 at the end of the last time that I used the printer, and it may have occurred then without me noticing. I'm not sure if I updated the OS at the same time, which could also be the cause of the issue.

As it is, I'm now pretty much resigned to having to do a new Marlin build, and I'll probably just set up a fresh version of OctoPi as well when I've managed to do that. Hopefully this clears the issue and I won't have to find a way to reprint the housings for the boards!

Terminal outputs for attempting to connect at 250000 and 230400 are as follows:

Changing monitoring state from "Offline" to "Opening serial connection"
Connecting to port /dev/ttyS0, baudrate 250000
Changing monitoring state from "Opening serial connection" to "Error"
Changing monitoring state from "Error" to "Offline after error"
Unexpected error while connecting to serial port /dev/ttyS0, baudrate 250000 from hook default: error: '(22, 'Invalid argument')' @ comm.py:_open_serial:3836

Changing monitoring state from "Offline" to "Opening serial connection"
Connecting to port /dev/ttyS0, baudrate 230400
Changing monitoring state from "Opening serial connection" to "Connecting"
Connected to: Serial<id=0x6ebb9150, open=True>(port='/dev/ttyS0', baudrate=230400, bytesize=8, parity='N', stopbits=1, timeout=10.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
Send: N0 M110 N0*125

Traceback in the log for 250000 is as follows:

2022-06-04 19:08:39,898 - octoprint.util.comm - ERROR - Unexpected error while connecting to serial port /dev/ttyS0, baudrate 250000 from hook default: error: '(22, 'Invalid argument')' @ comm.py:_open_serial:3836
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 3836, in _open_serial
settings().getFloat(["serial", "timeout", "connection"]),
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 3791, in default
serial_obj.open()
File "/home/pi/oprint/lib/python3.7/site-packages/serial/serialposix.py", line 332, in open
self._reconfigure_port(force_update=True)
File "/home/pi/oprint/lib/python3.7/site-packages/serial/serialposix.py", line 520, in _reconfigure_port
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
termios.error: (22, 'Invalid argument')

octoprint-systeminfo-20220604220803.zip (64.0 KB)

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