ENC28 - DHCP Issue

I’d like to show you the issue that I got when I try to retrieve IP Address via DHCP using the ENC28J60 module.

I’d like to point out that when I set Static IP I didn’t have issues.
But when I call the function “EnableDhcp()” in about 3-4 minutes my DHCP server dies because the ENC28J60 module continues to ask an IP Address, receive a valid IP Address from DHCP server and then releases it (without a valid reason). After that the ENC28J60 module restarts to ask another IP Address and so on… After few minutes the DHCP server has no more free IP Addresses and the LAN become locked.

Another thing… Why I say that the problem is in the ENC28J60 module?? Because I have this issue only using FEZ Cobra 2 Net and FEZ Cerberus and, both mainboards, uses the ENC28J60 module. When I use FEZ Spider (that uses J11D module) the DHCP works properly.

Is this a new issue or is a known issue?
Any ideas?

@ BigFoot - What firmware version do you use?

@ RobvanSchelven - Mainboard FEZ Cobra 2 Net.

Loader (TinyBooter) version information: on this computer. on this device.

The Loader (TinyBooter) is up to date. <<<

Firmware (TinyCLR) version information: on this computer. on this device.

The Firmware (TinyCLR) is up to date. <<<

@ BigFoot - I haven’t seen this behaviour. Do you change your mac address in code? Maybe you can show some of your code

@ RobvanSchelven - I set mac address with FEZ Config just after I bought the mainboard, never more.
This is a simple VS2012 gadgeteer project that shows the code I wrote: http://speedy.sh/cHJFs/GadgeteerAppEthFezCobra2Test.zip

The issue occurs also when I run this project.

Can you also tell us what device is handing out DHCP addresses? Is this your home router, and if so what brand and model is it? Do you have netmon/wireshark that you could capture the dhcp requests and responses ?

Could be other problem, but …
DHCP requires a MAC to assign an IP.
Just for fun, set the MAC (Eth1.NetworkInterface.PhysicalAddress) before starting.
There was a thread or two about the config program not doing this correctly.

I suspect that this is due to a non valid MAC…

please try my code below to set a valid MAC address:


and let us know if that solves your problem…


@ Brett - The device that distributes IP addresses by DHCP is a FortiGate 60C by Fortinet.

@ Lurch @ Jay Jay - I tried to set MAC address by using the Jay Jay’s code linked above but the issue persists…