cancel
Showing results for 
Search instead for 
Did you mean: 

How to communicate two microcontrollers to a single pc via ethernet tcp/ip

sulochana
Associate II
Posted on March 10, 2017 at 11:16

Hi,

The communication between single microcontroller and pc is works fine through ethernet tcp/ip . problem occurs only when i connect two microcontroller to a single pc via ethenet cable,Here d-link 5-port 10/100 desktop is used for multiple connection.when connection made for multiple microcontroller ,the communication doesn't work properly.Either one connection will be in active condition other will be inactive.

I need solution to overcome this issue.My requirment is from pc it sends query to microcontroller-1 after receiving response from microcontroller-1 .It has send next query to Microcontroller-2.Process should be repeat.

Is it possible? If yes please please guide me. Please anyone reply as soon as possible......

Thanking You....

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 13, 2017 at 10:26

Thank you so much for helping...

resolved issue by assigning unique mac address for two boards.Problem solved.......

View solution in original post

9 REPLIES 9
AvaTar
Lead
Posted on March 10, 2017 at 12:11

Please anyone reply as soon as possible......

What ???

The communication between single microcontroller and pc is works fine through ethernet tcp/ip . problem occurs only when i connect two microcontroller to a single pc via ethenet cable,

Make sure you do not assign the same IP address statically.

Or, when using DHCP, make sure you do not assign the same MAC addresses.

A familiarity with ethernet and TCP/IP is most helpful in this case.

sulochana
Associate II
Posted on March 11, 2017 at 06:20

Thanks for reply avatar.

I gave different ip address for microcontroller.

I have two microcontroller boars ie stm32f107 arm microcontrollers.

1.First controller having  ip address for one microcontroller to 192.168.1.252, port number 23 and modbus communication slave id 1.

2.Second microcontroller having an ip address 192.168.1.251, port number 22 

and modbus communication slave id 2.

Pc ip address 192.168.1.154.

My question is, communication between Single pc and multiple microcontroller is possible?.

Thank you....

Jack Peacock
Associate II
Posted on March 11, 2017 at 07:36

Assigning two IP addreses will not work if the physical MAC address of each ethernet controller is the same.  There is an underlying IP protocol called ARP (Address Resolution Protocol) which converts between logical IP and physical MAC address.  If two devices on the same subnet (hub or switch in your case) have the same MAC address the ARP protocol will fail, resulting in exactly the fault you describe.

Yes it is possible to communicate between several controllers and a PC on Ethernet, but only if each connection can be uniquely identified by the MAC address.  Duplicate MAC addresses cannot exist on the same subnet.

sulochana
Associate II
Posted on March 11, 2017 at 08:54

Thanks for reply jack,

Yes it is possible to communicate between several controllers and a PC on Ethernet, but only if each connection can be uniquely identified by the MAC address.  Duplicate MAC addresses cannot exist on the same subnet.

...

when i checked mac address of both devices have the same mac address.

Then how do i assign unique address to multiple microcontroller .Please help me.

Thank you..

Posted on March 11, 2017 at 16:55

Then how do i assign unique address to multiple microcontroller .Please help me.

By changing the MAC address in the source.

If it's urgent, you might need to pick up pace.

Posted on March 11, 2017 at 16:56

If two devices on the same subnet (hub or switch in your case) have the same MAC address the ARP protocol will fail, resulting in exactly the fault you describe.

Right, of course. Forgot that  ...

Posted on March 13, 2017 at 05:49

hi avatar,

can you please explain in detailed.How do i change source ip address.As i mentioned above ,im using d-link 5 port switch.

http://www.etcuae.com/media/catalog/product/cache/1/thumbnail/600x/17f82f742ffe127f42dca9de82fb58b1/d/l/dlink-des-1005a-5-port-fast-ethernet-desktop-switch-0063-5041246-1.jpg

5 ports are there:

First port is connected between pc and d-link.

second port is connected between d-link and microcontroller-1.

Thirt port is connected between d-link and microcontroller-2.

The software used to check communication is kepware opc client software.In this software im able to connect multiple devices.

so,please tell me now .How do i change source address.

Thank you....

Posted on March 13, 2017 at 08:28

Honestly ?

There are plenty of resources about the basics of ethernet and TCP/IP on the internet, read it through carefully. You need to get a general understanding of what is the problem, and what you want to achieve here.

And than get the project/sources for your MCU board, change, and rebuild.

I don't have the time to do it for you.

Posted on March 13, 2017 at 10:26

Thank you so much for helping...

resolved issue by assigning unique mac address for two boards.Problem solved.......