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. ENC28J60 Ethernet gateway

ENC28J60 Ethernet gateway

Scheduled Pinned Locked Moved Troubleshooting
14 Posts 5 Posters 662 Views 3 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.
  • K Offline
    K Offline
    kimot
    wrote on last edited by
    #2

    ENC28J60 for a stable gateway is not a good idea.
    Buy some Wiznet...

    C 1 Reply Last reply
    0
    • Sergio RiusS Offline
      Sergio RiusS Offline
      Sergio Rius
      wrote on last edited by
      #3

      So after being unable to make the nrf24 to work with the ENC28J60, I'm trying now something different. I started by making an rfm69 serial gateway with success. :clap:

      Then I want to see if it could be possible to convert it to ethernet with the ENC28J60.
      I searched and found everything in the forum. I arrived to the conclussion (that is probably wrong) that I must wire both radio and eth module using the same spi pins, activating a new driver and nothing more. But this doesn't work on the proto-board.

      There's something else to be done? Thanks.

      1 Reply Last reply
      0
      • scalzS Offline
        scalzS Offline
        scalz
        Hardware Contributor
        wrote on last edited by scalz
        #4

        @Sergio-Rius
        unfortunaly I can't help with your enc28j60 issue. and I'm not sure to have one for testing this.

        A while back, we checked w5100 module + arduino 328p. Eth module and radio were working on same hw spi bus but in docs it uses softspi, I don't remember why, perhaps for having a dedicated spibus for ethernet..
        I understand this is not very convenient to find the infos, when always more hw is supported.

        Just a note, as you are using a Nano for your tests, RFMs modules are not 5v tolerant in theory, even if they seem to handle it, datasheet says 3.9v for max. good to know. but maybe you're already using a level converter.

        Sergio RiusS 1 Reply Last reply
        0
        • scalzS scalz

          @Sergio-Rius
          unfortunaly I can't help with your enc28j60 issue. and I'm not sure to have one for testing this.

          A while back, we checked w5100 module + arduino 328p. Eth module and radio were working on same hw spi bus but in docs it uses softspi, I don't remember why, perhaps for having a dedicated spibus for ethernet..
          I understand this is not very convenient to find the infos, when always more hw is supported.

          Just a note, as you are using a Nano for your tests, RFMs modules are not 5v tolerant in theory, even if they seem to handle it, datasheet says 3.9v for max. good to know. but maybe you're already using a level converter.

          Sergio RiusS Offline
          Sergio RiusS Offline
          Sergio Rius
          wrote on last edited by
          #5

          @scalz Thanks for your help. Unfortunately I can't get a w5100 in my country and would order it outside. I had those rfms for years and I want to test range before buying a sensebender.
          And I'm convinced to stop using the wifi for a gw.

          I had hope that any used had the same hw already running.

          1 Reply Last reply
          0
          • K kimot

            ENC28J60 for a stable gateway is not a good idea.
            Buy some Wiznet...

            C Offline
            C Offline
            cabat
            wrote on last edited by
            #6

            @kimot I am use one Ethernet gateway about 2 year - work good and stable.

            Sergio RiusS 1 Reply Last reply
            0
            • C cabat

              @kimot I am use one Ethernet gateway about 2 year - work good and stable.

              Sergio RiusS Offline
              Sergio RiusS Offline
              Sergio Rius
              wrote on last edited by
              #7

              @cabat Could you please share you pinout for radio and module, and the sketch configuration?
              I can't make it work and I don't know if it's a matter of connections or something to activate, like softspi.

              C 1 Reply Last reply
              0
              • Sergio RiusS Sergio Rius

                @cabat Could you please share you pinout for radio and module, and the sketch configuration?
                I can't make it work and I don't know if it's a matter of connections or something to activate, like softspi.

                C Offline
                C Offline
                cabat
                wrote on last edited by cabat
                #8

                @sergio-rius Pinout as described here Building an Ethernet Gateway, i am use module like this:

                0_1571654230542_enc28j60.jpg

                and my sketch on 20-Feb-2019 is:

                #define MY_BAUD_RATE 9600
                //#define MY_RF24_PA_LEVEL RF24_PA_MIN
                #undef MY_REGISTRATION_FEATURE
                #undef MY_CORE_COMPATIBILITY_CHECK
                
                // Enable debug prints to serial monitor
                #define MY_DEBUG
                
                // Enable and select radio type attached
                #define MY_RADIO_NRF24
                //#define MY_RADIO_RFM69
                
                // 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 192,168,1,235
                
                // The port to keep open on node server mode / or port to contact in client mode
                #define MY_PORT 5003   
                
                // Controller ip address. Enables client mode (default is "server" mode). 
                // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
                //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
                 
                // 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, 0xED
                
                // 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() {
                }
                
                1 Reply Last reply
                0
                • nagelcN Offline
                  nagelcN Offline
                  nagelc
                  wrote on last edited by nagelc
                  #9

                  @scalz said in ENC28J60 Ethernet gateway:

                  A while back, we checked w5100 module + arduino 328p. Eth module and radio were working on same hw spi bus but in docs it uses softspi, I don't remember why, perhaps for having a dedicated spibus for ethernet..

                  It may have been fixed by now, but originally the W5100 did not release the SPI bus properly. So, it needed a separate SPI bus from the radio.
                  I think this was fixed in the W5200 and W5500.

                  Sergio RiusS 1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by scalz
                    #10

                    @nagelc
                    exactly, you're right! Better memory than me :) I remember now, I had to hack w5100 lib for spi transactions to make it working on same bus. So I don't know if it has been fixed.. I hope so.

                    1 Reply Last reply
                    0
                    • nagelcN nagelc

                      @scalz said in ENC28J60 Ethernet gateway:

                      A while back, we checked w5100 module + arduino 328p. Eth module and radio were working on same hw spi bus but in docs it uses softspi, I don't remember why, perhaps for having a dedicated spibus for ethernet..

                      It may have been fixed by now, but originally the W5100 did not release the SPI bus properly. So, it needed a separate SPI bus from the radio.
                      I think this was fixed in the W5200 and W5500.

                      Sergio RiusS Offline
                      Sergio RiusS Offline
                      Sergio Rius
                      wrote on last edited by
                      #11

                      @nagelc said in ENC28J60 Ethernet gateway:

                      I think this was fixed in the W5200 and W5500.

                      Noooooo..... Just ordered a W5100 :sob:

                      @cabat It may not do for me. I'm trying to use rfm69 now. I could not leave my existing network down and brought the nrfs back to where they belonged.

                      Also the eth module I have here is the shield for nano one. As it stacks below the nano, it may be that is interfering more pins than I expected.

                      What I would want to know is that the rfm69 needs a different pinout with this shield or not. I can't find any reference that tells me this, so I can start debugging the problem.

                      C 1 Reply Last reply
                      0
                      • Sergio RiusS Sergio Rius

                        @nagelc said in ENC28J60 Ethernet gateway:

                        I think this was fixed in the W5200 and W5500.

                        Noooooo..... Just ordered a W5100 :sob:

                        @cabat It may not do for me. I'm trying to use rfm69 now. I could not leave my existing network down and brought the nrfs back to where they belonged.

                        Also the eth module I have here is the shield for nano one. As it stacks below the nano, it may be that is interfering more pins than I expected.

                        What I would want to know is that the rfm69 needs a different pinout with this shield or not. I can't find any reference that tells me this, so I can start debugging the problem.

                        C Offline
                        C Offline
                        cabat
                        wrote on last edited by
                        #12

                        @sergio-rius sorry, my mistake, missed of using RFM69 in your setup..

                        Sergio RiusS 1 Reply Last reply
                        0
                        • C cabat

                          @sergio-rius sorry, my mistake, missed of using RFM69 in your setup..

                          Sergio RiusS Offline
                          Sergio RiusS Offline
                          Sergio Rius
                          wrote on last edited by
                          #13

                          @cabat Oh, no! Thanks for your help. It has inspired me. Now I'm trying something more.

                          1 Reply Last reply
                          0
                          • Sergio RiusS Offline
                            Sergio RiusS Offline
                            Sergio Rius
                            wrote on last edited by Sergio Rius
                            #14

                            I've been fiddling with the radio alone (serial gw), softspi and changing pins, and I think there's something else here.
                            Well those are my findings:

                            With this base definition and without the module wired:

                            #define MY_RADIO_RFM69
                            #define MY_RFM69_NEW_DRIVER
                            #define MY_IS_RFM69HW
                            
                            #define MY_DEBUG_VERBOSE_RFM69
                            
                            #define MY_GATEWAY_ENC28J60
                            

                            It works as expected.

                            0 MCO:BGN:INIT GW,CP=RPNGA---,REL=255,VER=2.3.1
                            4 TSM:INIT
                            5 TSF:WUR:MS=0
                            6 RFM69:INIT
                            7 RFM69:INIT:PIN,CS=10,IQP=2,IQN=0
                            11 RFM69:PTX:LEVEL=5 dBm
                            13 TSM:INIT:TSP OK
                            15 TSM:INIT:GW MODE
                            16 TSM:READY:ID=0,PAR=0,DIS=0
                            19 MCO:REG:NOT NEEDED
                            72 GWT:TIN:IP=192.168.50.211
                            1075 MCO:BGN:STP
                            1077 MCO:BGN:INIT OK,TSP=1
                            1081 TSM:READY:NWD REQ
                            1083 RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0
                            1088 RFM69:CSMA:RSSI=-98
                            1090 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
                            

                            If I try to change CS pin to any other with #define MY_RFM69_CS_PIN 4 for example, I always get:

                            0 MCO:BGN:INIT GW,CP=RPNGA---,REL=255,VER=2.3.1
                            4 TSM:INIT
                            5 TSF:WUR:MS=0
                            6 RFM69:INIT
                            7 RFM69:INIT:PIN,CS=4,IQP=2,IQN=0
                            11 RFM69:PTX:LEVEL=5 dBm
                            13 TSM:INIT:TSP OK
                            14 TSM:INIT:GW MODE
                            16 TSM:READY:ID=0,PAR=0,DIS=0
                            19 MCO:REG:NOT NEEDED
                            

                            So I revert the CS pin change and activate softspi and change irq #define MY_SOFTSPI and #define MY_RFM69_IRQ_PIN 3 And it works well:

                            0 MCO:BGN:INIT GW,CP=RPNGA---,REL=255,VER=2.3.1
                            4 TSM:INIT
                            5 TSF:WUR:MS=0
                            6 RFM69:INIT
                            7 RFM69:INIT:PIN,CS=10,IQP=3,IQN=1
                            11 RFM69:PTX:LEVEL=5 dBm
                            13 TSM:INIT:TSP OK
                            15 TSM:INIT:GW MODE
                            16 TSM:READY:ID=0,PAR=0,DIS=0
                            19 MCO:REG:NOT NEEDED
                            72 GWT:TIN:IP=192.168.50.211
                            1075 MCO:BGN:STP
                            1077 MCO:BGN:INIT OK,TSP=1
                            1079 TSM:READY:NWD REQ
                            1081 RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0
                            1086 RFM69:CSMA:RSSI=-98
                            1091 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
                            

                            Then I add the eth module and I get:

                            0 MCO:BGN:INIT GW,CP=RPNGA---,REL=255,VER=2.3.1
                            4 TSM:INIT
                            5 TSF:WUR:MS=0
                            6 RFM69:INIT
                            7 RFM69:INIT:PIN,CS=10,IQP=3,IQN=1
                            11 RFM69:PTX:LEVEL=5 dBm
                            13 TSM:INIT:TSP OK
                            15 TSM:INIT:GW MODE
                            16 TSM:READY:ID=0,PAR=0,DIS=0
                            19 MCO:REG:NOT NEEDED
                            

                            And stays here forever.

                            Of course all those test are made using a double (5v+3v3) good power source, a level shifter... and changing the wires accordingly.

                            I have some questions:

                            • Its normal MY_RFM69_CS_PIN not having effect and breaking the radion connection?
                              Without being able to change this, I don't know if it's spi interference.
                            • In the last test, it seems to halt when initialising the network. Doesn't it?
                              Is there a way I can further know if the problem is with the eth module? I've tried it alone with the nano and it works.

                            I would thank guidance for debugging this.

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


                            20

                            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