Serial Input Buffer Size
Make sure that the Serial Input Buffer Size is adequate for your application. It is 128 bytes by default. If a greater number of bytes that the buffer size are sent and your application does not read them in time then the buffer can fill and data will be lost.
// display the current buffer size
System.out.println("auxSerialPort.getInputBufferSize(): " + auxSerialPort.getInputBufferSize());
// set the new buffer size
auxSerialPort.setInputBufferSize(256);
// display the new buffer size
System.out.println("auxSerialPort.getInputBufferSize(): " + auxSerialPort.getInputBufferSize());
The output should look as follows.
auxSerialPort.getInputBufferSize(): 128 auxSerialPort.getInputBufferSize(): 256
By Kevin Cloutier | Updated On November 3, 2023 2:27 pm | No Comments | Categories: Embedded Programming, Java Code Samples | Tags: serial