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. [Solved] MySensors 2.0 Ethernet gateway (ENC28J60) restart / IP issue

[Solved] MySensors 2.0 Ethernet gateway (ENC28J60) restart / IP issue

Scheduled Pinned Locked Moved Troubleshooting
49 Posts 9 Posters 22.2k Views 8 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.
  • intelliumI Offline
    intelliumI Offline
    intellium
    wrote on last edited by tekka
    #1

    Hi all,

    I'm new to the MySensors scene (and Arduino for that matter). I seem to be having an issue with the ethernet gateway setup.

    My setup:

    Arduino Nano v3 clone
    ENC28J60 15/21 ethernet shield
    The RF24 radio module.

    It took me a while to get at least some output on this setup, which is probably due to my lack of experience. I have the system running, but the output is as follows:

    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    IP: 183.4.241.184
    

    This keeps repeating itself over and over again. The leds on the LAN port are blinking and loading up a simple test sketch works fine with this setup. In the gateway sketch however, not so much. It doesn't even seem to use the UP I have configured in the sketch :

    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    // When ENC28J60 is connected we have to move CE/CSN pins for NRF radio
    #define MY_RF24_CE_PIN 5
    #define MY_RF24_CS_PIN 6
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_ENC28J60
    
    // Gateway IP address
    #define MY_IP_ADDRESS 10, 20, 1, 124
    
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    // The MAC address can be anything you want but should be unique on your network.
    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
    // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF
    
    // Flash leds on rx/tx/err
    #define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    #define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
    
    #include <SPI.h>
    #include <UIPEthernet.h>
    #include <MySensors.h>
    
    
    void setup()
    {
    }
    
    void loop() {
    }
    

    I think this has something to do with the UIPEthernet library, but I'm not sure. I know currently a W5100 is recommended, but I only have a bunch of ENC28J60's, which as far as I can tell, should work too.

    Anybody able to shed some light onto this ?

    TheoLT 1 Reply Last reply
    0
    • intelliumI intellium

      Hi all,

      I'm new to the MySensors scene (and Arduino for that matter). I seem to be having an issue with the ethernet gateway setup.

      My setup:

      Arduino Nano v3 clone
      ENC28J60 15/21 ethernet shield
      The RF24 radio module.

      It took me a while to get at least some output on this setup, which is probably due to my lack of experience. I have the system running, but the output is as follows:

      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      IP: 183.4.241.184
      

      This keeps repeating itself over and over again. The leds on the LAN port are blinking and loading up a simple test sketch works fine with this setup. In the gateway sketch however, not so much. It doesn't even seem to use the UP I have configured in the sketch :

      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      // When ENC28J60 is connected we have to move CE/CSN pins for NRF radio
      #define MY_RF24_CE_PIN 5
      #define MY_RF24_CS_PIN 6
      
      // Enable gateway ethernet module type
      #define MY_GATEWAY_ENC28J60
      
      // Gateway IP address
      #define MY_IP_ADDRESS 10, 20, 1, 124
      
      // The port to keep open on node server mode / or port to contact in client mode
      #define MY_PORT 5003
      
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3
      
      #define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
      #define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
      #define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
      
      #include <SPI.h>
      #include <UIPEthernet.h>
      #include <MySensors.h>
      
      
      void setup()
      {
      }
      
      void loop() {
      }
      

      I think this has something to do with the UIPEthernet library, but I'm not sure. I know currently a W5100 is recommended, but I only have a bunch of ENC28J60's, which as far as I can tell, should work too.

      Anybody able to shed some light onto this ?

      TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      @intellium As far as I can tell. It looks like your Arduino is continuously resetting itself. It should not repeat the first log you've posted.

      This can be caused by some reasons:

      1. A write operation to a memory location where it shouldn't be writing. I've experienced this last weekend why I used an strcpy wrongly. But since you're using tested software this is not likely.
      2. The circuit isn't getting enough power. And the Arduino resets itself.

      how does your circuit looks like?

      intelliumI 1 Reply Last reply
      0
      • TheoLT TheoL

        @intellium As far as I can tell. It looks like your Arduino is continuously resetting itself. It should not repeat the first log you've posted.

        This can be caused by some reasons:

        1. A write operation to a memory location where it shouldn't be writing. I've experienced this last weekend why I used an strcpy wrongly. But since you're using tested software this is not likely.
        2. The circuit isn't getting enough power. And the Arduino resets itself.

        how does your circuit looks like?

        intelliumI Offline
        intelliumI Offline
        intellium
        wrote on last edited by
        #3

        @TheoL The circuit not getting enough power was something I ran into way before my current issues :)
        Currently, the nano is feeding the RF24 module on the 3.3v line and the ENC28J60 module is fed from a separate 5v line.

        It's connected as depicted in the ethernet gateway setup Ethernet gateway - Wiring things up. This same setup works fine with a simple test sketch for the ENC module.

        I'm using the Arduino IDE 1.6.11 and the UIPEthernet library (v1.09) from here : Github - UIPEthernet

        Does this info help ?

        TheoLT 1 Reply Last reply
        0
        • intelliumI intellium

          @TheoL The circuit not getting enough power was something I ran into way before my current issues :)
          Currently, the nano is feeding the RF24 module on the 3.3v line and the ENC28J60 module is fed from a separate 5v line.

          It's connected as depicted in the ethernet gateway setup Ethernet gateway - Wiring things up. This same setup works fine with a simple test sketch for the ENC module.

          I'm using the Arduino IDE 1.6.11 and the UIPEthernet library (v1.09) from here : Github - UIPEthernet

          Does this info help ?

          TheoLT Offline
          TheoLT Offline
          TheoL
          Contest Winner
          wrote on last edited by
          #4

          @intellium I'm no expert. But does the simple example work when everything is connected (radio and LED's)?

          intelliumI 1 Reply Last reply
          0
          • TheoLT TheoL

            @intellium I'm no expert. But does the simple example work when everything is connected (radio and LED's)?

            intelliumI Offline
            intelliumI Offline
            intellium
            wrote on last edited by
            #5

            @TheoL Yeah, it's exactly the same setup (hardware wise). Has to be something in the software part (MySensors / UIPEthernet) thats not working correctly.

            Does anybody have a working setup using MySensors 2.0 Gateway with an ENC28J60 module ?

            TheoLT YveauxY tekkaT 3 Replies Last reply
            0
            • intelliumI intellium

              @TheoL Yeah, it's exactly the same setup (hardware wise). Has to be something in the software part (MySensors / UIPEthernet) thats not working correctly.

              Does anybody have a working setup using MySensors 2.0 Gateway with an ENC28J60 module ?

              TheoLT Offline
              TheoLT Offline
              TheoL
              Contest Winner
              wrote on last edited by
              #6

              @intellium Maybe @mfalkvidd ?

              1 Reply Last reply
              0
              • intelliumI intellium

                @TheoL Yeah, it's exactly the same setup (hardware wise). Has to be something in the software part (MySensors / UIPEthernet) thats not working correctly.

                Does anybody have a working setup using MySensors 2.0 Gateway with an ENC28J60 module ?

                YveauxY Offline
                YveauxY Offline
                Yveaux
                Mod
                wrote on last edited by
                #7

                @intellium with w5100 we currently face an issue, causing the arduino to reset, caused by a bug in the avr gcc tool chain.
                Until fixed in the tool chain and adopted by arduino there is not much more than trial and error to see if it runs stable. Reverting arduino ide won't help either, because this bug has been in for a long time.
                I'm not saying this is what is happening to you, but it just might.

                http://yveaux.blogspot.nl

                intelliumI 1 Reply Last reply
                1
                • YveauxY Yveaux

                  @intellium with w5100 we currently face an issue, causing the arduino to reset, caused by a bug in the avr gcc tool chain.
                  Until fixed in the tool chain and adopted by arduino there is not much more than trial and error to see if it runs stable. Reverting arduino ide won't help either, because this bug has been in for a long time.
                  I'm not saying this is what is happening to you, but it just might.

                  intelliumI Offline
                  intelliumI Offline
                  intellium
                  wrote on last edited by
                  #8

                  @Yveaux Hmm, thats annoying. So, if I'm experiencing this issue, I'm basically S.O.L. ? :(

                  1 Reply Last reply
                  0
                  • intelliumI intellium

                    @TheoL Yeah, it's exactly the same setup (hardware wise). Has to be something in the software part (MySensors / UIPEthernet) thats not working correctly.

                    Does anybody have a working setup using MySensors 2.0 Gateway with an ENC28J60 module ?

                    tekkaT Offline
                    tekkaT Offline
                    tekka
                    Admin
                    wrote on last edited by tekka
                    #9

                    @intellium The avr toolchain bug is related to variadic arguments used for debug prints. If you comment MY_DEBUG, do you still have the issue?

                    intelliumI 1 Reply Last reply
                    2
                    • tekkaT tekka

                      @intellium The avr toolchain bug is related to variadic arguments used for debug prints. If you comment MY_DEBUG, do you still have the issue?

                      intelliumI Offline
                      intelliumI Offline
                      intellium
                      wrote on last edited by
                      #10

                      @tekka You sir, are my new best friend :)

                      Sure enough, disabling the debug and uploading the code seems to make everything work. The gateway outputs the correct IP and is now pingable !

                      tekkaT TheoLT 2 Replies Last reply
                      2
                      • intelliumI intellium

                        @tekka You sir, are my new best friend :)

                        Sure enough, disabling the debug and uploading the code seems to make everything work. The gateway outputs the correct IP and is now pingable !

                        tekkaT Offline
                        tekkaT Offline
                        tekka
                        Admin
                        wrote on last edited by
                        #11

                        @intellium excellent :) Have fun

                        1 Reply Last reply
                        0
                        • intelliumI intellium

                          @tekka You sir, are my new best friend :)

                          Sure enough, disabling the debug and uploading the code seems to make everything work. The gateway outputs the correct IP and is now pingable !

                          TheoLT Offline
                          TheoLT Offline
                          TheoL
                          Contest Winner
                          wrote on last edited by
                          #12

                          @intellium @Tekka is actually the best friend for most of us ;-)

                          tekkaT 1 Reply Last reply
                          1
                          • TheoLT TheoL

                            @intellium @Tekka is actually the best friend for most of us ;-)

                            tekkaT Offline
                            tekkaT Offline
                            tekka
                            Admin
                            wrote on last edited by
                            #13

                            @TheoL haha, that's the MySensors spirit :sparkles:

                            1 Reply Last reply
                            0
                            • intelliumI Offline
                              intelliumI Offline
                              intellium
                              wrote on last edited by
                              #14

                              May have spoken to soon....

                              Although the gateway now runs, after a few mins it seems to die. LAN leds keep blinking everything seems in order, but it's not pingable anymore and Domoticz starts logging messages that the gateway is unreachable. Is this somehow related? Or is this a whole different issue?

                              @tekka probably knows what to do, right? :D

                              tekkaT 1 Reply Last reply
                              0
                              • intelliumI intellium

                                May have spoken to soon....

                                Although the gateway now runs, after a few mins it seems to die. LAN leds keep blinking everything seems in order, but it's not pingable anymore and Domoticz starts logging messages that the gateway is unreachable. Is this somehow related? Or is this a whole different issue?

                                @tekka probably knows what to do, right? :D

                                tekkaT Offline
                                tekkaT Offline
                                tekka
                                Admin
                                wrote on last edited by
                                #15

                                @intellium can you add a serial print in loop() to see if the GW or the lan module freezes?

                                intelliumI 1 Reply Last reply
                                1
                                • tekkaT tekka

                                  @intellium can you add a serial print in loop() to see if the GW or the lan module freezes?

                                  intelliumI Offline
                                  intelliumI Offline
                                  intellium
                                  wrote on last edited by
                                  #16

                                  @tekka Sorry it took a while.

                                  I gave it a try, but ever since adding print statements to the gateway loop(), the sensor nodes stopped communicating with it given FPAR failures. Even when I remove the print statements and return to the previous state, it keeps on giving FPAR failures on all sensor nodes... What would cause this ?

                                  tekkaT 1 Reply Last reply
                                  0
                                  • intelliumI intellium

                                    @tekka Sorry it took a while.

                                    I gave it a try, but ever since adding print statements to the gateway loop(), the sensor nodes stopped communicating with it given FPAR failures. Even when I remove the print statements and return to the previous state, it keeps on giving FPAR failures on all sensor nodes... What would cause this ?

                                    tekkaT Offline
                                    tekkaT Offline
                                    tekka
                                    Admin
                                    wrote on last edited by
                                    #17

                                    @intellium hmm, hard to diagnose without additional information - could be power-related. Can you add a better/stronger power-supply?

                                    intelliumI 1 Reply Last reply
                                    0
                                    • tekkaT tekka

                                      @intellium hmm, hard to diagnose without additional information - could be power-related. Can you add a better/stronger power-supply?

                                      intelliumI Offline
                                      intelliumI Offline
                                      intellium
                                      wrote on last edited by
                                      #18

                                      @tekka Before I go the route of messing with the power supply, I did some fiddling...

                                      I added the following statements to both the gateway and the sensor sketches:

                                      //LOW POWER MODE RADIO
                                      #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                      
                                      //DEBUG FOR RADIO
                                      #define MY_DEBUG_VERBOSE_RF24
                                      
                                      //RADIO THROUGHPUT
                                      #define MY_RF24_DATARATE RF24_1MBPS
                                      

                                      Next I put them a little bit closer together (around 80cm apart). The FPAR:FAIL message are gone now. I see in the output on the Sensor node that it communicates with the gateway. Currently, the gateway is running with this setup and the controller (Domoticz) gets values. So this seems to be working OK.

                                      However, on the sensor node, the log sometimes indicates an error. Something like this :

                                      RF24:write register, reg=0, value=14
                                      RF24:open writing pipe, recipient=0
                                      RF24:write register, reg=10, value=0
                                      RF24:write register, reg=16, value=0
                                      RF24:send message to 0, len=12
                                      RF24:flushTX
                                      RF24:write register, reg=7, value=48
                                      RF24:MAX_RT
                                      RF24:flushTX
                                      RF24:start listening
                                      RF24:write register, reg=0, value=15
                                      RF24:write register, reg=10, value=1
                                      !TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=4,st=fail:29.0
                                      T: 29.00
                                      RF24:write register, reg=0, value=12
                                      RF24:power down
                                      RF24:write register, reg=0, value=12
                                      RF24:power down
                                      RF24:stop listening
                                      RF24:write register, reg=0, value=14
                                      RF24:open writing pipe, recipient=0
                                      RF24:write register, reg=10, value=0
                                      RF24:write register, reg=16, value=0
                                      RF24:send message to 0, len=12
                                      RF24:flushTX
                                      RF24:write register, reg=7, value=48
                                      RF24:start listening
                                      RF24:write register, reg=0, value=15
                                      RF24:write register, reg=10, value=1
                                      TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=5,st=ok:36.0
                                      H: 36.00
                                      RF24:write register, reg=0, value=12
                                      RF24:power down
                                      

                                      From what I've read, the st:fail means there was an error transmitting the value. Could this still be power related ? It seems so intermittent to me that my gut tells me power isn't the issue.

                                      1 Reply Last reply
                                      0
                                      • intelliumI Offline
                                        intelliumI Offline
                                        intellium
                                        wrote on last edited by
                                        #19

                                        @tekka Next I tried is adding a capacitor to both the gateway and node RF module. I added a 10uF capacitor to both of them. This seems to have stabilized RF communication. I'm not seeing any failures anymore and data is flowing...

                                        Back to the original issue... The gateway that seems to die...

                                        I've added some debug statements to the loop() to see if this would keep on running when the gateway seemingly dies.
                                        After 2 hours of operation, the gateway stopped responding to pings, and the controller also noticed the gateway was not alive anymore. When this happens, the output of the serial console is :

                                        New loop iteration: 21734
                                        New loop iteration: 21735
                                        New loop iteration: 21736
                                        New loop iteration: 21737
                                        New loop iteration: 21738
                                        New loop iteration: 21739
                                        New loop iteration: 21740
                                        New loop iteration: 21741
                                        New loop iteration: 21742
                                        New loop iteration: 21743
                                        New loop iteration: 21744
                                        

                                        As you can see, my loop code keeps on running at this point, suggesting it's just the ENC interface thats no longer reachable or has an issue. When I close and re-open the serial port monitor from the Arduino IDE, the gateway springs back to life and everything starts working again.

                                        1 Reply Last reply
                                        0
                                        • intelliumI Offline
                                          intelliumI Offline
                                          intellium
                                          wrote on last edited by
                                          #20

                                          The next run it only took 20 mins. before the gateway stopped responding....

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


                                          18

                                          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