Arduino UNO ethernet gateway problem



  • Hi!

    I'm just starting my Mysensors journey with building an ethernet gateway based on Arduino UNO.

    Parts I'm using:

    I connected the RF-module how described here: https://www.mysensors.org/build/ethernet_gateway
    A2 - MISO
    A1 - MOSI
    A0 - SCK
    6 - SCN
    5 - CE

    0_1490345800093_IMG_7921.JPG

    I uploaded the W5100 Gateway scetch and the device seems to be in a endless boot loop.

    Here's what I see in the serial monitor of Arduino IDE:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=2
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=3
    0;255;3;0;9;TSM:FAIL:PDT
    

    And here is the scetch:

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_W5100
    
    // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
    #define MY_W5100_SPI_EN 4
    
    // Enable Soft SPI for NRF radio (note different radio wiring is required)
    // The W5100 ethernet module seems to have a hard time co-operate with
    // radio on the same spi bus.
    #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    #endif
    
    // When W5100 is connected we have to move CE/CSN pins for NRF radio
    #ifndef MY_RF24_CE_PIN
    #define MY_RF24_CE_PIN 5
    #endif
    #ifndef MY_RF24_CS_PIN
    #define MY_RF24_CS_PIN 6
    #endif
    
    // Enable to UDP
    //#define MY_USE_UDP
    
    //#define MY_IP_ADDRESS 192,168,178,66   // If this is disabled, DHCP is used to retrieve address
    // Renewal period if using DHCP
    #define MY_IP_RENEWAL_INTERVAL 60000
    // 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
    
    // 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
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#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  // Transmit led pin
    
    
    #if defined(MY_USE_UDP)
    #include <EthernetUdp.h>
    #endif
    #include <Ethernet.h>
    #include <MySensors.h>
    
    
    void setup()
    {
    }
    
    void loop()
    {
    }
    

  • Mod

    I don't see any capacitor on vcc of radio module.



  • Hi!

    That is true. I thought that it was optional as described here. If you experience bad reception or if transmitted data never reaches destination, try adding a decoupling capacitor

    I can try adding a capasitor when I get home.


  • Mod

    Well... it depends on the source of the 3.3v, but looking at your picture you are taking power directly from arduino and that is for sure not able to supply enough power for a PA radio. Try also to set nrf24 power to MIN and start from there. If I were you I would use an adapter with voltage regulator from 5v to 3.3v that would make like easier. If you are going to add capacitor, put it as close as possible to radio module (you could solder on the other side of the pins.


  • Hero Member

    @Misna You have un-commented the line

    #define MY_W5100_SPI_EN 4

    That will stop soft spi from being used. You should comment it back out. //#define MY_W5100_SPI_EN 4

    see this post for some more info and wiring hookup



  • Hi!

    I commented the line #define MY_W5100_SPI_EN 4 and wired the module as described in the post linked.
    I also added this line: #define MY_RF24_PA_LEVEL RF24_PA_MIN to lower the power need.

    Tried to add this adapter board: https://www.aliexpress.com/item/New-Socket-Adapter-plate-Board-for-8Pin-NRF24L01-Wireless-Transceive-module-51/32655936568.html?spm=2114.13010608.0.0.WnqXqC

    Now this is what I'm getting with DHCP configuration:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    DHCP FAILURE...0;255;3;0;9;!MCO:BGN:TSP FAIL
    

    And with static IP:

    IP: 192.168.10.25
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    

    Btw my versions used:

    • macOS 10.12.3
    • Arduino IDE 1.8.2
    • Arduino AVR Boards 1.6.18
    • MySensors library 2.1.1

    Still the board is somehow looping and does not appear to the network.


  • Mod

    Remember the capacitor.
    It's strange the ethernet is not getting the IP from DHCP



  • Yes it is and even the link lights wont light up on my switch. I'll try to add the capasitor tomorrow. I'll also try this with a regular radio module (without the antenna)


  • Mod

    I hope you don't have a faulty shield as I had that cost me many hours of debugging for nothing


  • Hero Member

    @Misna Don't know if this is still a problem but some time back there was an issue with certain versions of the Arduino IDE causing problems with the w5100 gateway.
    You may need to roll back the IDE or board definitions and see if that fixes the problem. Have a look Here for a bit more info.



  • Hello,
    You will solve the problem when compiling your arduino sketch with IDE 1.6.8.
    I have compiled my UNO with ethernet shield at top 2 minutes ago and now I have full contact with Domotics (on Synology NAS).
    go for it!



  • Hi!

    Investigating this issue it seems that my chinese ethernet shield has the wrong kind of terminating resistors on the ethernet line as described here.
    So first I'll try to apply the common fix for that problem (change the resistors) and then I'll get back to you.

    Btw thanks for the awesome support!


  • Mod

    Do you have a link for that fix? I may try to fix the faulty one that I have



  • Hi!

    Sure. Here is the link: https://forum.arduino.cc/index.php?topic=351477.15

    There are many options for the fix but the easiest is defined by klggi on page2 (just solder 2 100ohm resistors on the backside of the ethernet connector).
    I'll try to apply this fix tomorrow evening, I'll get back to you on how it went.


  • Mod

    On second thought maybe I'll skip the fixing, too much hassle to handle with SMD without proper tools 😄



  • @gohan check the post by klggi. No need to touch the SMD's, just solder 2 regular resistors to the backside of the connector.
    0_1490608510254_Terminations.png



  • Evening!
    Happy to report that soldering the two resistors to the back fixed the problem!
    So no need to downgrade Arduino IDE etc..


  • Mod

    in fact i have that 511 resistor in the back of connector. What resistors did you use?



  • I used just regular 100Ohm resistors like this 0_1490677932738_img.jpg


  • Mod

    @Misna Added the 2 100Ohms resistors and it seems it is working. Maybe I could order some more shields and complain again they are faulty and have them refunded and do this quick repair 😄
    At least it would be a little revenge on the many hours I lost with this faulty shield


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 5
  • 8
  • 1

24
Online

11.4k
Users

11.1k
Topics

112.6k
Posts