Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, sorry it's taken me so long to come back to this question. Here's how I got things working.</p> <p><strong>Note: This method will <em>NOT</em> work for everyone, please read below before copy/pasting into your own code</strong></p> <pre><code>public void connect(CommPortIdentifier portId) throws Failure { if (portId == null) throw new Failure("No port set"); try { port = (SerialPort) portId.open(getClass().getName(), 10000); } catch (PortInUseException e) { throw new Failure("Port in use by " + e.currentOwner,e); } try { port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); port.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT); } catch (UnsupportedCommOperationException e) { throw new Failure(e); } port.setRTS(true); // More setup } </code></pre> <p>So, in my case, the problem was that my particular device requires RTS flow control. Other devices may require different things (CTS, XON/XOFF), so check that device's manual. By default, RXTX disables all flow control mechanisms (unlike Hypertrm or other programs). Enabling each one is a two-step process.</p> <ol> <li>Once you have a SerialPort object, call the <code>setFlowControlMode()</code> method, and bitwise-OR ('<code>|</code>') the necessary <code>SerialPort.FLOWCONTROL_</code> constants</li> <li>Set the appropriate flow control to true or false (like I did with <code>port.setRTS(true)</code>)</li> </ol> <p>For the others with similar problems, if this doesn't work, I suggest</p> <ol> <li>Using a serial port monitoring program like <a href="http://www.serial-port-monitor.com/" rel="noreferrer">Serial Port Monitor</a> and/or <a href="http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx" rel="noreferrer">PortMon</a> (both Windows) to see what is actually going on.</li> <li>Emailing the RXTX developers at rxtx@qbang.org (they are very helpful)</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload