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  2020  2021  2022  2023  2024  2025  <2026>  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  2020  2021  2022  2023  2024  2025  <2026> 
<== Date ==> <== Thread ==>

Subject: Re: Modbus Module issue
From: "Dmitry Yu. Bolkhovityanov via Tech-talk" <tech-talk at aps.anl.gov>
To: Luis Alberto De Sousa Moreira <luis.moreira at epfl.ch>
Cc: tech-talk at aps.anl.gov
Date: Fri, 24 Jul 2026 19:23:26 +0700 (+07)
Hi Luis!

Have you tried running Wireshark to see what happens on the Ethernet?



On Fri, 24 Jul 2026, Luis Alberto De Sousa Moreira via Tech-talk wrote:

Hi Guys,
I think I tried everything I can think off. Still no connection.
May AI assistant thinks that the issue is that the module was built using MinGW instead of the MSVC tool chain, it is talking about the fact that MinGW uses a "Translation Layer" (POSIX vs. Winsock). I never had any issues before so can't see that being the issue, but wondering what you thoughts are on this.

Kind Regards
                 Luis

On 24/07/2026 10:46, Luis Alberto De Sousa Moreira via Tech-talk wrote:
 Hi J?rn,
 I think we getting the wires crossed here... the OPCUA port is 4840 but
 the 502 port is the normal Modbus port.
 I managed to connect fine to it with other applications in the same
 machine.




 Kind Regards
                   Luis


 On 24/07/2026 10:38, J?rn Dreyer wrote:
 Hi Luis,

 are you sure you are using the correct port?
 The Beckhoff documentation tells that the OPCUA server is listening on
 port 4840.  Did you cahnge that when installing the OPCUA Sever on the
 PLC?
 The Ports 500 + x are normally used for the various NC applications in
 your PLC program.

 Regards

 J?rn

 Am Freitag, 24. Juli 2026, 09:57:38 Mitteleurop?ische Sommerzeit schrieb
 Luis Alberto De Sousa Moreira via Tech-talk:
 Just found another application I used before as a Modbus client, called
 EasyModbusClient.
 It connects fine and gets data.

 This is getting more intriguing...

 Best Regards
                     Luis

 On 24/07/2026 09:40, Luis Alberto De Sousa Moreira via Tech-talk wrote:
 Hi Gabriel,
 The firewall seems to be the culprit, but I added rules for the
 application. I also just done a test where I disabled the firewall and
 I get the same result.

 D:\FalconDev\EPICS\modbus\iocBoot\iocTest>..\..\bin\windows-x64-mingw\modbusApp.exe
 BPS_Beck.cmd
#  BPS_Beck.cmd
#  Just testing the modbus module with my BPS Beckhoff PLC.
#  1. Cleanly lock network routing automatically at boot
 epicsEnvSet("EPICS_CA_ADDR_LIST", "10.136.0.255")
 epicsEnvSet("EPICS_CA_AUTO_ADDR_LIST", "NO")
 epicsEnvSet("EPICS_CAS_INTF_ADDR_LIST", "10.136.0.34")
 # gvl.mb_Input_Registers[10] := GVL.d_setpoint_T1;              // T1
                   mS
 # gvl.mb_Input_Registers[11] := GVL.d_setpoint_TRamp1;  // Ramp1
          uS
 # gvl.mb_Input_Registers[12] := GVL.d_setpoint_v1;              // V1
                   10V
 # gvl.mb_Input_Registers[13] := GVL.d_setpoint_T2;              // T2
                   mS
 # gvl.mb_Input_Registers[14] := GVL.d_setpoint_TRamp2;  // Ramp2
          uS
 # gvl.mb_Input_Registers[15] := GVL.d_setpoint_V2;              // V2
                   10V
 # gvl.mb_Input_Registers[16] := GVL.d_setpoint_T3;              // T3
                   mS
 # gvl.mb_Input_Registers[17] := GVL.d_setpoint_TRamp3;  // Ramp3
          uS
 # gvl.mb_Input_Registers[18] := GVL.d_setpoint_V3;              // V3
                   10V
 # gvl.mb_Input_Registers[19] := GVL.d_setpoint_pulseLength;     //
 PulseLength  S /mS
 # gvl.mb_Input_Registers[20] := GVL.d_setpoint_TRampDown;       //
 RampDown             uS
 dbLoadDatabase("../../dbd/modbusApp.dbd")
 modbusApp_registerRecordDeviceDriver(pdbbase)
 # Get the connection going
 drvAsynIPPortConfigure("BPS_Beck", "10.136.0.30:502", 0, 0, 0)
 2026/07/24 09:32:59.953 BPS_Beck -1 autoConnect could not connect:
 Can't connect to 10.136.0.30:502: Unknown error
 # drvAsynIPPortConfigure("BPS_Beck", "8.8.8.8:8080", 0, 0, 0)
 modbusInterposeConfig("BPS_Beck", 0, 5000, 0)
 asynSetOption("BPS_Beck",0, "disconnectOnReadTimeout", "Y")
 #
 =========================================================================
