0

Summary

  • I've installed Ubuntu 23.10 on a Raspberry Pi 5.
  • I have apt upgraded everything.
  • I'm trying to use UART to communicate with various devices.
  • I can see devices, for example /dev/ttyAMA2.
  • I have a GPS that transmits data periodically.
  • I never receive any data from it.
  • The exact same setup works on the latest Raspberry Pi OS. (I have other problems there that Ubuntu doesn't have.)

Details and research

I found various threads here and on other forums. Given this, I have done the following:

  1. Add myself to the dialout and tty groups:
sudo usermod -a -G dialout $USER
sudo usermod -a -G tty $USER
  1. Edit /boot/firmware/config.txt
[all]
# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these
# parameters related to the base device-tree they must appear *before* any
# other dtoverlay= specification
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on
dtoverlay=uart2-pi5  # New line.
enable_uart=1        # New line.

It might be worth noting that this doesn't work at all. It never even creates /dev/ttyAMA2:

dtoverlay=uart2-pi5,ctsrts

These lines don't seem to make any difference:

dtoverlay=disable-bt
dtoverlay=disable-bt-pi5

Here's my /boot/firmware/cmdline.txt

zswap.enabled=1 zswap.zpool=z3fold zswap.compressor=zstd multipath=off dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash

What I tried

I have a program that consumes /dev/ttyAMA2 at 38400 baud (that's default for the GPS). The program is written in Rust:

let port = serialport::new(&device, 38400)
    .timeout(Duration::from_millis(2000))  // Timeout defined here.
    .open()
    .expect("Failed to open port");

let mut port = BufReader::new(port);
let mut parser = NmeaParser::new();
let mut buf = String::with_capacity(10240);

loop {
    let size = match port.read_line(&mut buf) {
        Ok(n) => n,
        Err(reason) => {
            
            // It fails here.
            // failed to read reason=Custom { kind: TimedOut, error: "Operation timed out" }

            warn!(?reason, "failed to read");
            continue;
        }
    };

    // ...

For the sake of simplicity, this is fully reproducible with minicom.

On RPi OS

This works just fine:

minicom -D /dev/ttyAMA2 --baudrate 38400

I see GPS data right away.

On Ubuntu

Minicom launches just fine.

minicom -D /dev/ttyAMA2 --baudrate 38400

However, I never receive any data.


What am I doing wrong?

2
  • See askubuntu.com/q/1496927/1004020
    – Daniel T
    Commented Feb 4 at 14:18
  • That's one of the threads I was working from. I don't have a /boot/firmware/network-config file. The dtoverlay files seem to load just fine, seeing as I do have the /dev/ttyAMA* devices on boot. I believe this is something else.
    – Kim Ha
    Commented Feb 4 at 14:25

0

You must log in to answer this question.

Browse other questions tagged .