2026-07-01, 04:27 AM
I'm trying to write some Python code to talk to a Modbus wind sensor. The sensor itself is RS485, but it's connected to a RS422 adapter, which is plugged into the NMEA 1 port. I have some basic code that tries to connect, but I can't figure out which device to talk to.
- ttyAMA0 is the GPIO14-15, that's not it.
- AMA10 is the debug UART.
- ttyOP_gps is a symlink to AMA0.
- Tried all the ttyN devices, but got permission denied. User is in the dialout group.
- serial0 says "Failed to connect [Errno 11] Could not exclusively lock port"
Code:
$ ls /dev/tty*
/dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8
/dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9
/dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyAMA0
/dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyAMA10
/dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyOP_gps
/dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyprintk
/dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7
$ ls /dev/serial*
/dev/serial0- ttyAMA0 is the GPIO14-15, that's not it.
- AMA10 is the debug UART.
- ttyOP_gps is a symlink to AMA0.
- Tried all the ttyN devices, but got permission denied. User is in the dialout group.
- serial0 says "Failed to connect [Errno 11] Could not exclusively lock port"