Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Serial Port Data Loss
Qt 6.11 is out! See what's new in the release blog

Serial Port Data Loss

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rumeysa_135
    wrote on last edited by
    #1

    Hello, I am exchanging data with the CPU via serial port. The data coming from the CPU appears missing on my console screen. How can I fix this?

    QByteArray dataPacket = serial->readAll();
    This is how I read the incoming data packet.

    The value I want to display on the console screen: Main data coming via Serial Port "\x02\x00\xB0\x13\x0F\xFA\x02\xCE\x03"
    but The value I see: "\x02\x00\xB0\x13\x0F"

    jsulmJ Christian EhrlicherC 2 Replies Last reply
    0
    • R Rumeysa_135

      Hello, I am exchanging data with the CPU via serial port. The data coming from the CPU appears missing on my console screen. How can I fix this?

      QByteArray dataPacket = serial->readAll();
      This is how I read the incoming data packet.

      The value I want to display on the console screen: Main data coming via Serial Port "\x02\x00\xB0\x13\x0F\xFA\x02\xCE\x03"
      but The value I see: "\x02\x00\xB0\x13\x0F"

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Rumeysa_135 said in Serial Port Data Loss:

      exchanging data with the CPU via serial port

      CPU?!

      "This is how I read the incoming data packet" - where and when do you do this? Do you use signals/slots (readyRead signal)? I guess you don't...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      1
      • R Rumeysa_135

        Hello, I am exchanging data with the CPU via serial port. The data coming from the CPU appears missing on my console screen. How can I fix this?

        QByteArray dataPacket = serial->readAll();
        This is how I read the incoming data packet.

        The value I want to display on the console screen: Main data coming via Serial Port "\x02\x00\xB0\x13\x0F\xFA\x02\xCE\x03"
        but The value I see: "\x02\x00\xB0\x13\x0F"

        Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • jsulmJ jsulm

          @Rumeysa_135 said in Serial Port Data Loss:

          exchanging data with the CPU via serial port

          CPU?!

          "This is how I read the incoming data packet" - where and when do you do this? Do you use signals/slots (readyRead signal)? I guess you don't...

          R Offline
          R Offline
          Rumeysa_135
          wrote on last edited by
          #4

          @jsulm
          I am using ReadWrite signal.
          serial->open(QIODevice::ReadWrite)

          jsulmJ 1 Reply Last reply
          0
          • R Rumeysa_135

            @jsulm
            I am using ReadWrite signal.
            serial->open(QIODevice::ReadWrite)

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Rumeysa_135 said in Serial Port Data Loss:

            ReadWrite signal.

            What is ReadWrite signal?!
            What you need to do is to connect a slot to readyRead signal and in this slot call serial->readAll() and accumulate the data until you got everything (you will not always get all data at once when calling readAll).

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            R 1 Reply Last reply
            2
            • jsulmJ jsulm

              @Rumeysa_135 said in Serial Port Data Loss:

              ReadWrite signal.

              What is ReadWrite signal?!
              What you need to do is to connect a slot to readyRead signal and in this slot call serial->readAll() and accumulate the data until you got everything (you will not always get all data at once when calling readAll).

              R Offline
              R Offline
              Rumeysa_135
              wrote on last edited by
              #6

              @jsulm How do I handle accumulating data until I have everything?

              SGaistS 1 Reply Last reply
              0
              • R Rumeysa_135

                @jsulm How do I handle accumulating data until I have everything?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Rumeysa_135 Hi,

                You keep a buffer that you append to each time readyRead is fired and check for when you have a full frame of your data in there. Then take the data out of the buffer and process it.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                3

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved