Is there a limit to QSerialPort?
-
Hi the almighty qt forum, I'm encountering a problem when I tried to use QSerialPort to stream out a big amount of data.. there are things that I can't explain, I hope there are someone here that could help me or at least give me some fresh leads..
I have a self designed PCB, using an FTDI FT4232H to interface with the computer, it drives 4 UART ports into 1 USB 2.0 high speed cable.. the chip supports up to 12 mega baud, but at the real test I can get data in the qt program I wrote with QSerialPort with <8Mega baud --- but that is fine; what is not fine is that the data flow is not consistent. I use an FPGA to drive the 4 UARTs, the data format is simply '00 xx xx xx 00 xx xx xx....', and xx is forced never to be 00. What I'm doing to test wether the data flow is consistent is: I use the FPGA to send a number in the 'xx xx xx' and every time this number increases by 1, so if everything goes well when I plot the saved data out it should be a nice slop line... but instead, the plot looks like a chain of steps - a neat slop then the number leaps up all of a sudden, and then another slop of continuous data, and the width of the slop corresponds very well with the number of how many bytes have been read from the port.
in my qt program I just set the read buffer to 0 - as no limit, and everything else is normal, I set up a timer.start(0) to call the function which reads the buffer and processes the data.. on the oscilloscope the UART signal out of my fpga looks fine.
what I am suspecting is that there is an limit somewhere that even the buffer limit is 'unlimited' ther's still a capability.. and some data is lost between those buffers. the program reads 8160 bytes every buffer, the reading function is called at a high speed. if I make the timer count longer, the read out buffer will be bigger, but still the plot looks like a terrace...
what are extracted from the data stream are complete packages, but those data can't be guaranteed to be continuous, that won't be good for my project... I hope there isn't any hardware bottlenecks because I tried it on two Haswell i7 + 1600MHz 16GB RAM computers... and the OS is a windows 8, and another virtual windows 8 on VMware on OS 10.9 - I wanted to try it natively on OS 10.9 today but didn't get it to receive any data..I hope there are someone can offer me some solutions... if you need more details I'll try my best to describe and explain. thanks in advance
-
Hi.
Data shan't be lost. At least I didn't come up to such situation.
If you use Windows - that you can check loss of data with use of any driver of the virtual port, for example "com0com":http://sourceforge.net/projects/com0com/ . In this case you should disable a baud rate emulation, then speed will be very high, without limitations. :)
On the other hand, you can check work of your HW, using only one serial port (but not 4) for testing.
Also instead of the timer you can use readyRead() signal for data reading.
In any case, please, provide the minimum source example which reproduces a problem.