#  Configure Modbus Drivers Memory Blocks
#
 =========================================================================
#  Syntax:
#  drvModbusAsynConfigure("portName", "tcpPortName", slaveAddress,
 modbusFunction, modbusStartAddress, modbusLength, dataType, pollMsec,
 "plcType")
 # drvModbusAsynConfigure("modbusPortName", "asynPortName",
 slaveAddress, modbusFunction, startAddress, length, dataType,
 pollMsec, "plcType")
#  Read Coils (Function Code 1)
#  Reads 16 binary bits starting at offset 0, polling every 200
 milliseconds.
 # drvModbusAsynConfigure("READ_COILS", "PLC_NET", 0, 1, 0, 1, 0, 200,
 "OldPLC")
#  Write Coils (Function Code 5)
#  Configures a write-only path for coils. pollMsec is 0 because writes
 are instantaneous.
 # drvModbusAsynConfigure("WRITE_COILS", "PLC_NET", 0, 5, 0, 1, 0, 0,
 "OldPLC")
 # Reads 11 read-only 16-bit registers starting at offset 10, polling
 every 500 milliseconds.
 # dataType=0 specifies standard 16-bit unsigned integers (UINT_16).
 drvModbusAsynConfigure("READ_INPUTS", "BPS_Beck", 1, 4, 10, 11, 0,
 500, "Beckhoff")
#  Read Holding Registers (Function Code 3)
#  Reads 1 read/write 16-bit register starting at offset 0, polling
 every 500 milliseconds.
#  dataType=0 specifies standard 16-bit unsigned integers (UINT_16).
#  drvModbusAsynConfigure("READ_HOLDING", "PLC_NET", 0, 3, 0, 1, 0,
 500, "OldPLC")
#  Block E: Write Holding Registers (Function Code 6)
#  Configures a write-only path for single registers. pollMsec is 0 for
 on-demand writing.
 # drvModbusAsynConfigure("WRITE_HOLDING", "PLC_NET", 0, 6, 0, 1, 0, 0,
 "OldPLC")
#  Enable ASYN_TRACEIO_HEX on octet server
#  asynSetTraceIOMask("BPS_Beck",0,4)
#  Enable ASYN_TRACE_ERROR and ASYN_TRACEIO_DRIVER on octet server
#  asynSetTraceMask("BPS_Beck",0,9)
 dbLoadRecords("../../db/BPS_Beck.db")
 iocInit
 Starting iocInit
 ############################################################################
 ## EPICS R7.0.10
 ## Rev. 2026-07-01T08:47+0200
 ## Rev. Date build date/time:
 ############################################################################
 2026/07/24 09:33:00.992 drvModbusAsyn::doModbusIO port READ_INPUTS
 error calling writeRead, error=asynManager::queueLockPort queueRequest
 failed: port BPS_Beck not connected, nwrite=0/6, nread=0
 iocRun: All initialization complete
 epics>

 Kind Regards
                   Luis



 On 23/07/2026 16:24, Gabriel Fedel wrote:
 Hi Luis,

 Couldn't the firewall be blocking  the EPICS application ?

 Best Regards
 Gabriel
 ------------------------------------------------------------------------
 *From:* Tech-talk<tech-talk-bounces at aps.anl.gov> on behalf of Luis
 Alberto De Sousa Moreira via Tech-talk<tech-talk at aps.anl.gov>
 *Sent:* Thursday, July 23, 2026 3:59 PM
 *To:* Mark Rivers<rivers at cars.uchicago.edu>;tech-talk at aps.anl.gov
 <tech-talk at aps.anl.gov>
 *Subject:* Re: Modbus Module issue
 Hi Mark,
 My other application is using the Modbus protocol, I used it to do the
 initial testing on my system.
 I tried the telnet command from my MSYS2 environment and it can
 connect...

 telnet 10.136.0.30 502
 Trying 10.136.0.30...
 Connected to 10.136.0.30.
 Escape character is '^]'.

 Kind Regards
                     Luis

 On 23/07/2026 15:31, Mark Rivers wrote:
 telnet 10.136.0.30 502

 --
 Luis Moreira
 EPFL SB SPC-II, PPH241 (Batiment PPH) Station 13
 CH-1015 Lausanne, Switzerland
 Tel.    (+41) 21 693 58 37
 E-Mailluis.moreira at epfl.ch




	_________________________________________
	  Dmitry Yu. Bolkhovityanov
	  The Budker Institute of Nuclear Physics
	  Novosibirsk, Russia

References:
Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Re: Modbus Module issue Jörn Dreyer via Tech-talk
Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk

Navigate by Date:
Prev: Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Next: Re: Modbus Module issue Mark Rivers 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  2020  2021  2022  2023  2024  2025  <2026> 
Navigate by Thread:
Prev: Re: Modbus Module issue Luis Alberto De Sousa Moreira via Tech-talk
Next: Re: Modbus Module issue Mark Rivers 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  2020  2021  2022  2023  2024  2025  <2026> 
ANJ, 24 Jul 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·