jiuzhuaxiong / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

Slow Read/Write Time Using Windows Version #95

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm trying to build a program that uses qextserialport on Windows. I've 
developed the exact same program for Mac OS X and it runs perfectly. I 
currently run Bootcamp using Windows 7 on a 32-bit machine. The program 
requires several read/writes to the serial port that I use, and because each 
time I read/write to the port takes a significant amount of time, it 
significantly slows down the program. I tried both building qextserialport 
dynamically and statically, and both builds I ran into the same issue.

Below is how I initialize the port:

ComPort = new QextSerialPort(portname, QextSerialPort::Polling);
bool open_status = ComPort->open(QIODevice::ReadWrite);
ComPort->setBaudRate(BAUD19200);
ComPort->setFlowControl(FLOW_OFF);
ComPort->setParity(PAR_NONE);
ComPort->setDataBits(DATA_8);
ComPort->setStopBits(STOP_1);

I apologize for the brief description above, but would anyone know what could 
cause the serial port to take a while to read/write on Windows but not on Mac?

Original issue reported on code.google.com by jeremyrc...@gmail.com on 22 May 2011 at 5:24

GoogleCodeExporter commented 8 years ago
IMO, you can give a chance for QextSerialPort::EventDirven.

Original comment by dbzhang...@gmail.com on 10 Nov 2011 at 2:59

GoogleCodeExporter commented 8 years ago
Did you found a solution? I have exactly the same problem. It only appears on 
Windows. On Linux everything works fine.

Original comment by schoenen...@gmail.com on 31 Jan 2012 at 10:30

GoogleCodeExporter commented 8 years ago
Have you tried setting the timeout?

E.g.
  ComPort->setTimeout(50); // milliseconds

The constructor you are using sets the timeout to 500ms, and the Windows 
implementation is a bit daft: it waits for the timeout to elapse regardless of 
whether any data is available on the port.  In other words, if there is a byte 
available on the serial port queue, you'll still wait 500ms.

You can set the timeout as -1 to make it non-blocking, but I've found this to 
be problematic.  I find it works best setting a small timeout, and implement my 
own timeout on the outside.

HTH.

Original comment by stricte...@googlemail.com on 7 Feb 2012 at 10:04

GoogleCodeExporter commented 8 years ago
Issue 94 has been merged into this issue.

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 8:24

GoogleCodeExporter commented 8 years ago
I face the same problem : it's twice slower than an older version (I don't 
remember which, I can give it if needed).
I tried different timeouts (50, 0 even -1) : no difference.
I implemented an event-driven method : the result is similar.

Does the readyRead event have a timeout or something similar to tune ??
What may have changed in the backstage of the lib to cause latency ?

Original comment by romain...@gmail.com on 2 Apr 2012 at 9:04

GoogleCodeExporter commented 8 years ago
salut;
j'ai télécharger qextserialport, et tout marche bien sauf que lorsque 
j’exécute uartassistant les donner que je les envoi sur le port ce sont eux 
meme que je les reçoit et pas les données qu'ils arrivent sur le port. je 
sais pas où est l'erreur. aidez moi svp.
je travaille sur un Windows Seven 32 bits.

Original comment by ZAYOUD.R...@gmail.com on 1 Jun 2012 at 3:43

GoogleCodeExporter commented 8 years ago
---------What version of the product are you using? On what operating system?

-j'ai installer qtsdk que je l'ai telecharger de ce site : 
http://qt.nokia.com/downloads/sdk-windows-cpp-offline

-j'ai telecharger qextserialport1.2-beta1 de ce lien : 
http://code.google.com/p/qextserialport/downloads/detail?name=qextserialport-1.2
beta1.tar.gz&can=1&q=

-je travaille sur un windows seven 32 bits

----------What is the expected output? What do you see instead?

-je simule uartassistant qui se trouve sous qextserialport1.2-beta1/exemple 

-ce que j'écrit c'est ce que je reçoit où lieu de recevoir les données qui 
arrivent sur le port série

Original comment by ZAYOUD.R...@gmail.com on 1 Jun 2012 at 4:11

GoogleCodeExporter commented 8 years ago
Try open with QIODevice::Unbuffered flag. I don't know if it will work with 
current versions, but it solves similar issues in win-alpha2, which 
unfortunately doesn't have support for apples :/.

Original comment by michpoli...@gmail.com on 19 Jul 2012 at 9:35

GoogleCodeExporter commented 8 years ago
I also had the problem that reading one byte from an arduino took about 3 
seconds on Win7, altough under ubuntu there was no noticeable delay. Using the 
QIODevice::Unbuffered flag sol;ved the problem.

Original comment by guentern...@gmail.com on 24 Jun 2014 at 11:01