Connection of Ethernet cable with G400-D

I am just getting started with the G400-D and starting to port my ChipworkX application to it. I have the following code that fails.

GHI.Premium.Net.EthernetBuiltIn ethy = new GHI.Premium.Net.EthernetBuiltIn();

            if (!ethy.IsCableConnected)
            {
                lblMsg.Text = "Error:  Network cable appears to be disconnected.";
                Glide.MainWindow.FillRect(lblMsg.Rect);
                lblMsg.Invalidate();
                return false;
            }

the stack trace for the error is:

Exception GHI.Premium.Net.NetworkInterfaceExtensionException - 0x00000000 (3)

#### Message: 
#### GHI.Premium.Net.EthernetBuiltIn::.ctor [IP: 0011] ####
#### ChipworkX_Mamooth_TFT_Test.Program::UploadLogFile [IP: 0004] ####
#### ChipworkX_Mamooth_TFT_Test.Program::buttonUpload_PressEvent [IP: 0004] ####
#### GHIElectronics.NETMF.Glide.UI.Button::TriggerPressEvent [IP: 000e] ####
#### GHIElectronics.NETMF.Glide.Display.DisplayObjectContainer::OnTouchDown [IP: 0035] ####
#### GHIElectronics.NETMF.Glide.Display.Window::TouchDownEvent [IP: 002e] ####
#### GHIElectronics.NETMF.Glide.TouchEventHandler::Invoke [IP: 202e21af] ####
#### GHIElectronics.NETMF.Glide.GlideTouch::RaiseTouchDownEvent [IP: 0008] ####
#### ChipworkX_Mamooth_TFT_Test.Program::TouchInterupt_OnInterrupt [IP: 0056] ####

A first chance exception of type ‘GHI.Premium.Net.NetworkInterfaceExtensionException’ occurred in GHI.Premium.Net.dll
An unhandled exception of type ‘GHI.Premium.Net.NetworkInterfaceExtensionException’ occurred in GHI.Premium.Net.dll

Uncaught exception

Any thoughts?

According to the GHI documentation:

Open
This methods opens Ethernet driver. This must be called before accessing any other member of this object.
(Overrides NetworkInterfaceExtension.Open().)

I see you aren’t calling Open() in your code. Have you tried doing that before checking the cable is connected?

Keep in mind that the internal Ethernet is not functional on the pre release modules. Your board should say not for production. Production is on the way.

@ rncox -

It looks like you can not create a EthernetBuiltIn object. I think you did not update to the new G400 firmware.

Try to update 4.2.10.1 (https://www.ghielectronics.com/docs/112/g400)

and put this code


using System;
using Microsoft.SPOT;
using GHI.Premium.Net;
namespace MFConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            EthernetBuiltIn enet = new EthernetBuiltIn();

            Debug.Print(" Create EthernetBuiltIn successed!");
        }

    }
}


If it works, some problem with your whole project, I think.

@ Dat - My first line of code is exactly what you have.

I will assume it is just not implemented as Gus mentioned.

Thanks.