Pages: [1] 2 3   Go Down
Author Topic: Testing homebrew ENC28J60 Ethernet interface  (Read 10326 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all,

I need some help testing a homebrew ENC28J60-based Ethernet interface. It's on a custom PCB with an "Arduino" and some other circuits. I assembled the PCB and tested it one circuit at a time, so I know there are no faults elsewhere.

I used this schematic:

http://www.nuelectronics.com/download/projects/Ethernet_v1_0.pdf

Seems to be what most retail ENC28J60 shields are built from.

I'm using this library:

http://blog.thiseldo.co.uk/wp-files/etherShield-1.1.zip

from here:

http://blog.thiseldo.co.uk/?p=344

Right now I'm stuck at the most very basic level - getting ANY sort of sign it's operating.

I can power the board up and nothing catastrophic happens. Testing voltages, things look OK - I get 3.289v at the 3v3 regulator, and at the appropriate Vin pins on the ENC chip. I get 2.8v on the 2.5v pin on the ENC chip (that the external cap is connected to). That's a bit high but doesn't seem outrageous. I get .54v on one pin of the 25mhz crystal, and .2v on the other pin. Not sure if that's meaningful or not. No obvious shorts, solder bridges, bad joints, or other "failures" from a hardware perspective. The chip gets barely lukewarm when powered on.

If I load the simple web server sketch included in the library above, plug the device into my router and give it a static IP, nothing happens. I can't see the web page in a browser, and the device does not show up in my router's admin console.

So, I'm not sure where to troubleshoot next. Are there any other obvious things I can check on the hardware? Should I check for certain voltages on the RJ-45 jack? Is there a simpler sketch I can check via software? A sketch that will just get it to respond to a ping? I have only casual knowledge of networking hardware and software so I'm honestly not sure where to look next.
Logged

Somewhere in the Sonoran Desert
Offline Offline
Full Member
***
Karma: 1
Posts: 108
"This was not intended to be a factual statement."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You say "plug the device into my rounter and give it a static IP," where are you assigning the IP address? at the router? I don't think it supports DHCP so the IP address has to be hard coded.

Looking at the example sketch, the address appears to be 10.0.0.25. Have you tried that address? or modify the following lines:
Code:
static uint8_t myip[4] = {
  10,0,0,25};
for the address you want.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

See, this is where my knowledge starts to fall apart.

Indeed, I have the sample sketch set up as follows:

Code:
// please modify the following two lines. mac and ip have to be unique
// in your local area network. You can not have the same numbers in
// two devices:
static uint8_t mymac[6] = {
  0x00,0x00,0x00,0x00,0x00,0x00};
  
static uint8_t myip[4] = {
  10,0,0,25};

My router is configured as follows:



Clearly I'm not an expert - is the router configuration not required? My confusion is as follows. If I assign an IP address in the sketch, then plug the device in to the router, how does the router "know" to direct traffic to the device unless I make the static lease on the router? Again though I don't know if this is sound reasoning or not.

All that said, I have tried browsing to the IP assigned via the sketch and nothing happens. I never even see the little status lights on the RJ45 jack light up. If I look at my router's status page for the WAN, a list of "active clients" is displayed. My device never shows up there.

Which is why I'm stuck - I don't know if the problem is a hardware failure or software failure, and I don't know enough about either to troubleshoot, hence my pleas for help!
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 1
Posts: 290
(:-)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the sketch you have to fill in the mac adress of your ecn28j60 chip (hardware adress) and an ip adress in the same range as your router.
Should look simular to this: 00-15-EA-CC-A8-9A (might be no dashes)

On windows open a command prompt window Start --> run type: cmd <enter>

now type: ipconfig /all

note the ip adress off you pc e.g. 192.168.1.34

now in you sketch give it a simular adress e.g. 192.168.1.50

You don't need to modify anything in the router.

If a device doesn't know how to connect to another device on the network it basicly shouts hey does anybody know xxx.xxx.xxx.xxx (broadcast) If some replies with right answer, the answer is stored in a table for the next time to use.

you can use the "ping" command to see if a device is active.

« Last Edit: July 30, 2010, 08:09:46 am by wortelsoft » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some progress but still no love. I found nu's own library:

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4

it has a "ping" example that, if I am reading the code correctly, should be blinking the status lights during the setup function at the beginning of the sketch. I get no blinks. Still doesn't tell me exactly what the problem is, but seems to confirm that it is very low-level.
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 1
Posts: 290
(:-)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you change the mac adress in you sketch to something different then zero's?
Logged

0
Offline Offline
Newbie
*
Karma: 4
Posts: 42
Arduino rocks - Yeah Baby!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi ill_switch,

Quote

This is my site and an updated library that I have created.

If you have made a custom board based on the nulectronics ethernet shield then this should, in theory, be fine. However, I have only tested it with arduino (decimilia, deumilanove and freeduino) boards as this is all I have acess to.

Making sure that your sketch is setup corectly with a proper mac address as per the examples and a unique IP addres within your network will be required.

If you use the original nuelectronics library with the basic ping example then this should enable another computer to 'ping' the arduino and prove that your ethernet hardware is actually working.

Also check the lights on the ethernet socket as these should show if its detected a link up. Also the initailisation part of the original nuelectronics sketches flash the 2 LEDs so this would be an indication that the code is actually controlling the ENC28J60.

Hope this helps

Cheers

Andy  smiley-grin
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Andy, thanks very much for following the comment I left on the blog and commenting here.

I've found the problem - thanks to inconsistent naming standards in my Eagle project, two of the pins on the IC are not actually connected to the corresponding Arduino pins (CS and RESET).  >smiley-sad Will fix this and test again. Fingers crossed that it suddenly starts working. If not, at least now I can use this thread to get help.

Thanks all for the help.
Logged

Somewhere in the Sonoran Desert
Offline Offline
Full Member
***
Karma: 1
Posts: 108
"This was not intended to be a factual statement."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree that if you are running the ping example that the LEDs should at least flash twice during setup regardless of what else is going on.

So, that leaves two possible problems, a hardware fault and/or software. Since the software is known to work elsewhere, I think for now we can assume the problem is either the software not loading properly or a hardware fault.

I guess I would start by looking to make sure the ENC28J60 is not reset, is selected, and serial data is present between the Arduino and the ENC28J60.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I found two problems with the hardware - the CS and RESET pins from the ENC28J60 were not connected. I've fixed that, but still nothing - no blinks, no pings, no web page, etc. - when I try the various example sketches mentioned in this thread. I've tried different MAC addresses and am using an IP that's valid on my router, but I'm convinced the problem is "before" any of that, as the nuelectronics "ping" sketch still does not get the lights blinking.

Can someone with knowledge of either of the libraries mentioned here (Andy's or nuelectronics') give me some direction on low-level troubleshooting? How do I check that the ENC is being properly initialized? Or for communication between it and the AVR? In other words, how do I do this:

Quote
I guess I would start by looking to make sure the ENC28J60 is not reset, is selected, and serial data is present between the Arduino and the ENC28J60

Besides being my first homebrew Ethernet interface, this is my first homebrew use of SPI.
« Last Edit: August 04, 2010, 09:28:45 am by ill_switch » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the nuelectronics schematic, there is a component R5 that is a 10k pullup resistor from the RESET pin on the ENC28J60 to 5v. The schematic has it labeled "10K DNP" - I'm wondering if DNP means "do not place?"

Other schematics for using this chip with Arduinos (i.e. Seeedstudio's) have that resistor there, so I'm confused.
Logged

Somewhere in the Sonoran Desert
Offline Offline
Full Member
***
Karma: 1
Posts: 108
"This was not intended to be a factual statement."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As for R5, it is not needed if you have RESET connected to your Arduino thru J4 as there is a pull-up resistor connected to that net on the Arduino. RESET on the ENC28J60 also has a weak internal pull-up which should assure proper operation even if disconnected.

As for my early instructions:

ENC28J60 is not reset. Simply measure the voltage on pin 10 5V=not reset. 0V = reset. This should go low when you press S1 on the Arduino.

(Here I have to ask what package type is the ENC28J60, the QFN "square" package has a different pinout than the SPDIP, SSOP, SOIC "rectangular" versions. If you are using the nuelectronics schematic you must use an SPDIP, SSOP, or SOIC).

You will need an oscilliscope for the others. While Arduino is trying to communicate with the ENC28J60 (i.e. when you first initialize it). You should see CS (pin 9) go low briefly as communications is attempted. You will also see a pulse train on MOSI (pin 7) and SCK (pin smiley-cool during initialization.

You could modify blink to use this pins and toggle them slowly so that you can see it with just a voltmeter. This would at least let you know the pins are connected correctly.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I'm seeing some behavior I'm not sure about. Using the "ping" sketch from nuelectronics posted above.

When the Arduino boots, I see CS at 5v. When the command to initialize the ENC is executed, it jumps down to ~3.1v and hangs out there from that point on.

The reset pin (pin 10) pulls low when I upload code, but is at 5v otherwise.

I haven't checked the data lines, the only scope I have is the cheapy digital kit Seeed sells, not sure if that'll be "good" enough to see anything, but I'll try it.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, got the scope out. Around the time it initializes, I see pulses on the MOSI line. These continue ad infinitum. MISO appears to be dead flat the entire time, though I may be using the wrong configuration on the scope to see anything that's there. SCK has pulses that look similar to the pulses on MOSI.

RESET and CS I explained above. INT stays at 5v all the time.

I think that's pretty much all the connections between the Ethernet circuit and the Arduino. Can anyone shed some light on the subject as a result?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 29
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Ill_switch,

I just built up the same ENC28J60 / ATmega328 combination on breadboard yesterday and initially tested it with the NuElectronics code.  Here's some tips - where I went wrong.

1.  Make sure that the 5 Vdd and 4 Vss pins on the ENC28J60 are all connected.
2.  Make sure that your 3V3 regulator can supply enought current - the first regulator I used suffered extreme voltage droop when I connected 3V3 to the mid point of the 50R Tx network termination resistors.
3. Make sure that you have lots of 100nF decoupling on the ENC28J60 and a good 10uF minimum reservoir cap on the 3V3 rail.
4.  Recheck all your SPI bus wiring. There's only 4 wires but make sure that /CS is correct, MISO and MOSI. If you are using a 74XX08 as the level shifter make sure that it is powered from 5V.

When you reset the '328 the ENC28J60 should be reset too - join the reset pins together.

The yellow and green leds will flash twice if the '328 is correctly talking to the ENC28J60.

The NuElectronics server worked fine as soon as I sorted out my lack of 3V3 current. I then loaded Andy Lindsay's Pachube Client code that I had running on the Nuelectronics shield - and that works fine too.

There's not much to go wrong, but invariably it will be a wiring fault or a missing connection.

I've done a write up here.

http://sustburbia.blogspot.com/2010/08/arduino-compatible-web-server.html


Good luck in getting it to work - you really won't be far off having it run.



G.
Logged

Pages: [1] 2 3   Go Up
Jump to: