I've been struggling to get my RPi4 serial working over pins 8,10.

I have both a Raspberry OS image and an Ubuntu 18.04 image for the RPi4. In either case, when I use RASPI-CONFIG to disable console and enable uart, I'm still unable to use minicom to see characters or to receive data over serial.

dmesg | grep tty
console [tty1] enabled
serial: ttyAMA0 at MMIO is a PL011 rev2 
serial: ttySo at MMIO is a 16550
ls -l /dev/serial*
/dev/serial0 -> ttyS0
/dev/serial1 -> ttyAMA0
setserial -g /dev/tty*
/dev/ttyAMA0, UART undefined, Port: 0x0000, IRQ: 19
/dev/ttyS0, UART: 16550, Port 0x0000, IRQ: 21
sudo minicom -o -D /dev/serial0 or 1
no characters reflected back with loopback in place

enable_uart=1 is in config.txt

I'm getting the exact same results on both Ubuntu 18.04 and Raspberry OS. Neither enables the serial port to work. What else could I try or am I missing?

  • 2
    If you loop TX with RX on the same device you can see the char that you send is also received on the same device. This is a common trouble shooting pratice for serial devices. – MatsK Jul 15 '20 at 17:32
  • 1
    What are you actually trying to connect to via serial? – CoderMike Jul 15 '20 at 20:47
  • 1
    Using a loopback wire for the test. Ultimately connecting to Roboclaw motor driver via serial. It does not indicate it needs a level shifter but I'm now wondering if my past experimentation with the connection to the Roboclaw put 5v on Rx somwhow. – BenignFun Jul 15 '20 at 22:18

Here's some things I needed to do specifically to connect to a device like the Roboclaw. I got this to work on Ubuntu20.04, Ubuntu18.04 and raspberry pi OS (raspbian)

  • add enable_uart=1 to /boot/config.txt
  • remove console=serial0,115200 from /boot/firmware/cmdline.txt on Ubuntu and /boot/cmdline.txt on Raspberry Pi OS
  • disable the serial console: sudo systemctl stop serial-getty@ttyS0.service && sudo systemctl disable serial-getty@ttyS0.service
  • make sure you have pyserial installed if you're using the python serial library, not python-serial from apt.
  • create the following udev file:
KERNEL=="ttyS0", SYMLINK+="serial0" GROUP="tty" MODE="0660"
KERNEL=="ttyAMA0", SYMLINK+="serial1" GROUP="tty" MODE="0660"

and reload your udev rules: sudo udevadm control --reload-rules && sudo udevadm trigger

  • change the group of the new serial devices
sudo chgrp -h tty /dev/serial0
sudo chgrp -h tty /dev/serial1
  • The devices are now under the tty group. Need to add the user to the tty group and dialout group:
sudo adduser $USER tty
sudo adduser $USER dialout
  • update the permissions for group read on the devices
sudo chmod g+r /dev/ttyS0
sudo chmod g+r /dev/ttyAMA0
  • reboot

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.