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. QSerialPort hardware considerations
Qt 6.11 is out! See what's new in the release blog

QSerialPort hardware considerations

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 635 Views 3 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.
  • A Offline
    A Offline
    agmar
    wrote on last edited by
    #1

    Hi,
    i managed to get two bytes sent through the serial port today, but the output became gibberish when i restarted the computer, what could possibly cause this?

    jsulmJ 1 Reply Last reply
    0
    • A agmar

      Hi,
      i managed to get two bytes sent through the serial port today, but the output became gibberish when i restarted the computer, what could possibly cause this?

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

      @agmar said in QSerialPort hardware considerations:

      but the output became gibberish

      What does this mean exactly?

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

      A 1 Reply Last reply
      0
      • jsulmJ jsulm

        @agmar said in QSerialPort hardware considerations:

        but the output became gibberish

        What does this mean exactly?

        A Offline
        A Offline
        agmar
        wrote on last edited by
        #3

        @jsulm the values i see on a scope connected to the lines show anywhere from 2 to 4 bytes of transmitted data, with some of the pulse lengths being shorter than the others, while other times the first byte is double the baud rate, it looks really bizarre

        SGaistS 1 Reply Last reply
        0
        • A agmar

          @jsulm the values i see on a scope connected to the lines show anywhere from 2 to 4 bytes of transmitted data, with some of the pulse lengths being shorter than the others, while other times the first byte is double the baud rate, it looks really bizarre

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

          Hi,

          Might be a silly question but are you sure you did properly reconfigure the serial port before using it ?

          Also, is the device at the other hand properly initialized ?

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

          A 1 Reply Last reply
          1
          • Kent-DorfmanK Offline
            Kent-DorfmanK Offline
            Kent-Dorfman
            wrote on last edited by
            #5

            as @SGaist alluded to, guessing the speed or char format changed to system default upon reboot and that isn't what your app expects.

            The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

            A 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Might be a silly question but are you sure you did properly reconfigure the serial port before using it ?

              Also, is the device at the other hand properly initialized ?

              A Offline
              A Offline
              agmar
              wrote on last edited by
              #6

              @SGaist This is the initialization code :

              void MainWindow::openSeriall(){
                  m_serial->setPortName(portName);
                  m_serial->setBaudRate(QSerialPort::Baud19200);
                  m_serial->setDataBits(QSerialPort::Data8);
                  m_serial->setParity(QSerialPort::NoParity);
                  m_serial->setFlowControl(QSerialPort::NoFlowControl);
                  m_serial->setStopBits(QSerialPort::OneStop);
              
              }
              the portName is acquired with QSerialportInfo and correctly identifies the USB device.
              i initialize the port only once and the transmissions take place without touching the port setup, the device on the other end is programmed to respond to an 0xAA and 0xFF command, it works as expected every time with hterm and term and the terminal example seems to work ok too, so im not sure...
              
              
              1 Reply Last reply
              0
              • Kent-DorfmanK Kent-Dorfman

                as @SGaist alluded to, guessing the speed or char format changed to system default upon reboot and that isn't what your app expects.

                A Offline
                A Offline
                agmar
                wrote on last edited by
                #7

                @Kent-Dorfman does it matter tho? because i initialize the serial port everytime i run the program? the baudrate and so on are set everytime the app runs, so it would really make no sense if that were the case(for me, at least)

                J.HilkJ 1 Reply Last reply
                0
                • A agmar

                  @Kent-Dorfman does it matter tho? because i initialize the serial port everytime i run the program? the baudrate and so on are set everytime the app runs, so it would really make no sense if that were the case(for me, at least)

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @agmar are you sure, you're using the same instance to communicate, that you here initialise ?

                  You wouldn't believe how many people mess this up!


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  A 1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @agmar are you sure, you're using the same instance to communicate, that you here initialise ?

                    You wouldn't believe how many people mess this up!

                    A Offline
                    A Offline
                    agmar
                    wrote on last edited by
                    #9

                    @J-Hilk hmmm, i feel like im sure, but is there a way i can know for sure?

                    1 Reply Last reply
                    0

                    • Login

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