Hi All,

I'm trying to make my first steps, but already hitting a roadblock: My
minimal code seems stuck on getConnection, and I've no idea how to debug
this.

I'm really trying to do something minimal, inspired by the example code,
and reading the first 4 input pins of my S7-200. I see the "START" log
entry, but not the "CONNECTED" one, meaning I never complete the connection
step. The only suspicious thing I see is this:

Discarded message pipeline : [S7PlcConnection$1$1#0, IsoOnTcpProtocol#0,
IsoTPProtocol#0, S7Protocol#0, Plc4XS7Protocol#0,
DefaultChannelPipeline$TailContext#0]. Channel : [id: 0x5148d82b, L:/
192.168.1.16:53396 - R:/192.168.1.222:102]."

Full disclosure: I'm using an off-brand adapter because I can't afford a
proper Siemens CP 243-1. Can that cause the issue?
How do I even begin to debug this?

Thanks,
  Fred

----- my code -----
static final String connectionString = "s7://192.168.1.222/0/2";

public static void main(String[] args) {
    logger.info("----- START -----");
    try (PlcConnection plcConnection = new
PlcDriverManager().getConnection(connectionString)) {
        logger.info("----- CONNECTED -----");
        if (!plcConnection.getMetadata().canRead()) {
            logger.error("This connection doesn't support reading.");
            return;
        }
        PlcReadRequest.Builder builder = plcConnection.readRequestBuilder();
        builder.addItem("value-1", "%I0.0:BOOL");
        builder.addItem("value-2", "%I0.1:BOOL");
        builder.addItem("value-3", "%I0.2:BOOL");
        builder.addItem("value-4", "%I0.3:BOOL");
        PlcReadRequest readRequest = builder.build();
        logger.info(readRequest.execute().get().toString());
        logger.info("----- DONE -----");
    } catch (Exception e) {
        e.printStackTrace();
    }

----- the output -----
INFO  S7Test - ----- START -----
INFO  o.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver
Manager with class loader sun.misc.Launcher$AppClassLoader@18b4aac2
INFO  o.apache.plc4x.java.PlcDriverManager - Registering available
drivers...
INFO  o.apache.plc4x.java.PlcDriverManager - Registering driver for
Protocol s7 (Siemens S7 (Basic))
DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging
framework
DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level:
simple
[...lots of Netty debug output removed here...]
DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message sent
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message received
DEBUG o.a.p.j.isotp.protocol.IsoTPProtocol - Got Data:
11d00001000200c2020200c1020102c0010a
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 0 queued
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message sent
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 0 sent
DEBUG i.n.channel.DefaultChannelPipeline - Discarded inbound message
org.apache.plc4x.java.isotp.protocol.model.IsoTPMessage@480c8d80 that
reached at the tail of the pipeline. Please check your pipeline
configuration.
DEBUG i.n.channel.DefaultChannelPipeline - Discarded message pipeline :
[S7PlcConnection$1$1#0, IsoOnTcpProtocol#0, IsoTPProtocol#0, S7Protocol#0,
Plc4XS7Protocol#0, DefaultChannelPipeline$TailContext#0]. Channel : [id:
0x5148d82b, L:/192.168.1.16:53396 - R:/192.168.1.222:102].
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message received
DEBUG o.a.p.j.isotp.protocol.IsoTPProtocol - Got Data:
02f080320300000000000800000000f0010001000100f0
INFO  o.a.plc4x.java.s7.netty.S7Protocol - S7Connection established
pdu-size 240, max-amq-caller 1, max-amq-callee 1
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 2 queued
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 0 received
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message sent
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 2 sent
DEBUG i.n.channel.DefaultChannelPipeline - Discarded inbound message
org.apache.plc4x.java.isotp.protocol.model.IsoTPMessage@64b0dea4 that
reached at the tail of the pipeline. Please check your pipeline
configuration.
DEBUG i.n.channel.DefaultChannelPipeline - Discarded message pipeline :
[S7PlcConnection$1$1#0, IsoOnTcpProtocol#0, IsoTPProtocol#0, S7Protocol#0,
Plc4XS7Protocol#0, DefaultChannelPipeline$TailContext#0]. Channel : [id:
0x5148d82b, L:/192.168.1.16:53396 - R:/192.168.1.222:102].

Reply via email to