I want to connect to a device connected to a serial port (COM4) with an initial speed of 300 baud, the device can change the baud rate to 9600 using a command, my Java code will send this command to the device and the baud rate of the device has changed, but I don’t know how to change the baud rate in my program without closing the connection. When the connection has been closed, the device returns to the initial transmission rate.
Is there a way to change the baud rate in Java while the connection is open?
After sending the “change baud rate” command to the device when the device below has lost the connection. I think that this method is intended only for initialization, and not for changing the data transfer rate in the middle of communication.
port.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
source share