Servo2040 UART TX/RX Pins

GP20 is TX, GP21 is RX. You have to connect TX to RX and RX to TX.

You’re right, it was an oversight. I just swapped the wires and now it seems to be working. One thing doesn’t make sense to me though, why can’t I access the device with /dev/serial0? It works if I use /dev/ttyAMA0, but not with /dev/serial0 (that points to /dev/ttyAMA10)

Have a look at the system messages (run sudo journalctl -b). Here you can see how the system enumerates the serial devices. You could create udev-rules that create specific devices or device-links for a given hardware id. For example, I have a rule that creates a /dev/ttyPico if I plugin a pico. I can post the rule if you want it as a blueprint.

Yes that would be very helpful, thank you!

[bablokb@hal9000:~] > cat /etc/udev/rules.d/71-pico.rules 
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", SYMLINK="ttyPico"
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", SYMLINK="ttyPico"
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", SYMLINK="ttyPico"

The easiest way to detect the correct vendor-ids and subsystems is to run

sudo journalctl -f

and then plug in your device. This will output a number of lines, in my case:

Jan 31 15:16:13 hal9000 kernel: usb 3-2: new full-speed USB device number 3 using xhci_hcd
Jan 31 15:16:13 hal9000 kernel: usb 3-2: New USB device found, idVendor=239a, idProduct=80f4, bcdDevice= 1.00
Jan 31 15:16:13 hal9000 kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 31 15:16:13 hal9000 kernel: usb 3-2: Product: Pico
Jan 31 15:16:13 hal9000 kernel: usb 3-2: Manufacturer: Raspberry Pi
Jan 31 15:16:13 hal9000 kernel: usb 3-2: SerialNumber: E660583883A06E2D
Jan 31 15:16:13 hal9000 kernel: cdc_acm 3-2:1.0: ttyACM0: USB ACM device

The nice thing about the udev-rules is, that regardless of what I plug in in which order, the pico-device will always have a “true” device name, e.g. /dev/ttyACM0 or /dev/ttyACM1, but the system will automatically create a symlink name /dev/ttyPico linking to the true device-name. This simplifies other programs that want to access the pico because they don’t need to care about the real device name.