G400-D: debug operation - network error on using NETFM-SDK 2016 R1

Hi there!

We use the SDK on different host-operating systems - VS2013 Gadgeteer Core (+netmf v4.3.2 SDK)

The USB-Link to the target is correct.
There are basic network operations using dhcp network configuration.
In any normal operation mode without debugging the network does not fail.

If we start debug operation, the link will be correct established,
program will be startet - and if I wait for a valid DHCP IP address, network fails.
Very seldom, but in time and content unspecified, the dhcp-ip is leased.

The manual leasing of dhcp does not matter, no change in behave.
We also tried to set static ip-address - did not work, the requested ip has not been set.
We also tried the very basic samples from ghi homepage - did not work.

We basically assumed any problems with the bootloader.
We reinstalled bootloader, the corresponding version to the mentioned netfm-sdk, successfully.
Seems very ok.

I look forward for any solutions
Regards
Developer

@ hweinfurterAAE - Can you post a small but complete program that shows the issue so we can try and test here?

@ John:

Sorry
We created a completely new project. sample code copied directly out of your examples.
There is no specific code. We found out that we have to make a reset on the G400 device after
finishing download to get a correct ip-address.

an other interesting fact:
if we try to configure the ip in the Fez-Tool, to controller is also not able to get a new ip address from the router
the basic idea was, that if I configure network in FEZ tool, I only have to open the network interface in
my program to start working. wrong idea?

hardware G400 TH (sorry, missed to change)

regards
Herbert

@ hweinfurterAAE - Unfortunately in our tests networking works fine even when debugging. Can you try using different network setups? Different routers, cables, and switches if you have them available.

We already discuss about this months ago. When debugging the ip stack seems buggy. Let me find the post…

[url]https://www.ghielectronics.com/community/forum/topic?id=21638&page=6[/url]

[url]https://www.ghielectronics.com/community/forum/topic?id=17571[/url]

and as a workaround here’s a code that retry to get ip:


        public static void Initialize()
        {
            Debug.Print("Initialize ETH");
            try
            {
                long constructorTime = 0;
                if (eth == null)
                {
                    while (constructorTime == 0)
                    {
                        DateTime now = DateTime.Now;
                        eth = new EthernetBuiltIn();
                        constructorTime = ((DateTime.Now - now).Ticks / TimeSpan.TicksPerMillisecond);
                        if (constructorTime == 0)
                        {
                            eth.Dispose();
                        }
                        Debug.Print("Ethernet constructor time (ms) = " + constructorTime);
                    }
                }

                NetworkChange.NetworkAddressChanged -= NetworkChangeNetworkAddressChanged;
                NetworkChange.NetworkAvailabilityChanged -= NetworkChangeNetworkAvailabilityChanged;
                if (IsDhcp)
                {
                    if (!eth.IsDhcpEnabled)
                        eth.NetworkInterface.EnableDhcp();
                }
                else eth.EnableStaticIP(Ip, Subnetmask, GatewayAddress);

                NetworkChange.NetworkAddressChanged += NetworkChangeNetworkAddressChanged;
                NetworkChange.NetworkAvailabilityChanged += NetworkChangeNetworkAvailabilityChanged;

                if (!eth.Opened)
                {
                    eth.Open();
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message + " \n" + e.StackTrace);
            }

        }

I just run into the same issue and can confirm the code solves the problem