Hi,
I've been playing with the MEGA & the ethernet sheild from Seeedstudio ...
I know this uses a different chip than the official board, but I used the instructions on this forum to hack the offical board to reasonable effect. Doing the original four pin hack (and changing the pin numbers in enc28j60.c) I went from no initialization to completion on that front, but still not joy from the examples...
enc28j60.c changes:
#define ENC28J60_CONTROL_CS 53 //10
#define SPI_MOSI 51 //11
#define SPI_MISO 50 //12
#define SPI_SCK 52 //13
Changing the ping setup method to:
void setup(){
Serial.begin(9600);
delay(1000);
Serial.println("Debug: /*initialize enc28j60*/");
es.ES_enc28j60Init(mymac);
es.ES_enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz
delay(10);
Serial.println("Debug: /* Magjack leds configuration, see enc28j60 datasheet, page 11 */");
/* Magjack leds configuration, see enc28j60 datasheet, page 11 */
// LEDA=green LEDB=yellow
//
// 0x880 is PHLCON LEDB=on, LEDA=on
// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x880);
delay(500);
Serial.println("Debug: 0x990 is PHLCON LEDB=off, LEDA=off");
//
// 0x990 is PHLCON LEDB=off, LEDA=off
// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x990);
delay(500);
Serial.println("Debug: 0x880 is PHLCON LEDB=on, LEDA=on");
//
// 0x880 is PHLCON LEDB=on, LEDA=on
// enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x880);
delay(500);
Serial.println("Debug: 0x990 is PHLCON LEDB=off, LEDA=off");
//
// 0x990 is PHLCON LEDB=off, LEDA=off
// enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00);
es.ES_enc28j60PhyWrite(PHLCON,0x990);
delay(500);
Serial.println("Debug: 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit");
//
// 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit
// enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10);
es.ES_enc28j60PhyWrite(PHLCON,0x476);
delay(100);
Serial.println("Debug: init the ethernet/ip layer:");
//init the ethernet/ip layer:
es.ES_init_ip_arp_udp_tcp(mymac,myip,80);
Serial.println("Debug: setup done.");
}
Gives me the following output:
Debug: /*initialize enc28j60*/
Debug: /* Magjack leds configuration, see enc28j60 datasheet, page 11 */
Debug: 0x990 is PHLCON LEDB=off, LEDA=off
Debug: 0x880 is PHLCON LEDB=on, LEDA=on
Debug: 0x990 is PHLCON LEDB=off, LEDA=off
Debug: 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit
Debug: init the ethernet/ip layer:
Debug: setup done.
Beforehand (before changing the pins or the c file) the code would freeze on the first piece of initialisation:
es.ES_enc28j60Init(mymac);
es.ES_enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz
So.... I try and ping, and it times out. I have set my PC to different combinations of subnet for the same IP address to try and 'find' the correct subnet, but I have failed... I've used the other examples and these all fail...
I have the following questions for you clever people:
- How do I specify the subnet with this library?
- How do I determine the subnet it is set to?
- Is it possible I've blown up the chip on the board when I connected with all pins assuming it was compatible with the MEGA?
- Does anyone have any bright ideas?
Cheers,
Darren