void EtherShield::ES_enc28j60Init( uint8_t* macaddr, uint8_t csPin ) { /*initialize enc28j60*/ enc28j60InitWithCs( macaddr, csPin ); enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz delay(10); // 0x880 is PHLCON LEDB=on, LEDA=on // enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00); enc28j60PhyWrite(PHLCON,0x880); delay(500); // // 0x990 is PHLCON LEDB=off, LEDA=off // enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00); enc28j60PhyWrite(PHLCON,0x990); delay(500); // // 0x880 is PHLCON LEDB=on, LEDA=on // enc28j60PhyWrite(PHLCON,0b0000 1000 1000 00 00); enc28j60PhyWrite(PHLCON,0x880); delay(500); // // 0x990 is PHLCON LEDB=off, LEDA=off // enc28j60PhyWrite(PHLCON,0b0000 1001 1001 00 00); enc28j60PhyWrite(PHLCON,0x990); delay(500); // // 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit // enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10); enc28j60PhyWrite(PHLCON,0x476); delay(100); }
void NanodeUIP::init(const byte *macaddr) { const struct uip_eth_addr *mac=(struct uip_eth_addr *)macaddr; uip_setethaddr((*mac)); enc28j60SpiInit(); enc28j60InitWithCs(macaddr, 8); enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz delay(10); timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); uip_init(); }