Main Site Documentation

IP address allocation on FEZ Panda II


#1

Hello,
I would like to assign an IP address to the FEZ Panda without a development tools such as Visual Studio
I mean I would like to be able to, by laptop, conect FEZ Panda and change IP address.


#2

welcome Dylan.

check out the NetConfig project on the codeshare, http://code.tinyclr.com/project/308/netconfig-wiz5100-http-configuration-framework/


#3

Hi Dylan

I believe your unit does not have its own user interface (LCD + keyboard) ?

It is a common issue to be able to configure the IP of an equipment which do not have a direct human interface.
The article referred by Brett is about allowing to change the IP configuration when the unit already has an IP interface and you can access its Web interface (as far as I understand by briefly following the link).

However, there is still a problem when you don’t know the current IP address of the unit.

I have used - and seen used - mainly 2 method :

  1. Serial link : by connecting a RS232 to a PC, you can configure the equipment.
    The simplest is with a terminal emulator and a textual (telnet like) command line
    It can also be wrapped with a graphical app which makes it more transparent to the customer.

1b) The same can be achieved with USB by implementing a virtual COM over USB as more and more PC lacks a real RS232

  1. Raw Ethernet : you can define a protocol in raw Ethernet (which do not require an IP address to be setup) to scan for equipment on the network and discuss with the equipment to inquire or setup its IP configuration.

Hope this helps

br.


#4

The solution Brett provided is a valid solution. If he uses the netconfig-wiz5100-http-configuration-framework his Panda will have ethernet connectivity the moment it’s plugged in and powered on:


#5

Eric

I understand the point. More modern than RS232 :wink:
Is NetBIOS always available ?
Probably ok with all Windows by default.

I believe that you can change the defaults ?
It would be better that default NetBIOS name and default MAC depends on unit-specific values such as serial-number such as http://mygizmo-xxxx-xx/ when the product’s name is mygizmo and its serial number xxxx-xxx (visible on a sticker).

Also it is always good to have a way to revert to defaults if NetBIOS name is changed and lost (end-users are very keen to do this with IP address, names, password etc …).
A powerup while pressing a hidden button for example is a good way of requesting a restore to defaults.


#6

Yes, the defaults can be changed…see below:


*  // Following the default configuration you can adjust to your needs (if flash empty or user ask for default config return
*  // Make sure to respect the correct format, length and allowed characters !
*  public const string DefaultCfg = "PSW=;" //Password string[10] [a-zA-Z0-9.-] (empty = no password): Max Length=4+10+1=15 bytes
*                           + "DN=DefaultConfig;" //Device Name string[15] [a-zA-Z0-9.-] :Max Length=3+15+1=19 bytes
*                           + "NETB=checked;" //NetBios enabled if value "checked" disabled if empty: Max Length=5+7+1=13 bytes
*                           + "MAC=AA-AA-AA-AA-AA-AA;" //Mac address : Length=4+17+1=22 bytes
*                           + "DHCP=;" //DHCP enabled if value "checked" disabled if empty: Max Length=5+7+1=13 bytes
*                           + "IP=192.168.0.10;" //Max Length=3+15+1=19 bytes
*                           + "MSK=255.255.255.0;" //Max Length=4+15+1=20 bytes
*                           + "GTW=192.168.0.1;" //Max Length=4+15+1=20 bytes
*                           + "DNS=8.8.8.8;" //Max Length=4+15+1=20 bytes
*                           + "NTP=pool.ntp.org;" //NTP server string[30] [a-zA-Z0-9.-] : Max Length=4+30+1=35 bytes
*                           + "NTPO=-300;" //NTP time offset from GMT is minutes : Max Length=5+5+1=11 bytes
*                           + "TCP=80;"; //TCP port for the webserver : Max Length=4+5+1=10 bytes


#7

thanks Eric


#8

you’re welcome :wink:


#9

WOW ! thank you all ! it’s all i need !

howeover i try to use the class netConfig.cs but there is a mistake and i don’t know how to fix it.


 while (!Ready) // Loop untill the network is configured
            {   // usefull as DHCP might fail if cable disconnected or server not responding
                try
                {
                    if (GetParam("DHCP").Length > 0) // we are using DHCP
      /*      HERE  =>         */[b]Dhcp[/b].EnableDhcp(GetMac(GetParam("MAC")), GetParam("DN"));
                    else
                    { // static IP                                     
                        NetworkInterface.EnableStaticIP(GetIp(GetParam("IP")), GetIp(GetParam("MSK")), GetIp(GetParam("GTW")), GetMac(GetParam("MAC")));
                        if (GetParam("DNS").Length > 0) NetworkInterface.EnableStaticDns(GetIp(GetParam("DNS")));
                    }
                    Ready = true;
                }
                catch
                {
                    Debug.Print("NetConfig : WIZnet_W5100 configuration failed : trying again in 10s");
                    try { WIZnet_W5100.ReintializeNetworking(); }
                    catch { }
                    Thread.Sleep(10000);
                }

the problem is with “Dhcp”.
Sorry i’m a beginner with C# and FEZ but i want to learn.

( and sorry if i made mistake i’m french ;D )

Thanks.


#10

And what is the problem ?


#11

he told me that " Dhcp " is not in the current context, I think the object is not instantiated.
But I really do not know how to fix it …


#12

< !-- Telling Dylan he is probably missing a #using directive --> :smiley:
<lang = “french”>

Dylan,
Est-tu en train de compiler un des fichiers exemples, ou as tu copier le code dans un de tes programmes ?

En haut d’un code C# is il y a des directives #using qui indique quels modules externes doivent être utiliser et où aller chercher les objets.

Il te manque la ligne #using correspondant au module qui contient la définition de “Dhcp”.


#13

Wow, that sure is a mouth full just to say “he is probably missing a #using directive” :wink:


#14

Yes you were right, it was because of an “using”.
It was this which was missing => #using GHIElectronics.NETMF.dhcp;

But now visual studio say to me that there is a probleme with my hardware …
and when i take it off it says that there is a problem with dhcp …

i don’t know what i have to do …

Thanks for help


#15

Dylan, I’d still suggest you go back to the sample I mentioned earlier that we know works. Then try to deploy it.

There are sometimes issues with VS deploying to the device; the way to deal with that is to hit “deploy” and then reset the panda.

And finally, I’d suggest you confirm that the firmware versions and your PC’s installed SDK version match. Check the “learn how to update the firmware” link on the reply page :slight_smile:


#16

Yes, I also discovered the hard way that if the latest deployed app is blocking or crashing, VS cannot get access to the unit.
Sometimes resetting the board at the proper instant in the process works, sometimes I had to erase the application by reflashing the unit.


#17

Yep, the moral of that story is that every app should have a thread.sleep(timeout.infinite) at the end of it, and if you have tight loops that run lots you should free up the processor for a few msec occasionally with something like thread.sleep(1).

(not Gadgeteer apps though, they handle this in the Gadgeteer app structure)


#18

[quote]Sometimes resetting the board at the proper instant in the process works, sometimes I had to erase the application by reflashing the unit.
[/quote]

Before reflashing, try the erase function in MFDeploy.