Main Site Documentation

G400D Dev Board ethernet test program


#1

Hi,

I have a G400D Dev Board, how do I develop firmware in .net micro framework environment to test hardware on the Ethernet portion?

Thanks,
Jian


#2

after one minute on Google…

https://old.ghielectronics.com/docs/30/networking


#3

Mike,

Thanks for the network doc. Do I need to have another PC to connect with the G400D Dev board through the Ethernet cable? If so, what setting should I set up with the other PC?
I see 2 functions in the doc:

netif = new EthernetENC28J60(SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin1, Cpu.Pin.GPIO_Pin2, Cpu.Pin.GPIO_Pin3);
netif.Open();
netif.EnableDhcp();
netif.EnableDynamicDns();

while (netif.IPAddress == “0.0.0.0”)
{
Debug.Print(“Waiting for DHCP”);
Thread.Sleep(250);
}

Another one:
netif = new EthernetBuiltIn();
netif.Open();
netif.EnableDhcp();
netif.EnableDynamicDns();

while (netif.IPAddress == “0.0.0.0”)
{
Debug.Print(“Waiting for DHCP”);
Thread.Sleep(250);
}

How do I use these two functions?
Thanks,
Jian


#4

It is up to you of what you want to connect. Can you tell us more on what you are trying to accomplish?


#5

I have designed a board following the G400-D Dev Board schematic. I copied Ethernet connection between J0011D and G400-D SoM controller. I want to write a small code to test if the Ethernet hardware works.


#6

Then you are using the built in networking inside G400, not the ENC28J60.


#7

Then how do I test Ethernet?


#8

you use the section that talks about “built in” networking not the ENC28J60! Same Document @Mike pointed you at.


#9

OK. I change the code as such, what do I do next to test hardware? Sorry I am new to networking stuff.

using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Net.NetworkInformation;
using System;
using System.Net;
using System.Threading;

public class Program
{
private static WiFiRS9110 netif;

public static void Main()
{
    NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
    NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;

    netif = new EthernetBuiltIn();
    netif.Open();
    netif.EnableDhcp();
    netif.EnableDynamicDns();

    while (netif.IPAddress == "0.0.0.0")
    {
    	Debug.Print("Waiting for DHCP");
    	Thread.Sleep(250);
    }
    //The network is now ready to use.
}

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)
{
    Debug.Print("Network availability: " + e.IsAvailable.ToString());
}

}


#10

So how can we test your hardware when you don’t have a working reference?

And what is the result of using your test code?


#11

If I just use G400D Dev board only, if the Ethernet section hardware is good, I print PASS. Otherwise print FAIL in the emulator. Is it possible to do that? Or I have to use Ethernet cable to hoop up the Dev board into Ethernet network to perform the test?


#12

your code has these debug statements. They should produce output. What do they produce?

You talk about the emulator - sorry, I thought you said that you were doing this with hardware?

To test ethernet, you need to connect your device to a network. The code above uses DHCP. If you get a DHCP address, it will tell you with those debug statements. If you don’t get a DHCP address, is your hardware at fault or is your network (DHCP server) at fault? That’s why having a KNOWN WORKING test hardware platform, including known working test code, is important.

So start simply. What network are you connecting to. Do you have DHCP enabled?


#13

I will plug in the board with cable at my work ethernet. You mean the code I have will print out the IP address after I plug into the network with cable? It is DHCP network.

Also the code I have use:" private static WiFiRS9110 netif;" it is not WiFi and I am using builtin ethernet, how to declare netif?


#14

corporate networks may have additional security that means you can’t just “plug it in” and expect it to work. Ideal would be a home network that has a simple DHCP. But test it out and see.

yes, you do not have to declare it as the wifi object. Use VS to explore the correct object, or look for example code that includes more detail in that area.


#15

If you are building a commercial product you need someone to assist you in the testing. This forum is not the best place to validate a commercial product.


#16

Where do i go to get support directly from G400-D Dev board vendor?


#17

www.ghielectronics.com to engage their consulting services

You can still work along here with the community assistance here, but to me it seems like you’ve bitten off too much and are too far progressed to be able to work through this on your own with minimal direction here


#18

I’ve done something similar. Print to the LCD if the Ethernet cable is connected and do a fetch from www.google.com and if I get a reply, Ethernet is working.


#19

Does the code you provided compile? You have a wifi object but then initialize built in ethernet on it!

You need
private static EthernetBuiltIn netif;

Were you able to deploy your project to your board? and you see messages in the output window? If not then please make sure you get a simple project example working first before trying networking. This would be a good starting point http://docs.ghielectronics.com/software/netmf/getting-started.html


#20

Thanks for the help! It passes compiler. I will contine after I get the board.