I am using Ethernet Shield enc28j60 for retrieve data from web server, but Ethernet Shield enc28j60 hangs after some time and it only works after restarting power supply (router usb port).

My sketch : https://github.com/shyamjos/Arduino_ServerMon


Are you sure your ethernet connection works? Try to debug with Serial.println(F("message")) to find out where it hangs.

I used the same Ethernet Shield and EtherCard library, and I had to change

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) {

on line 152 to

if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0) {

because the ENC28j60 uses a different default CS pin (10 instead of 8).

  • I am already using CS pin as 10 and it is working fine – Shyam Jos Oct 3 '16 at 4:39

I have fixed it myself by increasing Ethernet::buffersize, I have also heard that sometimes it is caused due to power issues so providing external 3.3V for enc28j60 may help.

  • Increasing a buffer size doesn't normally fix a hang that occurs after some time, it just delays it. It might be worth checking your code sending data to see how long this buffer is going to last. – Code Gorilla Oct 3 '16 at 12:11
  • In my case it is working fine for last 48 hours after adjusting buffer size , before it was getting stuck within few minutes. – Shyam Jos Oct 3 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.