Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTU slave simulator device not known and exception #22

Open
leissbua opened this issue Jun 13, 2024 · 1 comment
Open

RTU slave simulator device not known and exception #22

leissbua opened this issue Jun 13, 2024 · 1 comment
Assignees

Comments

@leissbua
Copy link

leissbua commented Jun 13, 2024

Describe the bug

I do not know to what serial device to connect when using slave simulator and end up with an exception when sending a payload.

To Reproduce
Steps to reproduce the behavior:

Start slave simulator RTU, it is not know what virtual device comes up that can be connected to.

image

It is not known on what serial port the slave simulator is running. when simply setting rtu and sending a modbus payload i get an exception:

om.intelligt.modbus.jlibmodbus.exception.ModbusIOException: com.intelligt.modbus.jlibmodbus.serial.SerialPortException: purejavacomm.PureJavaIllegalStateException: JTermios call returned -1 at class purejavacomm.PureJavaSerialPort line 1106
	at com.intelligt.modbus.jlibmodbus.net.ModbusConnectionSerial.openImpl(ModbusConnectionSerial.java:62)
	at com.intelligt.modbus.jlibmodbus.net.ModbusConnection.open(ModbusConnection.java:45)
	at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connectImpl(ModbusMaster.java:74)
	at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connect(ModbusMaster.java:88)
	at modbusmechanic.ModbusMechanic.generateModbusMessage(ModbusMechanic.java:353)
	at modbusmechanic.ModbusMechanic.generateModbusRTURequest(ModbusMechanic.java:314)
	at modbusmechanic.PacketFrame.transmitPacket(PacketFrame.java:815)
	at modbusmechanic.PacketFrame.transmitPacketButtonActionPerformed(PacketFrame.java:677)
	at modbusmechanic.PacketFrame.access$1500(PacketFrame.java:31)
	at modbusmechanic.PacketFrame$16.actionPerformed(PacketFrame.java:448)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6400)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.intelligt.modbus.jlibmodbus.serial.SerialPortException: purejavacomm.PureJavaIllegalStateException: JTermios call returned -1 at class purejavacomm.PureJavaSerialPort line 1106
	at com.intelligt.modbus.jlibmodbus.serial.SerialPortPJC.open(SerialPortPJC.java:102)
	at com.intelligt.modbus.jlibmodbus.net.ModbusConnectionSerial.openImpl(ModbusConnectionSerial.java:60)
	... 44 more
Caused by: purejavacomm.PureJavaIllegalStateException: JTermios call returned -1 at class purejavacomm.PureJavaSerialPort line 1106
	at purejavacomm.PureJavaSerialPort.checkReturnCode(PureJavaSerialPort.java:1307)
	at purejavacomm.PureJavaSerialPort.<init>(PureJavaSerialPort.java:1106)
	at purejavacomm.CommPortIdentifier.open(CommPortIdentifier.java:159)
	at com.intelligt.modbus.jlibmodbus.serial.SerialPortPJC.open(SerialPortPJC.java:83)
	... 45 more

Can you clarify to what serial port i have to connect or is this a bug?

Thanks a lot and sorry if i simply dont get it.

regards

Michael

@SciFiDryer
Copy link
Owner

Are you trying to do a RTU slave and master from the same computer? If so, you would need two RS485 adapters. A serial port can only be bound once - either to a master or slave. The serial settings for the RTU simulator are located on the main window. Set up the serial settings on the main window, then start the simulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants