Arduino and enc28j60 WebServer

So I want to use the enc28j60 connected like

to use as a web server. I connected everything on a bread board just like his schematic and
have some simple code programmed into my arduino but I am unable to obtain results. The
code I have is just some test code to test DHCP and print out the IP and other information.
I have created a specific MAC address. The code compiles with no error, but seems to get
‘stuck’ at a certain line. The if statement that it is stuck in is below

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)

It appears to not even be testing the condition, like it is not even trying.
I am using the ethercard library.
I have tried my code on the Arduino IDE 0023 as well as 1.0. I am 100% sure that my
circuit is correctly connected. The entire code is below;

#include <EtherCard.h>

static byte mymac[] = { 0x00,0x04,0xA3,0xAA,0x2C,0x7B };
byte Ethernet::buffer[700];
void setup () {
  Serial.print("MAC: ");
  for (byte i = 0; i < 6; ++i) {
    Serial.print(mymac[i], HEX);
    if (i < 5)
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) //code gets stuck here
  Serial.println( "Failed to access Ethernet controller");

  Serial.println("Setting up DHCP");
  if (!ether.dhcpSetup())
  Serial.println( "DHCP failed");
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

void loop () {

If anyone has any ideas why I am not receiving any data please let me know. I followed the schematic from that site and have no idea what could be wrong.

Depending on the board you have, the pin to begin ethernet might be different. begin() takes a third argument so try 8, 9 or 10. I know default is 8 for the library you are using, 10 worked for me.

if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)

I tried to add a third parameter and the code will no longer compile. no matching function for call to 'EtherCard::begin(unsigned int, byte [6], int)'

I still have not resolved the issue, if anyone has any ideas let me know.

Are you using the library from GitHub - njh/EtherCard: EtherCard is an IPv4 driver for the ENC28J60 chip, compatible with Arduino IDE ?

Edit: it looks like you might be using an old library:

Updates by Andrew Lindsay, December 2011:

Add alternative begin with 3rd parameter to specify CS pin to use. Only 8, 9 and 10 are usable. Default without 3rd parameter is pin 8.

So the third parameter was added in the most recent version of the library. I had your same problem and this fixed it, and now I have DHCP etc. working as normal.

Thanks djdevin.

I had the same problem with my board. Now it works, by specifying the CS pin (duh) . I only have to make the dhcp start working.