From 9be2e45da05715fb77f5aea8615a35fc6381ef76 Mon Sep 17 00:00:00 2001 From: jskubick Date: Wed, 21 Feb 2024 14:34:19 -0500 Subject: [PATCH] Improved Javadoc for SerialPort.setBaudRate() to add warning about baud rates > 230400 on Apple computers & elaborate upon the constraints imposed by USB-serial adapters upon baudrate selection. USB-serial baudrate is one of those things that generally "just works" at or below 115200 baud, but can fail at faster rates for reasons that aren't intuitive or obvious until you discover that the data is "really" being transferred across the USB bus in 64-byte chunks once per millisecond. --- .../com/fazecast/jSerialComm/SerialPort.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/fazecast/jSerialComm/SerialPort.java b/src/main/java/com/fazecast/jSerialComm/SerialPort.java index ddd96702..e029446c 100644 --- a/src/main/java/com/fazecast/jSerialComm/SerialPort.java +++ b/src/main/java/com/fazecast/jSerialComm/SerialPort.java @@ -1388,6 +1388,26 @@ else if ((newReadTimeout > 0) && (newReadTimeout <= 100)) * Sets the desired baud rate for this serial port. *

* The default baud rate is 9600 baud. + *

Note: Using baud rates above 230400 on Apple Macintosh computers requires additional + * steps to enable their use that are beyond the scope of this Javadoc.

+ *

Note: for USB serial adapters (like the SiLabs CP210x family, commonly used with Arduino and ESP32 boards), + * the baud rate set by a call to setBaudRate() dictates the baud rate on the TxD and RxD pins at the other end of the USB port, + * and generally has no effect on the mode or transfer rate of bits across the USB bus itself.

+ * * * @param newBaudRate The desired baud rate for this serial port. * @return Whether the port configuration is valid or disallowed on this system (only meaningful after the port is already opened).