Hello,
I need a simple task: start the ENC28 on my Cerbuino, and get an IP from DHCP.
Quite simple, but I cannot complete it
Iāve looked for samples and forum but really nothing was clear.
Someone from GHI can provide me some way to get it?
Dim interfaces() = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
Try
Dim eth1 = interfaces(0)
If Not eth1.IsDhcpEnabled Then eth1.EnableDhcp()
Do
eth1 = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0)
Thread.Sleep(1000)
Loop Until eth1.IPAddress <> "0.0.0.0"
IsNetworkRunning = True
Catch ex As Exception
IsNetworkRunning = False
End Try
I can ping the board (after a while, and sometimes after detach and reattach the cable)
With DHCP still always 0.0.0.0
My DHCP server is ok. Iāve also changed switch port and also cable to be sure.
If your code works, it really has no sense.
p.s. Canada? You are really lucky: itās so beautifulā¦
Iāve found that my DHCP server is releasing IP address when I switch to eth1.EnableDhcp. I can found the MAC addresses reported by eth1.EnableDhcp in my release table.
Se the problem is that the board doesnāt āload itāā¦
Question: may I inizialize the ENC28 before to use it? The MAC seems quite strangeā¦
This seems like one of the scenarios that weāve heard (I have it too) where the DHCP lease offered by the DHCP server isnāt working exactly as expected in the netmf IP stack. I donāt think thereās an easy way to diagnose this without network traces to check the responses - I also donāt have a link to the work item or the thread here that talked about it (will update this post if I can find them). Edit: hereās the thread that has some insights http://www.ghielectronics.com/community/forum/topic?id=12032&page=2 edit2: this is the only work item I could find that had 4.2 DHCP relevance https://netmf.codeplex.com/workitem/1655 so Iāve added the above thread to the comments and voted.
Iāve assigned a MAC address to my board but this didnāt change anything. The board doesnāt load the IP assigned by my DHCP server.
Iād I statically assign the address, it works.
I also voted to the thread. However itās incredible I cannot create an object that is plug-and-play on networks using this kind of devices. MS: what a great framework!
@ Baz, the framework took the lwIP implementation lwIP - A Lightweight TCP/IP stack - Summary [Savannah] in the 4.2 version, and therefore I suspect that the framework is a victim of a potential issue here - and before anyone pipes up, yes I work for Microsoft (not anything to do with netmf) so obviously I am somewhat protective, but itās important to delve into this reported problem in the correct way.
Can someone share their test code? I have an ENC28 on the way so I can test my Cobra2 with wired and with my (failing) router and help collect more information
@ baz - I experienced same problem on custom board, but with Cerberus firmware.
Problem was with INT pin on the board. Make sure that pin is available and not reserved for other features.
Also make sure that SPI works correctly.
You can test it with SPI loopback.
Connect a wire between PB5 and PB4 pins.
Create a project āExample 1ā from http://www.ghielectronics.com/docs/14/spi.
Add some data in tx_data array as
tx_data[0]=44;tx_data[0]=55;
and etc.
Insert breakpoint at
MySPI.WriteRead(tx_data, rx_data);
In rx_data array data should be the same as in tx_data
Dim interfaces() = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
Dim eth1 = interfaces(0)
Dim mac As Byte() = {&H0, &H88, &H50, &HB2, &HDE, &HD3}
eth1.PhysicalAddress = mac
If Not eth1.IsDhcpEnabled Then eth1.EnableDhcp()
Do
eth1 = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0)
Thread.Sleep(1000)
Loop Until eth1.IPAddress <> "0.0.0.0"
In fact the second access to GetAllNetworkInterfaces is not required, it was just a test to see if there was some problem updating internal objects references.
thank you for assistance and for your clarification
No
Iāve tried to understand your suggestion, but I simply have the Cerbuino connected to the ENC using the provided cabled gadgeteer cable. So pins and so on are connected using that cables.
However the NIC works well, just the DHCP doesnāt load received address, so I think that connections and other similar things are ok.