[
https://issues.apache.org/jira/browse/PLC4X-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16989408#comment-16989408
]
Alvaro del Castillo commented on PLC4X-156:
-------------------------------------------
Trying to use the jar generated from the branch with the slaveId feature
implemented I am receiving the error:
{noformat}
06:21:47.193 [main] DEBUG io.netty.buffer.ByteBufUtil -
-Dio.netty.maxThreadLocalCharBufferSize: 16384
06:21:47.218 [nioEventLoopGroup-2-1] WARN io.netty.channel.ChannelInitializer -
Failed to initialize a channel. Closing: [id: 0x1b1bc709]
java.lang.IllegalAccessError: tried to access method
io.netty.handler.codec.MessageToMessageCodec.<init>()V from class
org.apache.plc4x.java.modbus.connection.ModbusTcpPlcConnection$1
at
org.apache.plc4x.java.modbus.connection.ModbusTcpPlcConnection$1.initChannel(ModbusTcpPlcConnection.java:72)
at
io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129){noformat}
I have added as dependencies of my sbt file:
{noformat}
"org.apache.plc4x" % "plc4j-api" % "0.6.0-SNAPSHOT",
"org.apache.plc4x" % "plc4j-driver-modbus" % "0.6.0-SNAPSHOT",
{noformat}
both generated and installed locally form your branch.
Are you aware of why is the issue? I will continue researching the issue but I
want to share with you my current status.
> The unitId (device id/slave id) is hardcoded to 0 which is the broadcast id
> in modbus
> -------------------------------------------------------------------------------------
>
> Key: PLC4X-156
> URL: https://issues.apache.org/jira/browse/PLC4X-156
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Driver-Modbus
> Reporter: Alvaro del Castillo
> Assignee: Christofer Dutz
> Priority: Critical
> Labels: config
> Fix For: 0.6.0
>
> Attachments: Plc4XModbusProtocol.java
>
>
> Trying to use the modbus driver, it is always trying to read and write from
> the slave 0 in the modbus slave/server. This identifier is the one used for
> broadcasting reads and writes to all the slaves in the modbus network. In
> modbus TCP this identifier is not needed, but it is needed to support legacy
> devices.
> And testing with with some modbus serves like:
> [https://pypi.org/project/pyModSlave|https://pypi.org/project/pyModSlave/]
> and in the second case, if you try to read a register:
> {noformat}
> 2019-11-27 08:29:29,837 ERROR modbus.handle_request Thread-1 invalid request:
> Function 3 can not be broadcasted{noformat}
> This unitId should be a param but if it must be hardcoded, changing it to *1*
> is a fix. But in some cases, you could need a
> specific id to connect to a device. For example, for the XY-MD02 sensor
> connected via serial to a Modbus TCP client, in order to read the values from
> the sensor you need to provide the right device id (in this case is also 1,
> but it could change).
> The unitId is defined in:
> [https://github.com/apache/plc4x/blob/develop/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocol.java#L92]
> I have tested in 0.4.0 release that changing the unitId to *1* fixes the
> problem with modbus servers. I have attached the file with this minor
> modification.
> I can send a PR if you find the fix useful.
> Thanks!
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)