I cannot open /dev/serial0. I selected "turn on serial port" and "do not run a console on serial port" in raspi-config. The /boot/config.txt contains no reference to "console" and does contain at end under "[all]" the lines "enable_uart=1" and "dtoverlay=disable-bt". I rebooted. "ls -l /dev/serial0" == "ttyAMA0" and "ls -l /dev/serial1" == "ttyS0". "ls -l /dev/ttyAMA0" == "crw--w---- 1 root tty 204, 64 Jun 19 22:47 /dev/ttyAMA0" so that right there is probably the permission problem. I added myself to group tty. This post https://raspberrypi.stackexchange.com/questions/85723/error-on-changing-permissions-in-serial-port suggests that the permissions will revert to proper ones when some program which is using the port stops using it, but "lsof /dev/ttyAMA0" does not show anything.
1 Answer
I re-ran raspi-config AFTER adding those lines to /boot/config.txt then rebooted AGAIN and then /dev/ttyAMA0 had the group dialout which I belong to and had dialout rw permission so I could use it. I removed myself from group tty (it turns out this is not recommended). Not sure why second raspi-config and second reboot were necessary. – William Garber 15 secs ago Edit Delete