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  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Modbus help
From: "Mark Rivers" <[email protected]>
To: <[email protected]>, <[email protected]>
Date: Wed, 25 Nov 2009 12:25:54 -0600
Hi Emma,

This is the 8 byte packet being sent to your device.  The asyn serial
port driver is telling us that these bytes are being sent, so I think
they really are.

01 03 00 01 00 01 d5 ca

The first byte is the Modbus slave address, which is 01 in your case, so
this is correct.  This is added to the packet by the interposeInterface
layer, which also adds the 2-byte CRC at the end, "d5 ca".  The CRC
calculation is too complex to do by hand, but I have tested it and
others are using it, so I'm pretty sure it is correct.

The data packet from the Modbus driver is thus "03 00 01 00 01".

Your Modbus function code is 3, which is ReadHoldingRegisters.  The data
packet for that function code is:

typedef struct modbusReadRequest_str
{
    unsigned char    fcode;
    unsigned short   startReg;
    unsigned short   numRead;
} modbusReadRequest;

So the first byte of the packet is the function code, 3, which is
correct.  The next 2 bytes are the starting register address, which was
1 in your case.  It is stored in network (big-endian) byte order, so the
next 2 bytes "00 01" is correct.  Finally there is numRead, the number
of holding registers to read, which is also 1 in your case, so "00 01"
is again correct.

So it appears to me that a correctly formed packet is being sent to your
Modbus device, but you are not getting a response.  The first thing to
check is for misconfigured hardware wiring.  You can even put a scope on
the send and receive lines to see if the characters are being sent, and
if any are being received.

If you still have problems you might want to download one of the Modbus
simulators available.  I used one when I was developing the driver.
Unfortunately I don't remember which one I used, (but I know it cost
$148), and it allowed my PC to emulate a Modbus device and report any
protocol errors from the EPICS Modbus driver, and show all traffic.

Mark




-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, November 25, 2009 3:37 AM
To: Mark Rivers; [email protected]
Subject: RE: Modbus help

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:[email protected]] 
> Sent: 24 November 2009 17:32
> To: Shepherd, Emma (DLSLtd,RAL,DIA); [email protected]
> 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: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: Tuesday, November 24, 2009 10:52 AM
> To: [email protected]
> 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

 









References:
RE: Modbus help Mark Rivers
RE: Modbus help emma.shepherd

Navigate by Date:
Prev: RE: CA problem w EPICS 3.14.11 & VxWorks 6.7 Jeff Hill
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  2018  2019  2020  2021  2022  2023  2024 
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  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·