EmbDev.net

Forum: ARM programming with GCC/GNU tools TCP IP Modbus


Author: Bostjan Gojkovic (boschow)
Posted on:

Rate this post
0 useful
not useful
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.

Author: Bostjan Gojkovic (boschow)
Posted on:

Rate this post
0 useful
not useful
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.

Author: Miroslav Krsmanovic (mirge)
Posted on:

Rate this post
0 useful
not useful
Bostjan Gojkovic wrote:
> 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.


Hi Gojkovicu.
Can I speak to you on Serbian? It will be easier!:)
I haven't much expirience with microcontrollers as I have with
protocols.
But,

> - the client send a TCP IP packet SYN
> - then the servers responds with SYN ACK
> - and then the client sends ACK

This means that client checking is server avalible and the server
respond that he is.

From next point, you can try to find a problem.

> - and the client immediately sends a Modbus Query
> - the server sends Modbus respond.

Here can be an error if client overrun time about the server "reply
time-out". In that case, server may open new Modbus deal, but reply will
fail, because client cannont see that new one.

But this:

> - 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 ...

This is normal, because the server have to inform client about free
space (memory) on his (server) side. And the size of that free space iz
changing. TCP DUP ACK "11#1" is right that about size window. How much
can client send to server. Try to find out how much is "11#1", because
if server "talking" about the same size, there can be problem. I repeat
CAN BE. Try to focus on that.

Best wishes,
Ili pozdrav:)
Miroslav K.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.