EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Issues connecting to siemens PLC
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: Anders Lindh Olsson <Anders.LindhOlsson at ess.eu>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 17 Sep 2020 12:23:35 +0000
You should enable both autoConnect and asynInterposeEos when you call drvAsynIPPortConfigure, i.e. pass both flags as 0.


You need to run gdb and get the stack trace when the IOC crashes.


gdb [path to IOC application]

run [name of startup script]

[wait for crash]

backtrace


Mark




________________________________
From: Anders Lindh Olsson <Anders.LindhOlsson at ess.eu>
Sent: Thursday, September 17, 2020 7:17 AM
To: Mark Rivers
Cc: tech-talk at aps.anl.gov
Subject: RE: Issues connecting to siemens PLC

Hi Mark,

I had first thought that both of those calls were successful. The reports show that I am not connected on any of the modbus ports (502 through 509) with noAutoConnect (1):

```
ESS_NBLM_PLC502 multiDevice:No canBlock:Yes autoConnect:No
    enabled:Yes connected:No numberConnects 0
    nDevices 0 nQueued 0 blocked:No
    asynManagerLock:No synchronousLock:No
    exceptionActive:No exceptionUsers 0 exceptionNotifys 0
    traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
    interposeInterfaceList
        asynOctet pinterface 0x7fdb82c0e360 drvPvt 0xe45fd0
    interfaceList
        asynCommon pinterface 0x7fdb8875cf70 drvPvt 0xe3de60
        asynOption pinterface 0x7fdb8875cf90 drvPvt 0xe3de60
        asynOctet pinterface 0xe3df80 drvPvt 0xe3de60
    Port 172.30.150.83:502: Disconnected
                    fd: -1
    Characters written: 0
       Characters read: 0
```

With autoconnect, I establish a connection, but the IOC appears to crash upon the first call of drvModbusAsynConfigure:

```
ESS_NBLM_PLC502 multiDevice:No canBlock:Yes autoConnect:Yes
    enabled:Yes connected:Yes numberConnects 1
    nDevices 0 nQueued 0 blocked:No
    asynManagerLock:No synchronousLock:No
    exceptionActive:No exceptionUsers 0 exceptionNotifys 0
    traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
    interposeInterfaceList
        asynOctet pinterface 0x7efe82bc5360 drvPvt 0x128c050
    interfaceList
        asynCommon pinterface 0x7efe886dff70 drvPvt 0x1283fa0
        asynOption pinterface 0x7efe886dff90 drvPvt 0x1283fa0
        asynOctet pinterface 0x12840c0 drvPvt 0x1283fa0
    Port 172.30.150.83:502: Connected
                    fd: 6
    Characters written: 0
       Characters read: 0
```

...

```
drvModbusAsynConfigure("ESS_NBLM_PLC502_AS_WRITE_0",            "ESS_NBLM_PLC502",              1,                      16,                     0,              40,             8,                      1,      "SIEMENS")
[iocuser@xblm-ctrl-pc cmds]$ # i.e. just a PS1 - process dead
```




Anders

-----Original Message-----
From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Thursday, 17 September, 2020 13:34
To: Anders Lindh Olsson <Anders.LindhOlsson at ess.eu>
Cc: tech-talk at aps.anl.gov
Subject: Re: Issues connecting to siemens PLC

> #                                           portName,                           tcpPortName,            slaveAddr,     modbusFct,       addr,   length, dataType,       pollMsec,       plcType,

