LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2005, 08:50 AM   #1
ZX_SA
LQ Newbie
 
Registered: May 2004
Location: Stellenbosch, South Africa
Distribution: Kubuntu breezy, MDK10.2
Posts: 26

Rep: Reputation: 15
Unhappy Problem with Non-blocking serial port read


Hi everyone

I've been trying to solve this problem for the last couple of days and as of yet I have no solution:

What I am doing is to use a QSocketNotifier object (from Qt libraries) to notify my program when there is data to be read on the serial port. For those unfamiliar with Qt, QSocketNotifier basically sets a callback for the SIGIO signal and then calls a function in my program from that callback (albeit via Qt's events and also signal/slot mechanism).

The problem is that when I receive a sequence of bytes via the serial port, the first 8 bytes goes missing. I receive only a single SIGIO and then can read only the last bytes. I did however connect an oscilloscope to the serial cable and I am confident that the correct data is being transferred and must be getting lost somewhere inside the PC. The only problem is that I have absolutely no idea where this could be happening nor why!

For an extra twist, today I've discovered that some longer strings does arrive ok. Basically my application is to control CCTV cameras via SONY's VISCA interface and there are four commands that I can send to the camera that would cause the camera to send me a string longer than 8 bytes. Two of these reply packets arrive complete and with the other two I lose the first 8 bytes.

However, none of the strings that I receive is longer than 16 bytes (which I believe is how big the receive buffer in the UART is) so I can't see how the bytes could be lost in the UART.

Some system info:
OS: SuSE 9.2 (but I have exactly the same results with SuSE 9.1 as well)
PC: 3.0GHz Prescott with 1GB RAM on Intel Bayfield (865G) motherboard
Serialport: Onboard 16550A UART (/dev/ttyS0)
Qt version: 3.3.3

I've run out of ideas of what to look at. Any ideas that you may have will be EXTREMELY welcome!

Regards,
ZX_SA
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
is there any shell command to read and write data from parallel and serial port? baosheng Linux - Hardware 2 01-13-2007 08:35 PM
Need help to read a signal from the CTS pin of a serial port juan_de_margo Linux - Hardware 0 02-24-2005 03:36 AM
Serial Port read in shell script tjt Linux - Newbie 1 08-12-2004 09:18 AM
Serial port Read Write SeanatIL Programming 2 07-14-2004 03:42 PM
Why can't I read in data from the serial port using a bash script? tjt Linux - Newbie 1 06-17-2004 12:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration