Resetting a serial port in Linux?
Hi all,
Scenario: I communication with different subsystems using serial port. In some subsystems after running for a while, I start getting invalid data inspite of system sending correct data. For dealing with this situation I used to reset serial ports by closing and reopening serial port, it was doing the trick but somehow when I have implemented this in my new application, this also doesn't work. I am struck. void CPort::ResetPort() { tcflush(Fd, TCIFLUSH);//flush all data received but not read ClosePort();//close port OpenPort(mStrPortNo);//open the port specified by port number and in read mode qDebug("\n Reset Subsystem =%s,Port number =%s,Fd=%d ",qPrintable(msSubsystemName),mStrPortNo,Fd); //code for setting port setting of serial port for individual sub systems } The ClosePort function invokes close system call. Can anybody suggest me some other way to reset serial port in Linux. I am using RHEL 4, C++ and Qt 4.2.1 for my application development. Also I have used multithreading to implement each subsystem in a separate thread. Its strange that if A,B,C are three threads, A & B run fine together but when C is introduced B starts receiving invalid data after sometime and never recovers even after resetting the port as mentioned above. Any suggestions??????????????????? |
http://www.linuxquestions.org/questi...-linux-671894/
Look into the links given in this thread, they are quite useful... http://www.linuxforums.org/forum/lin...ll-buffer.html This looks more specific to your problem |
Hi,
Thanks for the reply, I tried the CRTSCTS option but it only increased the time after which the problem of broken frames occur. Can somebody suggest something else?????????? |
I suggest the mods to move this to the programming thread, maybe then he will get more help, than here. Im not an expert in c programming bro..... i just tried to help with what i found
|
stty (especially stty -a) is a convenience way to examine/change serial port settings
|
All times are GMT -5. The time now is 11:02 PM. |