Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: RE: Modbus help
From: <emma.shepherd@diamond.ac.uk>
To: <rivers@cars.uchicago.edu>, <tech-talk@aps.anl.gov>
Date: Wed, 25 Nov 2009 09:37:06 -0000
Hi Mark,

I've attached my startup script (the modbus stuff is at the bottom).
There are actually 8 devices in an RS-485 chain, at the moment I'm just
trying to talk to the one which is configured with address '1' (although
I have tried the others as well).  They use serial/RTU.

I turned on trace for the Modbus port as well, here's what I get:

01 03 00 01 00 01 d5 ca 
2009/11/25 09:33:41.823 drvModbusAsyn::doModbusIO port readTemp error
calling writeRead, error=, nwrite=5/5, nread=0
2009/11/25 09:33:42.173 readTemp queueRequest synchronous
2009/11/25 09:33:42.173 ME02P-DI-TMON-01:TEMP1 devAsynFloat64::process
read error 
2009/11/25 09:33:43.323 drvModbusAsyn::doModbusIO port readTemp has I/O
error
2009/11/25 09:33:43.323 drvModbusAsyn::doModbusIO port readTemp
disconnect device OK
2009/11/25 09:33:43.323 drvModbusAsyn::doModbusIO port readTemp connect
device OK
2009/11/25 09:33:43.323 /ty/72/0 write 8

01 03 00 01 00 01 d5 ca 
2009/11/25 09:33:44.823 drvModbusAsyn::doModbusIO port readTemp error
calling writeRead, error=, nwrite=5/5, nread=0
2009/11/25 09:33:46.323 drvModbusAsyn::doModbusIO port readTemp has I/O
error
2009/11/25 09:33:46.323 drvModbusAsyn::doModbusIO port readTemp
disconnect device OK
2009/11/25 09:33:46.323 drvModbusAsyn::doModbusIO port readTemp connect
device OK
2009/11/25 09:33:46.323 /ty/72/0 write 8

Thanks a lot,
Emma


> -----Original Message-----
> From: Mark Rivers [mailto:rivers@cars.uchicago.edu] 
> Sent: 24 November 2009 17:32
> To: Shepherd, Emma (DLSLtd,RAL,DIA); tech-talk@aps.anl.gov
> Subject: RE: Modbus help
> 
> 
> Hi Emma,
> 
> Here are some questions/suggestions:
> 
> - Can you send your startup script?  
> - How have you set the interpose interface, etc?  
> - Does your device use serial/RTU (binary) or serial/ASCII protocol?  
> - What is the slave address of your device?
> - You have turned on asynTrace for the underlying asyn serial 
> port. Please also turn on asynTrace for the Modbus asyn port. 
>  That should be very helpful.
> 
> Once I know how it is configured I can figure out if those 8 
> characters it is sending are correct.
> 
> Mark
> 
> 
> -----Original Message-----
> From: tech-talk-bounces@aps.anl.gov 
> [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of 
> emma.shepherd@diamond.ac.uk
> Sent: Tuesday, November 24, 2009 10:52 AM
> To: tech-talk@aps.anl.gov
> Subject: Modbus help
> 
> Hi,
> 
> I'm trying to get an RS-485 chain of N2300 temperature 
> monitors talking to EPICS using the asyn modbus support 
> (R1-3) and so far am not having much luck.  Basically I just 
> get no response back from any of them, although I'm pretty 
> confident I'm sending out the right message (I checked it 
> with a serial analyser) and have configured the correct comms setting.
> 
> After iocInit I get the following message on the console 
> (with asynTrace turned on):
> 
> 2009/11/24 16:03:34.302 drvModbusAsyn::doModbusIO port 
> readTemp is disconnected
> 
> and then lots of I/O errors:
> 
> 02 03 00 01 00 01 d5 f9
> 2009/11/24 16:03:38.952 drvModbusAsyn::doModbusIO port 
> readTemp error calling writeRead, error=, nwrite=5/5, nread=0 
> 2009/11/24 16:03:39.302 ME02P-DI-TMON-01:TEMP1 
> devAsynFloat64::process read error 2009/11/24 16:03:40.452 
> drvModbusAsyn::doModbusIO port readTemp has I/O error 
> 2009/11/24 16:03:40.452 /ty/72/0 write 8
> 
> 02 03 00 01 00 01 d5 f9
> 2009/11/24 16:03:41.952 drvModbusAsyn::doModbusIO port 
> readTemp error calling writeRead, error=, nwrite=5/5, nread=0 
> 2009/11/24 16:03:43.452 drvModbusAsyn::doModbusIO port 
> readTemp has I/O error 2009/11/24 16:03:43.452 /ty/72/0 write 8
> 
> ....... etc
> 
> asynReport prints the following:
> 
> modbus port: readTemp
>     asynOctet server:   ty_72_0
>     modbusFunction:     3
>     modbusStartAddress: 01
>     modbusLength:       01
>     plcType:            N2300
>     I/O errors:         119
>     Read OK:            0
>     Write OK:           0
>     pollDelay:          1.500000
>     Time for last I/O   0 msec
>     Max. I/O time:      0 msec
> value = 0 = 0x0
> 
> Am I likely to be chasing a wiring/hardware issue here or is 
> there something standing out that indicates a problem higher 
> up? This is the first time I've tried to use modbus so I'm 
> not sure what a 'working' system looks like!
> 
> Thanks in advance,
> 
> Emma
> 
> 
> -- 
> This e-mail and any attachments may contain confidential, 
> copyright and or privileged material, and are for the use of 
> the intended addressee only. If you are not the intended 
> addressee or an authorised recipient of the addressee please 
> notify us of receipt by returning the e-mail and do not use, 
> copy, retain, distribute or disclose the information in or 
> attached to the e-mail. Any opinions expressed within this 
> e-mail are those of the individual and not necessarily of 
> Diamond Light Source Ltd. 
> Diamond Light Source Ltd. cannot guarantee that this e-mail 
> or any attachments are free from viruses and we cannot accept 
> liability for any damage which you may sustain as a result of 
> software viruses which may be transmitted in or with the 
> message. Diamond Light Source Limited (company no. 4375679). 
> Registered in England and Wales with its registered office at 
> Diamond House, Harwell Science and Innovation Campus, Didcot, 
> Oxfordshire, OX11 0DE, United Kingdom
>  
> 
> 
> 
> 
> 



