Serial communications

General support questions
Post Reply
BrianRodgers
Posts: 1
Joined: 2019/05/15 16:02:44

Serial communications

Post by BrianRodgers » 2019/05/15 16:29:15

CentOS 7.6.1810

I have 4 programs that communicate via RS232 serial to remote devices. The programs run fine from the console and establish good serial comms.
I need to auto start these programs as this is an embedded controller. I added each program as a service to systemd.

After boot, each process is running, however there are no comms.
Each program is attached to the correct port: ttyS4 to ttyS7 seen from ls -l /proc/PID/fd.

Checking stty -F /dev/ttyS4 to 7 indicates the ports are set to 115200 baud.

The programs set the speeds to 19200, 38400, 9600 & 9600 on start up. I can kill each process and restart from the console the baud rates are set correctly and comms are good.

How do I get the serial ports to operate without logging on?

Thanks

User avatar
igorek24
Posts: 90
Joined: 2013/11/13 06:11:37

Re: Serial communications

Post by igorek24 » 2019/05/18 16:44:01

Which user are you running systemd service under?
You need to add that user to ether dialout or tty group (check the owner of those ports).

Code: Select all

gpasswd -a ServiceUser dialout 
Where ServiceUser is the user that you are running your service as.

Code: Select all

[Service]
User=ServiceUser
Group=ServiceUser
Type=simple
...

Post Reply