Main Site Documentation

Networking problem v4.3


#1

HI everyone,

After monthes, I’m returning to gadgeteer development and I face a strange problem with network: it looks like the hi-level code doesn’t receive data.

I’ve tested with a Spider and a Cerberus, both in version 4.3. and showing exactly the same behaviour.

Here is the sample code from gadgeteer solutions (just mainboard + ethernet) :


void ProgramStarted()
{
    Debug.Print("Program Started");

    ethernet.UseDHCP();
    ethernet.NetworkUp += NetworkUp;
    ethernet.NetworkDown += NetworkDown;
}

private void NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
    Debug.Print("Network DOWN");
}

void NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
    Debug.Print("Network UP");

    DateTime max = DateTime.Now + new TimeSpan(0, 0, 30);
    while ((ethernet.NetworkSettings.IPAddress == "0.0.0.0") && (DateTime.Now < max))
        System.Threading.Thread.Sleep(500);

    Debug.Print("IP " + ethernet.NetworkSettings.IPAddress);
    Debug.Print("SN " + ethernet.NetworkSettings.SubnetMask);
    Debug.Print("GW " + ethernet.NetworkSettings.GatewayAddress);
    foreach (var dns in ethernet.NetworkSettings.DnsAddresses)
        Debug.Print("DNS " + dns);
}

I receive the network up/down events but the IP address never comes.
Both devices respond to ping and I can see their MAC address in the switch.
I’ve staticaly set the network config and tested with wireshark, I see the devices sending data, the responses are sent back but they ignore them.

Any hint would be appreciated :slight_smile:

I already did some working ethernet code, but it was in version 4. I’ve not tried yet to reinstall old versions of everything…


#2

I also got the same problem on 4.3 with my cerbuino net as well as my spider. I would appreciate some assistance!


#3

Thanks andre.m for your quick reply.
In fact the actual program is using the EthernetENC28J60 directly as in your link. I made a small gadgeteer test “to be sure”.

The first thing my app does is trying go get time from NTP server (UDP), which does not work.
I changed it to use static IP and continue anyway to run a simple http server. Guess: once a connection has been established in TCP, the UDP communication works perfectly !

The code originaly comes from 4.1 and worked well. I just changed the network creation / connection for 4.3

I will try to make a small test program to reproduce the problem.

Edit :
[shame mode ON] :-[

For the first “not working” call to NTP I use a contant I introduced, that holds the server url, while for the “working” one I added after I simply encoded the url.
The constant was be.ntp.pool.org, the typed url was be.pool.ntp.org. Unfortunately both exist…
Morality : never ever make a quick small change, check it in and go to sleep.

[shame mode OFF]