This is my first encounter with arduino nano and the ethernet shield and I have run into a problem. Actually there have been a few, like arduino nano not being recognized by windows when the shield or even external power were connected.I solved that by shorting the test + agnd pins on the ftdi chip. But then I bumped into something else, either related to the library or it could be a faulty shield I guess :~
I have tried whatever examples in these libraries related to dhcp, ping, webserver. I tried letting the dhcp assign an ip as well as trying a static one. The shield never became visible in my dchp table and all the ping attempts fail. On the webserver example, typing the ip on my browser yields nothing. Though I can see that shield and router are communicating because router's led blinks at the same time with the one on the shield. (if this can be indication of anything). However the shield is never assigned an ip. At least a correct one, when I tried to serial.print the ip, it always gives back 5.5.5.5
All the examples and tutorials I have found on the web are very simple and straightforward which makes me think it could be a faulty shield. Any help or push in the right direction would be appreciated.
Power supply
You need a multimeter to measure the voltages.
Is the Nano running at 5.0V ?
Is the Ethernet Shield running at 3.3V ?
Are the voltage regulators getting hot ?
Connecting the shield
Do you know which pins are used ?
For example the SS (or Chip Select) can be any pin. That pin is used in the library and must match the hardware.
Do you have a schematic of the shield, if not, why did you buy it :~
Sketch
I tried a few libraries, and I think the Ethercard library is the best. It's the only library for the ENC28J60 that is good.
You should know if you are actually communicating with the ENC28J60 chip.
Try to see if a functions returns an error and print a lot to the serial monitor to see what is going on.
power supply
The voltage regulator was indeed getting hot. Even though it was a 6v power supply, I measured a 10 volts output But the nano's 3.3v and 5v pins were giving out what they were supposed to. Anyway I changed it to a 5v power supply(measured it beforehand this time) and now it doesn't get hot any more.
Connecting the shield
I thought the library provided by the seller would be configured for the specific shield at the very least. I found this schematic, I will try to match the pins.
Sketch
I have run test codes, which yielded no result, not even errors. As if the nano was not communicating at all with the enc28j60. I will see what I can achieve with matching the pins and get back.
Those wall wart adapters have a much higher voltage with little load. They are constructed that way on purpose (less iron for the core to be cheap, and shortcut proof). That's why I prefer a DC-DC converter in combination with those wall wart adapters, the DC-DC converters take a wide range of input voltage and are very efficient.
As far as I can see, the /CS (Chip Select) is connected to PB2. PB2 is Arduino pin 10, and is the SS pin, which is the normal pin for the ChipSelect of the SPI bus.
The Ethercard uses CS at pin 8 as default.
I forgot how to change that, if you can not find it, let me know or send me a personal message.
Oh, thanks for the wall adapters info. Will keep in mind.
I took a look at both libraries. The ethershield library was correct, using digital pins 10,11,12,13 for cs, mosi, miso, sck respectively. The ethercard as you pointed already, uses pin 8 for the cs. I read somewhere that the cs can be any digital pin, or is that wrong? Anyway, I don't know how to change the pins in the ethercard library so your help would be appreciated Though I doubt it would make a difference at this point, because the ethershield library should have worked in the first place
Do you know if there is some low level test code (without including libraries) to test if the enc28J60 is communicating with the nano?
// Use the default of pin 8 for ChipSelect.
// if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
// Serial.println( "Failed to access Ethernet controller");
// Use your own pin for ChipSelect. Set to pin 10.
if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
Serial.println( "Failed to access Ethernet controller");
The 'begin' function has a third parameter for the ChipSelect.
If that third parameter is omitted, it is automatically set to pin 8.
Perhaps you could use 'SS' instead of '10', but I'm not sure.
A test function is that "ether.begin" function. You get the "Failed..." message if it failed. I don't know any better way to test what is working and what is not working.
Thanks erdin! I think this is a step to the right direction
After I added the parameter 10, or as you said SS, to ether.begin, I finally see some output :D:D:D
[testDHCP]
MAC: 74:69:69:2D:30:31
Setting up DHCP
DHCP failed
My IP: 0.0.0.0
Netmask: 0.0.0.0
GW IP: 0.0.0.0
DNS IP: 0.0.0.0
Setting up the dhcp takes a good one minute, and then it fails returning all zeros.
But trying to access the above ip, gives "The connection has timed out."
So what I gather is, for the ethercard library, the cs needed to be changed to pin 10. The rest of the pins should be correct though. What would be the next step? :S
I changed the cable, router is working fine (unless it's somehow incompatible with ethercard lib, which I doubt), checked the circuit board (nothing that stands out). I even tried using arduino uno like this:
Well at least I learned a few things during this fruitless attempt, thank you Erdin :P. When I get a new shield in my hands, and hopefully get it working, I will report back
I checked the schematics again, but there is no extra special 'enable' or so. If the SPI (miso mosi ss etc.) is working the chip should be able to connect to the router.
The shield I have is a module like these :
connected to a Arduino Uno.
I bought a ENC28J60 Nano shield on Ebay, so I can finally put my Arduino Nano into something useful XD
I received the Nano Ethernet Shield today, and it is not working. I have the same problem as you.
It seems a hardware problem because the Arduino can't communicate with the ENC28J60 chip via SPI.
UPDATE: It's working, I was using the wrong ChipSelect pin.
The only thing I changed is adding the pin '10' for the ChipSelect.
if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
Serial.println( "Failed to access Ethernet controller");
Haha, funny how you forgot that while you were telling me about it a few posts above Good thing you got yours working. Mine is still broken and I got a partial refund.
I just received a w5100 ethernet shield for UNO, and I'm about to test it fingers crossed