BuiltInEthernet issue

I am using G120E in a custom board. The G120E replaced an EMX in the same board.
I am having trouble with pinging the module. My PC is connected directly to the custom board through an ethernet cable and the Builtinethernet is set for static IP address set by my application. I am constantly pinging it and once in a while the ping times out and I don’t get any responses. I set the ping time out for 1 minute and it still times out.
This issue does happen with an EMX module with the same code.
This is causing problems in our system because we use pings to communicate between two boars that are connected through an ethernet cable to each other.
Is there a hardware difference between G120E and EMX that causes this issue?
How can I fix the issue?
I appreciate your help and suggestion with this issue.

They are near identical. I would use a simple program that sets up the network and blinks an LED to compare EMX to G120. Maybe what you are seeing is due to something else.

With a simple code still does it. Not as frequent though…
here is my simple code:
public static class Program
{
static EthernetBuiltIn Ethernet = new EthernetBuiltIn();
private static PWM _pwmHeartbeat;
static double _PWMTimer1Freq = 100000;
public static bool isEthernetAvailable = false;

    public static void Main()
    {
        _pwmHeartbeat = new PWM(GHI.Pins.G120E.PwmOutput.P3_26, _PWMTimer1Freq, 0.50, false);
        _pwmHeartbeat.Start();
        Ethernet.Open();
        Ethernet.EnableDhcp();
        Ethernet.EnableDynamicDns();
        Ethernet.EnableStaticIP("172.16.2.13", "255.255.255.0", "0.0.0.0");
        NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
        NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
        while (true)
        { 
            Thread.Sleep(1000);
            _pwmHeartbeat.Start();
            Thread.Sleep(1000);
            _pwmHeartbeat.Stop();
        }
    }
    private static void NetworkChange_NetworkAddressChanged(object sender, Microsoft.SPOT.EventArgs e)
    {
        Debug.Print("Network address changed");
    }

    private static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
    {
        isEthernetAvailable = e.IsAvailable;
        Debug.Print("Network availability: " + e.IsAvailable.ToString());
    }

    }

}

The same code on EMX gives different results? With ping?

EMX does not time out.

Have you checked for a correct MAC address?

I get the same MAC address (002103000001) for both EMX and G120 with the same code.
They are not connected to my PC at the same time.

Both EMX and G120 run the same firmware and use the same PHY. I am out of ideas on why this is happening.

Could it be…

For direct PC to board connections a crossover cable is needed.

Or put an Ethernet hub between the PC and the board.

Thank you for responding to my post.
just to provide more information, I can see that the pings work ok for some time and then they either take longer or timeout. then they start to work for a while a gain. could it be something on the background that is causing it?
I have seen other posts about ethernet and G120E not working and wasn’t sure if this was something that got fixed? or if you can check G120E the same way I checked it and maybe there is something that you can recommend?

As I mentioned before this caused issues in our systems that use the feature I explained earlier.

Thanks for your suggestion. I will check cross over cable but this does not explain the difference between EMX and G120E.

I noticed that you are enabling DHCP and assigning a static address… Both are attempting to set an IP address at the same time. When DHCP finally fails, it might be nulling out the static IP Address.

Also, you are enabling DNS. Since you do not have a DNS server with a PC to board connection, you might not want to enable DNS.

Using cross over cable did not fix it. I also disabled DHCP and DNS and that did not make any changes.

I changed the sleep thread to 1ms in the while loop and it makes the ping time outs happen more frequently.

Could this be related to something that’s running on the back ground in G120e?

I suggest you write a standalone application that just gets the ethernet If it works, then you know something else in your application is interacting with ethernet.

You have not exposed the PWM heartbeat code to us, Might left to see what is going on there.

The PWM is part of Microsoft.SPOT.Hardware liberary.
I took the PWM heartbeat LED part of the while loop out and it is still time out in ping.
This is my code:
using GHI.Networking;

namespace MCA_IV
{
public static class Program
{
static EthernetBuiltIn Ethernet = new EthernetBuiltIn();
public static void Main()
{
Ethernet.Open();
Ethernet.EnableStaticIP(“172.16.2.14”, “255.255.255.0”, “0.0.0.0”);
while (true)
{
//Thread.Sleep(1000);
}
}
}

}

I would try putting an ethernet hub between the PC and board. Maybe the lights on the hub will give you a clue.

baaaad. You’re actually consuming all the processor cycles here. Put the thread.sleep back in, or just do a thread.sleep(timeout.infinite)

I’ve tried with the thread.sleep back in there. The problem is still there just not as frequent.

how are you powering the board?

3.3 vdc power regulator.