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. Is it forbidden to change the baudrate after opening QSerialPort?
Qt 6.11 is out! See what's new in the release blog

Is it forbidden to change the baudrate after opening QSerialPort?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 632 Views
  • 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.
  • J Offline
    J Offline
    John Van
    wrote on last edited by aha_1980
    #1

    In the QSerialport documentation(https://doc.qt.io/qt-6/qserialport.html#baudRate).In the prop, it is stated that:

    Note: If the setting is set before opening the port, the actual serial port setting is done automatically in the QSerialPort::open() method right after that the opening of the port succeeds.

    This sentence seems to tacitly allow changing the baudrate after opening QSerilPort, and after trying this, I found that serial communication is normal.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #3

      This sentence seems to tacitly allow changing the baudrate after opening QSerilPort, and after trying this, I found that serial communication is normal.

      Yes, you can change the properties (baud rate, data bits, stop bits, etc) in any time.

      1 Reply Last reply
      1
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #2

        The same docs, "If the setting is successful or set before opening the port, returns true; otherwise returns false and sets an error code which can be obtained by accessing the value of the QSerialPort::error property. " So, if you get call setBaudRate() and get a true response then it worked.

        1 Reply Last reply
        2
        • K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on last edited by
          #3

          This sentence seems to tacitly allow changing the baudrate after opening QSerilPort, and after trying this, I found that serial communication is normal.

          Yes, you can change the properties (baud rate, data bits, stop bits, etc) in any time.

          1 Reply Last reply
          1
          • J John Van has marked this topic as solved on

          • Login

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