-- 

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.

Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 

Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.

Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

 







#!$(INSTALL)/bin/$(ARCH)/ME02P-MO-IOC-01
# Following line enables the backspace key
$(VXWORKS_ONLY)tyBackspaceSet(127)

# IP site enumerations
$(VXWORKS_ONLY)A = 0
$(VXWORKS_ONLY)B = 1
$(VXWORKS_ONLY)C = 2
$(VXWORKS_ONLY)D = 3

## You may have to change polarimeter to something else
## everywhere it appears in this file

cd "$(INSTALL)"

# Load binaries on architectures that need to do so.
# VXWORKS_ONLY, LINUX_ONLY and RTEMS_ONLY are macros that resolve
# to a comment symbol on architectures that are not the current
# build architecture, so they can be used liberally to do architecture
# specific things. Alternatively, you can include an architecture
# specific file.
$(VXWORKS_ONLY)ld < bin/$(ARCH)/ME02P-MO-IOC-01.munch

# Set CA_MAX_ARRAY_BYTES for sscan software
epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES","3000000")

## This drvTS initializer is needed if the IOC has a hardware event system
#TSinit

## Register all support components
dbLoadDatabase("dbd/ME02P-MO-IOC-01.dbd")
ME02P_MO_IOC_01_registerRecordDeviceDriver(pdbbase)

#########################################################
# Configure 1 PMAC
$(VXWORKS_ONLY)IVEC=newInterruptVector()
$(VXWORKS_ONLY)IVEC=newInterruptVector()
$(VXWORKS_ONLY)IVEC=newInterruptVector()
pmacVmeDebug=1
drvPmacDebug=1
pmacVmeConfig(0, 0x7fa000, 0x700000, 0xC1, 3)
# Startup driver for DPRAM ASCII buffer

pmacVmeDebug=0
drvPmacDebug=0
pmacAsynConfig(0, "PMAC_S")

# Configure Old-style and DPRAM interface for first PMAC card.
pmacDrvConfig (0,-1,-1,0,"PMAC_S0")

# Initialise the low-level PMAC driver (comms port, comms addr, card, nAxes)
pmacAsynMotorCreate("PMAC_S0", 0, 0, 32, 0x1)
# Setup the motor Asyn layer (portname, low-level driver drvet name, card, number of axes on card)
drvAsynMotorConfigure("PMAC1", "pmacAsynMotor", 0, 33)


