I am a newbie in QNX. Hmm I am encountering a problem with reading from serial port.
I am using a Cool EcoRunner Dual Ethernet PC/104-CPU Board with QNX as the OS. I am using the CPU to control a robot which uses sensors to detect its position. This sensor will pass the readings to the CPU via serial port, RS-232.
But the problem occurs. Here is the sequence of how I read the data.
- Open the port using open()
- Read the data using read() function (I read many bytes at one time).
However, sometimes, the CPU board stops reading after managed to get a few readings (2-3 readings) from the serial port.
My question are:
Are there anything need to be done to read from a serial port beside opening using open()
I read somewhere in the forum that I need to use threadctl() command to give I/O priority to the program. Err… where should I put this command? is it before open() or after open() but before read()
Any answer is much appreciated.
Thx a lot