Is it forbidden to change the baudrate after opening QSerialPort?
-
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.
-
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.
-
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.
-
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.
-
J John Van has marked this topic as solved on