Could not find the ttyUSB0 port on my Ubuntu Box saying NoSuchPortException

411 views Asked by At

I am new user for Ubuntu/Linux,and I am trying to connect to device to get serialized data,

with following params :

<bean id="serialParameters" class="net.wimpi.modbus.util.SerialParameters">
    <property name="baudRate" value="115200"/>
    <property name="portName" value="/dev/ttyUSB06"/>

    <property name="databits" value="8"/>
    <property name="stopbits" value="1"/>
    <property name="parity">
        <util:constant static-field="gnu.io.SerialPort.PARITY_NONE"/>
    </property>
    <property name="encoding">
        <util:constant static-field="net.wimpi.modbus.Modbus.SERIAL_ENCODING_RTU"/>
    </property>
    <property name="echo" value="false"/>
    <property name="receiveTimeout" value="200"/>
</bean>

I am getting this issue :

Caused by: java.lang.Exception
    at net.wimpi.modbus.net.SerialConnection.open(SerialConnection.java:91)
    at net.wimpi.modbus.facade.ModbusSerialMaster.connect(ModbusSerialMaster.java:101)
    at com.example.MyModbusSerialMaster.connect(MyModbusSerialMaster.java:20)

And MyModbusSerialMaster.java is with line 20 (super.connect();):

public class MyModbusSerialMaster
        extends ModbusSerialMaster {
    public MyModbusSerialMaster(SerialParameters param) {
        super(param);
    }

    public void connect() throws Exception {
//        System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/ttyUSB0"); //or oher ACMx
        ***super.connect();***
        try {
            Field f = ModbusSerialMaster.class.getDeclaredField("m_Transaction");
            f.setAccessible(true);
            ((ModbusSerialTransaction) f.get(this)).setRetries(0);
        } catch (IllegalAccessException | IllegalArgumentException | NoSuchFieldException | SecurityException e) {
            e.printStackTrace();
        }
    }
}

My Ubuntu Box confgig are :

Device : Inspiron-3542 (N series) Ubuntu : 15.10 OS type : 64-bit

I have also gone through all suggestions given on SO like.

running cmd : ls /sys/class/tty/

giving response :

console tty15 tty24 tty33 tty42 tty51 tty60 ttyS10 ttyS2 ttyS29 ptmx tty16 tty25 tty34 tty43 tty52 tty61 ttyS11 ttyS20 ttyS3 tty tty17 tty26 tty35 tty44 tty53 tty62 ttyS12 ttyS21 ttyS30 tty0 tty18 tty27 tty36 tty45 tty54 tty63 ttyS13 ttyS22 ttyS31 tty1 tty19 tty28 tty37 tty46 tty55 tty7 ttyS14 ttyS23 ttyS4 tty10 tty2 tty29 tty38 tty47 tty56 tty8 ttyS15 ttyS24 ttyS5 tty11 tty20 tty3 tty39 tty48 tty57 tty9 ttyS16 ttyS25 ttyS6 tty12 tty21 tty30 tty4 tty49 tty58 ttyprintk ttyS17 ttyS26 ttyS7 tty13 tty22 tty31 tty40 tty5 tty59 ttyS0 ttyS18 ttyS27 ttyS8 tty14 tty23 tty32 tty41 tty50 tty6 ttyS1 ttyS19 ttyS28 ttyS9

Here ttyUSB0 is not present in output. Current User is also in group of dialout.

0

There are 0 answers