Chris, you're amazing! This did the trick:

INFO  S7Test - ----- CONNECTED -----
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 0 received
DEBUG i.n.channel.DefaultChannelPipeline - Discarded inbound message 
org.apache.plc4x.java.isotp.protocol.model.IsoTPMessage@648ba43b 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: 
0x15572297, L:/192.168.1.16:62767 - R:/192.168.1.222:102].
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 1 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 1 sent
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message received
DEBUG o.a.p.j.isotp.protocol.IsoTPProtocol - Got Data: 
02f0803203000000010002001700000404ff0300010100ff0300010000ff0300010000ff03000101
DEBUG o.a.plc4x.java.s7.netty.S7Protocol - S7 Message with id 1 received
DEBUG i.n.channel.DefaultChannelPipeline - Discarded inbound message 
org.apache.plc4x.java.isotp.protocol.model.IsoTPMessage@47553a05 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: 
0x15572297, L:/192.168.1.16:62767 - R:/192.168.1.222:102].
INFO  S7Test - Value[value-1]: true
INFO  S7Test - Value[value-2]: false
INFO  S7Test - Value[value-3]: false
INFO  S7Test - Value[value-4]: true
INFO  S7Test - ----- DONE -----
DEBUG o.a.p.j.i.protocol.IsoOnTcpProtocol - ISO on TCP Message sent
DEBUG o.a.p.j.s.connection.S7PlcConnection - Remote didn't close connection 
within the configured timeout of 1000 ms, shutting down actively.
java.util.concurrent.TimeoutException: null
        at 
java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
        at 
java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
        at 
org.apache.plc4x.java.s7.connection.S7PlcConnection.close(S7PlcConnection.java:253)
        at S7Test.main(S7Test.java:62)
DEBUG io.netty.buffer.PoolThreadCache - Freed 3 thread-local buffer(s) from 
thread: nioEventLoopGroup-2-1


My connection String was s7://192.168.1.222/0/2?controller-type=S7_300, it 
worked like a charm...

On 12.11.19, 14:57, "Christofer Dutz" <[email protected]> wrote:

    Hi Frederic,
    
    While thinking about what could be going wrong I had the following idea:
    When connecting to an S7 as soon as the IsoTP and the S7 login is finished, 
the driver asks the S7 to identify itself.
    I would assume something is going wrong here ... so if you are unable to 
provide a WireShark dump, you can skip the identification step, if you tell the 
driver which S7 type you are expecting.
    
    So could you please give this connection string a try?
    
    s7://{ip}/{rack}/{slot}?controller-type=S7_300
    
    For if, rack and slot just use your normal values ... the important part is 
to add the "?controller-type=S7_300" to the end of your existing connection 
string.
    
    I know you have a S7-200 ... but we don't have a constant for the 200 as 
the 200 generally doesn't support this protocol.
    
    Please tell us if this works.
    
    Chris
    
    
    Am 12.11.19, 06:49 schrieb "Christofer Dutz" <[email protected]>:
    
        Hi Frederic,
        
        First of all, a warm welcome here. I am sorry to hear that you are 
having trouble. If course it could be that the hardware is causing trouble. I 
guess the only way to find out what's going wrong would be to do a Wireshark 
recording of the communication.
        
        Then we can be sure what's going wrong.
        
        The discarded incoming message, is definitely the cause, but I don't 
know what could be causing this.
        
        Could you do a Wireshark capture, create a jira issue and attach it to 
that? Then I'll have a look.
        
        Chris
        ________________________________
        Von: Fr?d?ric Auberson <[email protected]>
        Gesendet: Montag, 11. November 2019 14:52:44
        An: [email protected] <[email protected]>
        Betreff: "Discarded Message"... How do I start debugging this?
        
        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