So I want to use the enc28j60 connected like
to use as a web server. I connected everything on a bread board just like his schematic and
have some simple code programmed into my arduino but I am unable to obtain results. The
code I have is just some test code to test DHCP and print out the IP and other information.
I have created a specific MAC address. The code compiles with no error, but seems to get
‘stuck’ at a certain line. The if statement that it is stuck in is below
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
It appears to not even be testing the condition, like it is not even trying.
I am using the ethercard library.
I have tried my code on the Arduino IDE 0023 as well as 1.0. I am 100% sure that my
circuit is correctly connected. The entire code is below;
#include <EtherCard.h>
static byte mymac[] = { 0x00,0x04,0xA3,0xAA,0x2C,0x7B };
byte Ethernet::buffer[700];
void setup () {
Serial.begin(9600);
Serial.println("\n[testDHCP]");
//ether.staticSetup(mymac);
Serial.print("MAC: ");
for (byte i = 0; i < 6; ++i) {
Serial.print(mymac[i], HEX);
if (i < 5)
Serial.print(':');
}
Serial.println();
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) //code gets stuck here
Serial.println( "Failed to access Ethernet controller");
Serial.println("Setting up DHCP");
if (!ether.dhcpSetup())
Serial.println( "DHCP failed");
ether.printIp("My IP: ", ether.myip);
ether.printIp("Netmask: ", ether.mymask);
ether.printIp("GW IP: ", ether.gwip);
ether.printIp("DNS IP: ", ether.dnsip);
}
void loop () {
}
If anyone has any ideas why I am not receiving any data please let me know. I followed the schematic from that site and have no idea what could be wrong.