Ethernet controller ENC28J60 not working with Arduino Nano nor Mega

arduinoenc28j60ethernetspi

I have a problem with running ENC28J60 with Arduino with EtherCard.h.
This is the device I use: http://img20.allegroimg.pl/photos/oryginal/36/70/08/91/3670089168
This is the library and examples: https://github.com/jcw/ethercard
I use Arduino IDE 1.5.4 on Windows. The library and skeches compiled without any errors.
I tried connecting ENC28J60 to Arduino MEGA 2560 this way:
GND GND
VCC 3.3V
SO Pin50
SI Pin51
SCK Pin52
CS Pin53

The LEDs on the RJ45 were active (green on, yellow blinking), but example DHCP or static IP failed or showed IP 0.0.0.0. Router detected the new device but the device did not responded to pings.
I tried the modified example with modified line:

if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
Serial.println( "Failed to access Ethernet controller");

Where pin 53 is specified in ether.begin() function – with the same result.
Then I tried connecting ENC28J60 to Arduino Nano this way:

VCC 3.3v
GND GND
SCK Pin 13
SO Pin 12
SI Pin 11
CS Pin 8

But then the LEDs on RJ45 blinked during connecting ethernet wire, and went dark.
The red LED on ENC28J60 was on during above experiments.

I would apprieciate any help. I found many projects with google were people use ENC28J60 + Arduino Mega/Nano without a problem. I think that the EtherCard library version may not work with the latest Arduino IDE I have but then I don't know what version should I use, or maybe should I use some other library.

I need the ethernet controller for serving simple web page allowing changing the state of relay ON/OFF.

Some update:

After some debugging I can see that the code hangs in this line:

while (!readOp(ENC28J60_READ_CTRL_REG, ESTAT) & ESTAT_CLKRDY)
    ;

in enc28j60.cpp file.
I suspect that I have faulty enc28j60 module.

Best Answer

It turned out that the the ethernet module module was faulty - the smd enc28j60 chip wasn't properly soldered to the board. After pressing it really hard to the board everything started to work properly, but the quality of the above module is really poor if such faults weren't detected during production.