How to not pulse DTR & RTS lines when opening serial port w RXTX

156 Views Asked by At

We have a device that is sensitive to the RS232 DTR and RTS lines and are using the RXTX API to connect to a linux serial port however opening the connection causes pulses on these lines and is resetting our device. Is there a way to configure the connection to not pulse the lines when the connection is open?

This is the approach we currently use:

    // Set up the serial port
    CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(serialPortID);
    if (portId.isCurrentlyOwned()) {
        TRACE.severe("Port " + portId.getName() + " (port ID = " + serialPortID
                + ") is already in use by owner: " + portId.getCurrentOwner());
        throw new PortInUseException();
    }
    CommPort commPort = portId.open(this.getClass().getName(), responseTimeout);
    if (!(commPort instanceof SerialPort)) {
        TRACE.severe("Error: Only serial ports are supported.");
        throw new RuntimeException("Error: Only serial ports are supported.");
    }
    SerialPort serialPort = commPort;

    try {
        serialPort.setDTR(false);
        serialPort.setRTS(false);
        serialPort.setSerialPortParams(baudRate, dataBits, stopBits, parity);
        serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
        // set the port blocking mode recommended from stack overflow.
        // http://stackoverflow.com/questions/5219450/rxtx-serial-connection-issue-with-blocking-read
        serialPort.enableReceiveTimeout(responseTimeout);
    } catch (UnsupportedCommOperationException e) {
        ApplicationManager.logStackTrace(e);
    }

If this is not supported by RXTX are alternative java libraries able to suppress these pulses? Does anyone know if these pulses are expected behavior per the RS232 specification?

0

There are 0 best solutions below