I think that, as well as enabling the UART, you have enabled the console on the UART, prevent the use of the UART for other purposes.
The normal permissions on the UARTS are:
Code: Select all
crw-rw---- 1 root dialout 204, 64 Jul 9 10:33 /dev/ttyAMA0
crw-rw---- 1 root dialout 4, 64 Jul 9 10:32 /dev/ttyS0
If you don't know how to read permissions, the initial 'c' says that this is a character device, not a regular file or directory. This is followed by three groups of three characters, indicating the read, write and execute permissions for the owning user, the owning group and everyone else. These permissions say that the root user and members of the dialout group (which includes 'pi', as the 'groups' command showed us) can read and write the UARTs, but that any other user has no access.
Your ttyS0 permissions are:
Code: Select all
crw--w---- 1 root tty 4, 64 Jan 1 1970 /dev/ttyS0
meaning that root has R/W access, but other users have to be in group 'tty' and only get write access. User 'pi' is not in group 'tty', so you get no access unless you use sudo, and then you can only write.
The reason for the altered permissions is hinted at by the name of the owning group, 'tty' - getty has opened a console on that port. If you want to free the UART for other applications you can either use raspi-config to enable the UART but disable the console, or edit /boot/cmdline.txt directly and remove or rename "console=serial0,115200" - I tend to use "xconsole=serial0,115200" which is ignored.