> drvModbusAsynConfigure("ESS_NBLM_PLC502_AS_WRITE_0",            "ESS_NBLM_PLC502",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

> 2020/09/17 09:38:36.122 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC502_AS_WRITE_0 error calling writeRead, error=172.30.150.83:502 write error: Broken pipe, nwrite=0/6, nread=0


Prior to that drvModbusAsynConfigure command you should have called drvAsynIPPortConfigure() and modbusInterposeConfig().  Did both of those calls succeed?  Prior to calling drvModbusAsynConfigure I would suggest adding this command to your startup to make sure the IP port is created and connected.


asynReport(10, "ESS_NBLM_PLC502")


Mark




________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Anders Lindh Olsson via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, September 17, 2020 2:57 AM
To: tech-talk at aps.anl.gov
Subject: Issues connecting to siemens PLC


Hi,



I have an IOC that is supposed to control a Siemens S7 PLC using s7plc (1.4.1) and modbus (3.0.0), developed by someone that is not me. I have been running into two (possibly separate but I don't think so) issues.



First some errors during set up:



#                                           portName,                           tcpPortName,            slaveAddr,     modbusFct,       addr,   length, dataType,       pollMsec,       plcType,

drvModbusAsynConfigure("ESS_NBLM_PLC502_AS_WRITE_0",            "ESS_NBLM_PLC502",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.122 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC502_AS_WRITE_0 error calling writeRead, error=172.30.150.83:502 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC508_AS_WRITE_0",            "ESS_NBLM_PLC508",              1,                     16,                      0,              6,              4,                      1,                      "SIEMENS")

2020/09/17 09:38:36.122 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC508_AS_WRITE_0 error calling writeRead, error=172.30.150.83:508 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC509_AS_WRITE_0",            "ESS_NBLM_PLC509",              1,                     16,                      0,              2,              8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.123 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC509_AS_WRITE_0 error calling writeRead, error=172.30.150.83:509 read error: Connection reset by peer, nwrite=6/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC503_AS_WRITE_0",            "ESS_NBLM_PLC503",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC503_AS_WRITE_0 error calling writeRead, error=172.30.150.83:503 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC504_AS_WRITE_0",            "ESS_NBLM_PLC504",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC504_AS_WRITE_0 error calling writeRead, error=172.30.150.83:504 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC507_AS_WRITE_0",            "ESS_NBLM_PLC507",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC507_AS_WRITE_0 error calling writeRead, error=172.30.150.83:507 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC505_AS_WRITE_0",            "ESS_NBLM_PLC505",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC505_AS_WRITE_0 error calling writeRead, error=172.30.150.83:505 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC506_AS_WRITE_0",            "ESS_NBLM_PLC506",              1,                     16,                      0,              40,             8,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC506_AS_WRITE_0 error calling writeRead, error=172.30.150.83:506 write error: Broken pipe, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC502_TS_WRITE_4000",         "ESS_NBLM_PLC502",              1,                     5,                       4000,   1640,   0,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC502_TS_WRITE_4000 error calling writeRead, error=asynManager::queueLockPort queueRequest failed: port ESS_NBLM_PLC502 not connected, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC502_TS_WRITE_6400",         "ESS_NBLM_PLC502",              1,                     5,                       6400,   1640,   0,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC502_TS_WRITE_6400 error calling writeRead, error=asynManager::queueLockPort queueRequest failed: port ESS_NBLM_PLC502 not connected, nwrite=0/6, nread=0

drvModbusAsynConfigure("ESS_NBLM_PLC502_TS_WRITE_8800",         "ESS_NBLM_PLC502",              1,                     5,                       8800,   3,              0,                      1,                      "SIEMENS")

2020/09/17 09:38:36.124 drvModbusAsyn::doModbusIO port ESS_NBLM_PLC502_TS_WRITE_8800 error calling writeRead, error=asynManager::queueLockPort queueRequest failed: port ESS_NBLM_PLC502 not connected, nwrite=0/6, nread=0



And later when the IOC shell is started:



04d5808-xblm-ct-25485 > 09/17/20 09:38:37.387 s7plcConnect ESS_NBLM_PLC: connected to 172.30.150.83:2000

09/17/20 09:38:37.387 s7plcReceiveThread ESS_NBLM_PLC: recv(32, ..., 534, 0) failed: Connection reset by peer

09/17/20 09:38:37.387 s7plcCloseConnection ESS_NBLM_PLC

09/17/20 09:38:38.638 s7plcConnect ESS_NBLM_PLC: connected to 172.30.150.83:2000

09/17/20 09:38:38.639 s7plcReceiveThread ESS_NBLM_PLC: recv(32, ..., 534, 0) failed: Connection reset by peer

09/17/20 09:38:38.639 s7plcCloseConnection ESS_NBLM_PLC

09/17/20 09:38:39.889 s7plcConnect ESS_NBLM_PLC: connected to 172.30.150.83:2000

09/17/20 09:38:39.890 s7plcReceiveThread ESS_NBLM_PLC: recv(32, ..., 534, 0) failed: Connection reset by peer

09/17/20 09:38:39.890 s7plcCloseConnection ESS_NBLM_PLC



Any help would be appreciated.





Cheers

Anders

References:
Issues connecting to siemens PLC Anders Lindh Olsson via Tech-talk
Re: Issues connecting to siemens PLC Mark Rivers via Tech-talk
RE: Issues connecting to siemens PLC Anders Lindh Olsson via Tech-talk

Navigate by Date:
Prev: RE: Issues connecting to siemens PLC Anders Lindh Olsson via Tech-talk
Next: AW: device support for IK342 Sintschuk, Michael via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Issues connecting to siemens PLC Anders Lindh Olsson via Tech-talk
Next: device support for IK342 Sintschuk, Michael via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 17 Sep 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·