1

I'm writing code to send data to and from a raspberry pi (pi zero running raspbian lite) via serial port, using 1 python script on either side. I've set everything up so that I can use port='/dev/ttyGS0' from the pi and port='COM17' on my windows pc.

It seems to work at first, though after a while the connection on the side of the pi gets interrupted with the following error

serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Meanwhile on the windows side I'm receiving data that implies the login shell is coming trough the serial port:

\r\nRaspian GNU/Linux 10 rasperrypi ttyGS0\r\n\r\nrasperrypi login:
\r\r\npassword:

I'm guessing I have to turn off the login shell over serial, though I can't seem to find anything relevant to this problem online. I can post the python scripts if needed, though I doubt I'm doing anything wrong on that side.

EDIT

I was also experiencing problems with write/read permissions to ttyGS0, though this problem could be fixed by adding my user to the dialout group: sudo usermod -a -G dialout pi this did NOT solve the main issue though

I also tried disable the console trough cmdline.txt and raspi-config this did not change anything.

2

I managed to find the issue;

It seems I had a specific service enabled on my pi that was messing with the serial output, namely getty@ttyGS0.service This service is indeed intended to provide console over serial. I fixed the issue by simply disabling and stopping it

sudo systemctl disable getty@ttyGS0.service
sudo systemctl stop getty@ttyGS0.service
  • This is good since this is I think a relatively recent practice on Raspbian that will catch other new users. – goldilocks Dec 7 '19 at 14:48
  • Is there something wrong with using raspi-config? The bootcmd option enables the serial port, but raspi-config->advanced->serial (A7) disables the login shell over serial and may require restart. – crasic Dec 7 '19 at 17:48
  • @crasic I was using raspbian-buster-lite on a pi zero, and tried disabling login shell over serial via rasp-config>Interfacing options>Serial>Disable serial login shell this indeed did not stop the problem until I had manually disabled the service in question – user2536665 Dec 9 '19 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.