ENC 28J60 ethernet module with arduino

I recently bought an ENC 28J60 module from geeetech. They offered a download for drivers and examples for arduino, but it turned out there were two grave snags:

My debian system had gcc-avr v 4.7.x, there are some resent changes that means that some of the arduino code does not compile. I was told that:

/usr/share/arduino/libraries/EtherCard/tcpip.cpp:459:20: error: variable 'c' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

I don’t care if it is an error in the compiler or in the arduino system (as it was discussed on some lists), to get it to work, I just downgraded the compiler to version 4.3.5-1 (if you are using another system, you must download it from somewhere else). Then I installed it with sudo dpkg –install <package>. avr-libc should be dowgraded to 1.6.8 (the compiler worked without downgrading the libc, but that made further upgrades of the system impossible). To make those downgrades survive later system upgrades, pin them in /etc/apt/preferences.d/avr which should contain


Package: avr-libc
Pin: version 1.6.8*
Pin-Priority: 1001

Package: gcc-avr
Pin: version 4.3.5*
Pin-Priority: 1001

It also turned out that the code from geeetech was pre v 1.0 of the arduino SDK. Editing some code and adding in the WConstants.h and wiring.c and wiring.h from v 0.23 of the arduino SDK, i got it all to work (at least so far).

My working library can be found here : ENC28J60.tar (132k) (git repo so my changes can be seen)

This works fine with the examples where the arduino acts as a server. I have still not managed to get it to work as a client.

ENC28J60 ethernet module connected to an arduino.The markers onthe PCB may be a tad confusing. Vcc is the leftmost connection at the closest end. (red),

ENC28J60 ethernet module connected to an arduino.The markers onthe PCB may be a tad confusing. Vcc is the leftmost connection at the closest end. (red),

I am now connecting the 28J60 to the arduino using a ribbon cable (Split an old floppy disk cable to have just 10 conductors) The connections will then be:

# Arduino pin 28J60
1 GND GND
2 3v VCC
3 RST RESET
4 D10 CS
5 D13 SCK
6 D11 SI
7 D12 SO
8 n.c WOL
9 D2 INT
10 n.c CLKOUT
This entry was posted in arduino, Data. Bookmark the permalink.

1 Response to ENC 28J60 ethernet module with arduino

  1. Pingback: Arduino – temperature webserver | Mortens meninger

Comments are closed.