View topic - reading multiple serial ports

reading multiple serial ports

For discussion of realtime and/or embedded programming.

reading multiple serial ports

Postby de_junqueira » Wed Oct 31, 2012 2:54 pm


I´m having some problems with mutithreads. When I use 1 process with 4 threads, where each thread READ one serial port, my app don´t work....

I need read 4 serial ports and each port must make logging. When some port doesn't receive data for 33ms I need make another logging.

When I use the 4 qtalk process, just for read data and logging,,,,,,it work, but when I use one process with 4 threads .....I have problems

What is the best way to do it?
I´m using the readcond and timeout
QNX 6.5
thanks you
New Member
Posts: 1
Joined: Wed Oct 31, 2012 2:10 pm

Re: reading multiple serial ports

Postby maschoen » Thu Nov 01, 2012 12:31 am

There's no reason you shouldn't be able to read 4 serial ports with 4 threads. Maybe you should post some code so we can see what you are doing wrong.
QNX Master
Posts: 2681
Joined: Wed Jun 25, 2003 5:18 pm

Re: reading multiple serial ports

Postby Tim » Thu Nov 01, 2012 4:43 pm

Alternatively you could read 4 serial ports with 1 process (no threads) using a select() call with timeout set for handling no data received.

If all you are doing is reading the data from the serial port and logging it (ie no complex processing) then that's the way I would go for simplicity sake.

Senior Member
Posts: 1419
Joined: Wed Mar 10, 2004 12:28 am

Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 2 guests