# Configure Hytec carriers
##########################################################
# 8002 Carrier in VME Slot 7
$(VXWORKS_ONLY)ARGS7 = malloc(20)
$(VXWORKS_ONLY)IVEC7 = newInterruptVector()
$(VXWORKS_ONLY)sprintf(ARGS7, "7 2 %d", IVEC7)
$(VXWORKS_ONLY)IPAC7 = ipacAddHy8002(ARGS7)

#########################################################
# 8512 scalar module in IP site A of IP carrier card in slot 7
$(VXWORKS_ONLY)IVEC70 = newInterruptVector()
DLS8512Configure(700, IPAC7, A, IVEC70)

##########################################################
# 8515 serial module in IP site B of IP carrier card in slot 7
# (Currently unused)
$(VXWORKS_ONLY)IVEC = newInterruptVector()
$(VXWORKS_ONLY)SER71 = Hy8515Configure(71, IPAC7, B, IVEC, 625, 0, 0)
$(VXWORKS_ONLY)S710 = tyHYOctalDevCreate("/ty/71/0", SER71, 0, 2500, 2500)

##########################################################
# 8516 serial module in IP site C of IP carrier card in slot 7
$(VXWORKS_ONLY)IVEC = newInterruptVector()
$(VXWORKS_ONLY)SER72 = Hy8515Configure(72, IPAC7, C, IVEC, 625, 2, 0)
$(VXWORKS_ONLY)S720 = tyHYOctalDevCreate("/ty/72/0", SER72, 0, 256, 256)

# Set Hytec parameters
# Params are :
#       Port
#       Baud rate
#       Parity 'O'=odd, 'E'=even, 'N'=none
#       Number of stop bits. 1 or 2
#       Number of data bits. 5,6,7 or 8
#       Flow control. 'R'=receive only, 'T'=transmit only, 'H'=both, 'N'=none, 'S'=software
$(VXWORKS_ONLY)tyHYOctalConfig (S720, 4800, 'N', 1, 8, 'N')

# Configure the asyn port for the temperature monitor
drvAsynSerialPortConfigure("ty_72_0", "/ty/72/0", 0, 1, 0)

# Following lines crash the IOC!
#asynSetOption("ty_72_0",0,"baud","4800")
#asynSetOption("ty_72_0",0,"parity","none")
#asynSetOption("ty_72_0",0,"bits","8")
#asynSetOption("ty_72_0",0,"stop","1")


# Link Type
# 0 TCP/IP
# 1 RTU
# 2 ASCII

#modbusInterposeConfig(portName,slaveAddress,linkType,timeoutMsec)

modbusInterposeConfig("ty_72_0", 1, 1, 1500)

#drvModbusAsynConfigure(portName,tcpPortName,modbusFunction,modbusStartAddress,modbusLength,dataType,pollMsec,plcType);

modbusRead = 3

drvModbusAsynConfigure("readTemp", "ty_72_0", modbusRead, 1, 1, 0, 1500, "N2300")
#drvModbusAsynConfigure("readSetpoint", "ty_72_0", modbusRead, 2, 1, 0, 1500, "N2300")

asynSetTraceMask  ("ty_72_0", 0, 8)
asynSetTraceIOMask("ty_72_0", 0, 4)
asynSetTraceMask("readTemp",0,9)
asynSetTraceIOMask("readTemp",0,4)

## Load record instances
dbLoadRecords("db/ME02P-MO-IOC-01.db")
dbLoadRecords("db/tempMonitor.db")

## Set this to see messages from mySub
#mySubDebug 1

$(VXWORKS_ONLY)STREAM_PROTOCOL_DIR = malloc (1000)
$(VXWORKS_ONLY)strcpy (STREAM_PROTOCOL_DIR, "$(MKS937A)/data")

iocInit()

Replies:
RE: Modbus help Mark Rivers
RE: Modbus help Mark Rivers
RE: Modbus help Mark Rivers
References:
RE: Modbus help Mark Rivers

Navigate by Date:
Prev: Re: CA problem w EPICS 3.14.11 & VxWorks 6.7 Kazuro FURUKAWA
Next: RE: CA problem w EPICS 3.14.11 & VxWorks 6.7 GOURNAY Jean-Francois
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: RE: Modbus help Mark Rivers
Next: RE: Modbus help Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·