EthernetGateway hangs after "Gateway startup complete"
-
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:
- gw.begin
- Ethernet.begin
- 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?
-
I think it is the same problem as in...
http://forum.mysensors.org/topic/737/uno-w5100-shield-not-pinging
Suggested Topics
-
Ethernet shield help
Troubleshooting • 13 Mar 2015, 17:16 • blutak 13 Mar 2015, 18:32 -
ENC28J60 Ethernet Shield HA reporting !GWT:TSA:ETH FAIL
Troubleshooting • 27 Feb 2022, 02:18 • Ethan Chua 7 Mar 2022, 06:55 -
Call to begin function hangs arduino
Troubleshooting • 29 Feb 2016, 19:59 • gerard 3 Mar 2016, 19:45 -
Help troubleshooting Ethernet Gateway
Troubleshooting • 12 Jul 2017, 00:16 • matias53 13 Jul 2017, 19:43 -
st=fail on gateway
Troubleshooting • 8 Feb 2015, 20:29 • cayco 10 Feb 2015, 18:17 -
EthernetGateway - Radio init fail
Troubleshooting • 23 Sept 2015, 21:44 • gmccarthy 2 Nov 2015, 05:08 -
Controller IP auto-discovery for EthernetGW
Feature Requests • 22 Jan 2015, 21:59 • nneeoo 15 Feb 2015, 13:25