Results 1 to 20 of 30

Thread: QSerialPort High Speed Serial Reading from board and Logging Issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Nov 2016
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSerialPort High Speed Serial Reading from board and Logging Issue

    Quote Originally Posted by anda_skoa View Post
    Why are you using a QueuedConnection?

    Cheers,
    _
    Nothing changed when i delete the QueuedConnection. I didn't put it on purpose. Just trying what i see on forums .


    Added after 7 minutes:


    Quote Originally Posted by Lesiok View Post
    Error in reasoning.
    1. During the operation of the data read by serial->readAll buffers appears next portion of the data that you delete in line 22.
    2. The data you read in packs of random length (this is the nature of the serial port) and you lose "remain" the last byte.
    3. The length of the data read by the serial->readAll () may be greater than serial-> bytesAvailable () read previously.
    Hi again. I'm aware of losing byte because of "remain" but it is just 1 byte per package. (1 package loss in 500) But i tried your approach. I'm readAll to data to ArrayBuffer and i'm arranging my NumberOfBytesToRead = ArrayBuffer.size();
    Actually it became more stable. But i got a problem now like that. First 2500 number is coming without any error then it is going like this : after 2500(number) is recevied -> 3500..3700 -> 7500..7800 -> 11000..12000 -> etc

    I'm losing package in somewhere else and it became periodic.


    Quote Originally Posted by marcos.miranda View Post
    Hi, franbogaz.

    If I understood your problem well.
    Perhaps your problem of loss of information is related to serial cable (manufacturing quality) or connection parameters.

    I'm finding it strange that your serial connection configuration.
    I've been searching the Internet and I think you should use the following:

    Qt Code:
    1. 1. serial-> setPortName ("COM7");
    2. 2. serial-> setBaudRate (19200); // Rate = 19200 * 3.32 * log (4) ... Rate = 38Kbps.
    3. 3. serial-> setDataBits (QSerialPort :: Data8);
    4. 4. serial-> setParity (QSerialPort :: NoParity);
    5. 5. serial-> setStopBits (QSerialPort :: OneStop);
    6. 6. serial-> setFlowControl (QSerialPort :: SoftwareControl); // Software flow control (XON / XOFF).
    7. 7. serial-> setReadBufferSize (400);
    To copy to clipboard, switch view to plain text mode 

    It is more common to use these settings to access equipment via the serial port

    I tried what marcos.miranda said. Baudrate is still 600000 but flow control seems logical. When i tried softwareflowcontrol USB Serial Port stucks and not opening again or closing or receiving or sending data. I'm restarting pc and trying it again and it is same like this. Couldnt understand what's going on about flow control.
    Last edited by franbogaz; 20th January 2017 at 08:21.

Similar Threads

  1. Replies: 1
    Last Post: 21st June 2016, 23:32
  2. QSerialPort - speed and performance
    By Wer_Bn in forum Qt Programming
    Replies: 5
    Last Post: 30th April 2015, 17:12
  3. qserialport and reading bytes
    By gab74 in forum Newbie
    Replies: 3
    Last Post: 14th February 2014, 20:11
  4. QSerialPort :: read - Serial Comms noob.
    By llaregyb in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2014, 12:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.