Pages: [1] 2 3   Go Down
Author Topic: Interfacing with the ENC28J60  (Read 9236 times)
0 Members and 1 Guest are viewing this topic.
Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there, so I've set up an ENC28J60 with a MagJack connector. Built my first PCB to breakout the MagJack smiley-grin I used the code and circuit described here. As far as the ethernet link is concerned it seems to work (both leds on the switch and the device light up when I plugin the cable). Now I'm trying to get µIP working properly. Everything seems to compile just fine (adapting it slightly to work with the API). Sadly nor the UDP or ICMP program work. Everything times out (the µC never answers). The Arduino seems to behave very weirdly and seems to reset every so often which is weird. I have a Rev B NG, and the ENC28J60 communicates over SPI, I wonder if this could be the cause (pin 13's led is always faintly lighted up).

You can find the code here.

I really wished I knew what was going on :/

Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't remember which rev mine is, but it sounds like the same problem I had, described in this thread.

-j
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll see, I'm now testing with another driver/ip stack. I finally got Procyon AVRLib to build along with the makefile for the arduino. I'll post an update when I advance a little more.
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I'm still having issues. I'm trying to use AVRLib's net stack libraries but I can't see to add them to my sketch (either in the IDE or the Makefile)... any help would be appreciated!
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Torino, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino really rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am very interrested in this project. I just got 3 ENC28J60 sampled  smiley-razz
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok so the code is up and running. At the moment I seem to have some problem interfacing with the ENC. At least it's some progress.
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I seem to be having problems interfacing with the ENC. The reg dump doesn't seem to work properly. You don't really need the magjack for this, pm me if you would like a copy of the latest code.
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I tried the pin 13 option and changed the resistor. That's not it either :/
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I had similar problems trying to get the (ever-in-progress) Arduino ethernet working.  I could compile and upload code using the AVRlib enc28j60 library just fine, but it never seemed to respond to pings.  Please post if you make any progress.  smiley
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok so I can confirm I can read the revision ID (register 0x312, that is register 12h of bank 3) albeit two things strick me. The first is that the register was previously defined as "(0x12|0x60)" which definitely does not make 0x312. The second is that all the bits were inverted. I had to ~ in order to read the proper revision id. Do you believe that's normal?
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was reading the datasheet and this came to my eyes. What do you think? Had you guys tried this, was the ethernet prototype running at 3.3v or is this just not an issue?


« Last Edit: September 12, 2007, 05:46:35 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm pretty sure it's got something to do the 3.3V to 5V conversion.  Not sure exactly what.
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And I'm pretty sure it's not, although it might well be a side issue, the level shift is probably a good idea in prod cause 3.3v is really on the logical edge for an AVR running at 5v. I can confirm that I have received packets on the AVR! I wouldn't say it's up and running, but it seems to work. To be honest I'm not sure what I did. I cleaned up around the code. Part of the problem was me being an idiot and declaring the ports "absolute" binary values when the sbi/cbi method is used throughout.
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I couldn't just leave it at that.... here is some debugging info from the Arduino to satisfy your geek desires!

Code:
Initializing Network Stack!
Initializing Network Device
Initializing ARP cache
Initializing Addressing
Net Stack is up!
cmd> Received packet len: 64Packet Contents
     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F  0123456789ABCDEF
     -----------------------------------------------  ---- ASCII -----
0 [ch65533] [ch65533] [ch65533] [ch65533] [ch65533] [ch65533]   [ch65533] [ch65533]  [ch65533]     [ch65533][ch65533][ch65533][ch65533][ch65533][ch65533]..[ch715].[ch65533]....
16        [ch65533] [ch65533]  [ch65533] [ch65533] [ch65533]    ........[ch715].[ch65533][ch65533]..
32       [ch65533] [ch65533]  ~        ......[ch65533].~......
48             [ch65533] [ch65533] [ch65533] [ch65533]  ............[ch31341][ch65533]
NET Rx: ARP packet
Received ARP Request
ARP Packet:
Operation   : REQUEST
SrcHwAddr   : ::[ch65533]:[ch65533]::[ch65533]
SrcProtoAddr: [ch65533].[ch65533]..
DstHwAddr   : :::::
DstProtoAddr: [ch65533].[ch65533]..~
Sending ARP Reply
ARP Packet:
Operation   : REPLY
SrcHwAddr   : C:0:F:F:E:E
SrcProtoAddr: [ch65533].[ch65533]..~
DstHwAddr   : ::[ch65533]:[ch65533]::[ch65533]
DstProtoAddr: [ch65533].[ch65533]..
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just noticed that out of the 3 copies of the drivers, two are pretty much the same and implement the ENC28J60 Rev.B4 errata... Not Rev. B5, which is the same as my chip, if I read EREVID – and seems to be anything manufactured >= 2006. Had you guys worked these out or where you running on version 4? Because there are a few more erratas in rev 5 for Rx/Tx and mostly in Half Duplex sending!

EDIT: As far as I can see, errata #12 and #13, which both affect transmission have not been fixed yet.
EDIT++: Sorry I forgot the link http://ww1.microchip.com/downloads/en/DeviceDoc/80264d.pdf.

« Last Edit: September 13, 2007, 04:36:15 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

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