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. EthernetGateway hangs after "Gateway startup complete"

EthernetGateway hangs after "Gateway startup complete"

Scheduled Pinned Locked Moved Troubleshooting
hangethernetgatewaywiz5100arduino uno r3
2 Posts 1 Posters 2.2k Views 1 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.
  • HeinzH Offline
    HeinzH Offline
    Heinz
    Hero Member
    wrote on last edited by Heinz
    #1

    Hello,
    I spent some hours to get my EthernetGateway running on the following configuration:

    • SainSmart Arduino Uno R3
    • SainSmart EthernetShield (5100)
    • EthernetGateway.ino
      I followed the steps in the documentation and luckily received the message: "Gateway startup complete"
      BUT then I noticed that I could not ping the gateway.

    After adding some "Serial.println"-calls in the setup() routine I discovered that the arduino did not return from the
    gw.begin(...); call. Having a look at the implementation made me a bit curious.

    setup() does the following:

    1. gw.begin
    2. Ethernet.begin
    3. server.begin

    gw.begin accepts a callback "writeEthernet" which is implemented as follows:
    void writeEthernet(char *writeBuffer) {
    server.write(writeBuffer);
    }
    This callback is called before server.begin is called. So server.write gets called before server.begin!

    To avoid calling server.write before server.begin was called I introduced a bool which is set to true at the end of setup() and used this
    in the following way:
    void writeEthernet(char *writeBuffer) {
    if (serverUp)
    {
    server.write(writeBuffer);
    }
    }

    Now my EthernetGateway runs fine, with this workaround.
    Is this a bug in the code?
    Could anyone provide some help to find out why the arduino hangs when server.write is called before server.begin?

    1 Reply Last reply
    0
    • HeinzH Offline
      HeinzH Offline
      Heinz
      Hero Member
      wrote on last edited by
      #2

      I think it is the same problem as in...
      http://forum.mysensors.org/topic/737/uno-w5100-shield-not-pinging

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      17

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      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