Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Problems with ENC28J60 losing connection/freezing (using UIPEthernet or etherShield)? READ THIS!

Problems with ENC28J60 losing connection/freezing (using UIPEthernet or etherShield)? READ THIS!

Scheduled Pinned Locked Moved Troubleshooting
enc28j60
50 Posts 16 Posters 45.3k Views 9 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • stevebusS Offline
    stevebusS Offline
    stevebus
    wrote on last edited by
    #41

    So glad to have found this thread! Sounds like the exact problem I've been having. Ethernet gateway, with enc28j60 shield would randomly stop responding to Vera, to telnet (on 5003) and to pings. Sometimes in hours, occasionally making it a few days. Looking at my sensors, the radio stack is still working fine, the Ethernet side of the GW is just a dead stick.

    I replaced my UIPEthernet files with the ones from GitHub above, disabled DEBUG and UDP to get it to fit, re-compiled, and re-deployed. Will report back how it goes!

    BTW - the statement above says: "•DON'T activate the DEBUG-flag in MyConfig.h because this definitely will 'break' the gateway." I had to turn off DEBUG to fit the code on my UNO anyway, but I'm curious to why having DEBUG on breaks gateways?? (I had DEBUG on in my previous version with the old UIPEthernet files.. Did it contribute to my issue?).

    Vera Edge/UI7; mysensors; Arduino's and RPIs; data posted to Azure for an IoT 'dashboard' of my house

    Opinions expressed here are my own and do not necessarily reflect Microsoft's feelings on a given topic :-)

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nottledim
      wrote on last edited by
      #42

      My Mega app was surviving maybe as much as 5 minutes using the UIPEthernet library for Arduino >= 1.5. I made the changes as you suggest noting in particular that the reset has to come first. It's now been running flawlessly for 48hrs. I have have great hopes for this continuing.

      I don't understand why this is still not in the main distribution after so long.

      Anyway many thanks for posting this solution. It's a lifesaver.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Marcell Kovacs
        wrote on last edited by Marcell Kovacs
        #43

        Thank you for this post! Saved the day!
        Just for information, im using EtherShield, with this lib: https://github.com/jonoxer/etherShield/blob/master/enc28j60.c
        (it has ugly limitations, but has the smallest memory requirement in my case)

        The solution fits almost exactly, with some small modifications (around line 290):

        
           if( (enc28j60Read(EIR) & EIR_TXERIF) )
                 {
                    enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
                    enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
                    enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF); // Might be overkill but advised by Microchip Errata point 12, //MagKas 2014-10-25
                 }
        

        Thanks again!

        1 Reply Last reply
        0
        • amoarg69A Offline
          amoarg69A Offline
          amoarg69
          wrote on last edited by
          #44

          HI! Thanks for the topic! I'm new on this forum and I'm using enc28j60 with UIPE Lib. I have a lot of hang-up in my sketch.
          Can somebody tell me wich is the best adapter-library combination to make a secure client-server arduno based sensor?
          enc28j60 O WIZNET5100? UIPEEthernet, Ethercard or EtherShield ?

          The solution proposed is modify enc28j60.cpp about line 215

          Enc28J60Network::sendPacket(memhandle handle)
          .....
          if( (readReg(EIR) & EIR_TXERIF) )
          {
          writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRTS);
          }
          ...
          }

          by

          if( (enc28j60Read(EIR) & EIR_TXERIF) )
          {
          enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
          enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
          enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF);
          }

          It is correct???

          Sorry for my English. Thanks again. Daniel

          m26872M 1 Reply Last reply
          0
          • amoarg69A amoarg69

            HI! Thanks for the topic! I'm new on this forum and I'm using enc28j60 with UIPE Lib. I have a lot of hang-up in my sketch.
            Can somebody tell me wich is the best adapter-library combination to make a secure client-server arduno based sensor?
            enc28j60 O WIZNET5100? UIPEEthernet, Ethercard or EtherShield ?

            The solution proposed is modify enc28j60.cpp about line 215

            Enc28J60Network::sendPacket(memhandle handle)
            .....
            if( (readReg(EIR) & EIR_TXERIF) )
            {
            writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRTS);
            }
            ...
            }

            by

            if( (enc28j60Read(EIR) & EIR_TXERIF) )
            {
            enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
            enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
            enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF);
            }

            It is correct???

            Sorry for my English. Thanks again. Daniel

            m26872M Offline
            m26872M Offline
            m26872
            Hardware Contributor
            wrote on last edited by
            #45

            @amoarg69 AFAIK the Enc28J60 has no stable setup yet. Use the W5100.

            1 Reply Last reply
            0
            • amoarg69A Offline
              amoarg69A Offline
              amoarg69
              wrote on last edited by
              #46

              @m26872 Thanks!
              Wich library is better to use? UIPEthernet works well with W5100? I need a library that can handle client/server request.
              Thanks very much!!!

              m26872M 1 Reply Last reply
              0
              • amoarg69A amoarg69

                @m26872 Thanks!
                Wich library is better to use? UIPEthernet works well with W5100? I need a library that can handle client/server request.
                Thanks very much!!!

                m26872M Offline
                m26872M Offline
                m26872
                Hardware Contributor
                wrote on last edited by
                #47

                @amoarg69 W5100 is also the Arduino standard Ethernet shield and hence works good with the Arduino standard Ethernet lib. Server/client exemples provided through Arduino IDE for the lib.

                1 Reply Last reply
                1
                • ggottaG Offline
                  ggottaG Offline
                  ggotta
                  wrote on last edited by
                  #48
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mhdayusuf
                    wrote on last edited by
                    #49

                    I choose to reply to this very old topic because I updated to the latest UIPEthernet and this issue is still happening to me. I was about to replace it with a W5100 but came across this and tried it, compiled, uploaded, and here it goes. 24 hours of continuous web serving using an Arduino Mega 2560 and still counting!

                    I wish this get incorporated into UIPEthernet

                    Marcel STOICAM 1 Reply Last reply
                    0
                    • M mhdayusuf

                      I choose to reply to this very old topic because I updated to the latest UIPEthernet and this issue is still happening to me. I was about to replace it with a W5100 but came across this and tried it, compiled, uploaded, and here it goes. 24 hours of continuous web serving using an Arduino Mega 2560 and still counting!

                      I wish this get incorporated into UIPEthernet

                      Marcel STOICAM Offline
                      Marcel STOICAM Offline
                      Marcel STOICA
                      wrote on last edited by
                      #50

                      @mhdayusuf Do you have a copy of the changes you made? I am quite struggling to make it work and is not obvious to me what changes you made... Thanks.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      16

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular