Go Down

Topic: Connecting ENC28J60 to an arduino (Read 1 time) previous topic - next topic

Thomas Hodnemyr

I recently bought this breakoutboard.

But im having a hard time understanding how to interface it. I understand its an SPI device, but the Nueltronics' shield and schematics include a SN74HCT08D(QUAD 2-Input AND gate). Is this needed to connect it properly?

Any help or links would be much appreciated.

-Thomas

majenko

Funnily enough, I just spent all yesterday building one of these from scratch on a protoboard.

I'm not sure if the AND gates are really needed.  They are used to boost two of the signals (INT and MISO) up to 5V, but the Arduino should work perfectly fine with 3.3V inputs.

I added the AND gates on mine, but I am tempted to try it without.

Oh, and the library doesn't work on 1.0 without some small modifications. (changes to header files - remove avr headers and add Arduino.h)

Thomas Hodnemyr

What a coincidence!
Would you mind sharing your knowledge on how you connect it? Im really rather new to the whole hardware side of electronics.

majenko

#3
Jan 14, 2012, 11:39 am Last Edit: Jan 14, 2012, 11:41 am by majenko Reason: 1
You connect it as per the schematic.  MISO, MOSI and SCK are connected as per any SPI device (see the Arduino pages for the pinout for your deivce).  The INT connection pin goes to (on the UNO) digital pin 2. CS goes to digital pin 10.  Note, this may differ on other Arduinos and Arduino clones.

Here's my build of it:



The extra black box is the magnetics - I didn't have a magjack, so I had to use the traditional method ;)

If you decide to implement the AND gate (it may be needed, I'm not sure), then the pinout of a typical and gate chip is:



Connecting the two inputs of a gate together basically turns it into a level shifter,  Link pins 1&2 and connect them to the INT connection of the ethernet card.  Pin 3 then goes to D2.  The same with pins 4&5 to SDO and 6 to MISO.  Pin 7 is ground, and pin 14 is +5V.

MarkT

An example known-good schematic using the ENC28J60 is the Nanode, which is open source hardware, details here: http://solderpad.com/monsonite/nanode/   They use a level shifter for the ENC28J60's SO output to drive MISO, and its tristate controlled from the pin used for chip select...  Perhaps the ENC28J60 doesn't obey the SPI protocol?  Check the datasheets.
[ I won't respond to messages, use the forum please ]

winkleink

I have the same board (thanks Santa)
I read up on the different voltage levels of the board and the Arduino as well as on using the ethercard or EtherShield library.

In the end based on advice from http://www.electrodragon.com/?p=1112 I just wired it up directly and it works perfectly.
The ENC28J60 is tolerant of the 5V from the Arduino and the Arduino is tolerant of the 3.3v from the ENC28J60.

I did a bit of a blog post on the wiring needed for the different libraries here.  This explains how to wire up for the nuelectronics library and also the ethercard library.
http://winkleink.blogspot.com/2012/01/arduino-enc28j60-ethernet-module-part-2.html

I hope this helps.
Albert.

majenko

I have embarked on a complete re-write of the library for the ENC chip.  I aim to make it support multiple connections to multiple ports concurrently - much more socket library like, while still  maintaining the object-orientated goodness of C++.

It's not a small task, but worth it I think.  I'll keep you posted.

Go Up