TCP IP Modbus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TCP IP Modbus

2,936 Views
BoSCHoW
Contributor II
Hello,

i have implemented TCP IP Modbus communication protocol on Freescale ColdFire micro controller. The TCP IP stack is similar to windows TCP IP stack. For the moment it has just the server part of the protocol this means that other devices can connect to it. My problem is that i don't know how to maintain the connection, because it drops after a while. I had in mind, to use interrupts, but i don't know if this is the right solution. My database has around 2000 modbus signals ... Do you guys have any solution to this problem ?

thanks and
best regards.
BoSCHoW.
Labels (1)
3 Replies

847 Views
BoSCHoW
Contributor II
Also when I was observing the communication with ethreal I found out this:
- the client send a TCP IP packet SYN
- then the servers responds with SYN ACK
- and then the client sends ACK
- and the client immediately sends a Modbus Query
- the server sends Modbus respond
- and then immediatly another package that is labeled TCP DUP ACK "11#1"
- and then the sequence is repeated
P.S. Sometimes the server also sends TCP Window size changed ...

I think the problem is on the server side. I don't use any functions to close the connection. I just use SocketListen, SocketRecieve and SocketSend. I also should check if the server changed the port to keep the connection active ??

Best Regards,
BoSCHoW.
0 Kudos

847 Views
ynaught
Contributor III
I cannot offer specific help, since I'm not using the same stack as you.  But, I do Modbus/TCP quite a lot and can offer this:
 
We make our money on hardware, so give our software free.  One extrememly useful piece is horribly named zapreg32.exe; it's a command-line register viewer which supports many protocols, including Modbus/TCP (and several serial protocols).
 
We do not have it as a standalone download, but it is in this archive:
 
 
which you could install, or use an archiving tool to extract only zapreg32.exe into a directory in your PATH.
 
Then you would:
 
zapreg32 10.10.10.100 255 -s
 
where 10.10.10.100 is your server (duh) and 255 is the Destination Index to put in the messages.  This will read 4x (%MW) registers by default, switch -3 reads 3x, -1 and -0 (I believe) display 1x and 0x register spaces.  The -s switch turns off polling for identity strings supported by only our products.
 
It was written as a tool for internal use, but is extremely useful in troubleshooting too--lets us eliminate our bridge as a problem and say something to the effect of "Now you need to check the configuration on your SCADA"...
 
Good luck,
 

847 Views
ynaught
Contributor III
Ooops; rather than try to explain the command line switches, I should've said...  Enter
 
zapreg32 /?
 
for a list of switches and usage information.
 
Good Luck,
 
0 Kudos