Sign in to follow this  
dle

Ethernet connectivity

Recommended Posts

Hi Guru,

I have an MCU with an ethernet TCP/IP server application that sending data package. Attach is the raw data that I capture using device monitor studio software tool.

I set up DF ethernet TCP/IP client (IP: 192.168.0.90, Port: 5001)

I don't see anything on the DF COM monitor. when I tried to send out something from DF, it keep saying the port is busy.

Do you have any suggestion?    

Capture.JPG

Share this post


Link to post
Share on other sites

When you try and send something out a TCP port in DAQFactory and it gives you "Port is busy" it most likely means that the socket could not be established and the port is busy trying to establish it.  In general that usually means you got the IP address or Port # wrong.  5001 is an unusual port # for Modbus TCP.  502 is the standard.  Also, its possible that your device can only handle one connection and so while your other tool is running, DAQFactory can't connect.

 

Note that this does not apply to serial ports.  For serial ports, if you get Port is busy when you try and send, it usually means its locked due to other comms.

Share this post


Link to post
Share on other sites

Thanks Guru, I looked at the code of the MCU and it is actually port 7. 

nx_tcp_server_socket_listen(&ip_0, 7, &socket_echo, 5,NX_NULL);

 

Capture.JPG

Share this post


Link to post
Share on other sites

That would do it.  It's easy to forget that connecting over Ethernet requires more than just the IP address.  The IP address just gets you to the proper office building.  You also need to know what the port number is to get to the right office in the building and there are 65535 offices in the building and 99.99% are empty.

If your MCU is going to act as a standard ModbusTCP slave, put it on port 502, as that is the standard port and anyone doing Modbus TCP is going to try 502 first without looking at any documentation you provide.  Also, you should avoid port's below 256 as they are kind of "reserved".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this