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
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