DHCP fail with current NanodeRF sketch

I've just updated to the latest versions of NanodeRF_Power_RTCrelay_GLCDtemp and its required libraries. I've tweaked the information between lines 74 and 94 to reflect my setup (local emoncms server) and tried again using an emoncms.org account.

With the new sketch, I'm getting a dhcp fail. My previous copy of the sketch has run since May with no issues. Unfortunately I don't have a copy of that sketch and libraries to fall back upon.

Serial monitor:-

emonTx data rxData sent: /api/post.json?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&json={rf_fail:0,power1:1672,power2:288,power3:0,voltage:24538}
DHCP status: 0
DHCP status: 0
Data sent: /api/post.json?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&json={rf_fail:1}
Time request sent
DHCP status: 0
DHCP status: 0
 

vworp's picture

Re: DHCP fail with current NanodeRF sketch

Possibly fixed. Reloaded sketch and restarted router, emonbase appears to be getting an IP address and posting to emoncms now.

I'm provisionally blaming this on the router :)

vworp's picture

Re: DHCP fail with current NanodeRF sketch

I'm back on thinking this is an issue with the sketch. I've just reloaded the sketch and I'm back on

DHCP status: 0

Anyone else having issues?

anorman's picture

Re: DHCP fail with current NanodeRF sketch

I was having similar issues a couple of weeks ago and it turned out to be my router, bought a new one last week and it works every time now, the only code change I made was suggested by Some Random Bloke (SRB) on the Nanode Google Group as follows:-

If you've not seen it, there was a reported issue with DHCP on the EtherCard github respository regarding timeout period.

In file dhcp.cpp try changing the following line:

#define DHCP_WAIT 20000 // msec to wait for DHCP address

change the 20000 to 60000 for 60s timeout.

Cheers

SRB

Might be worth a try.

vworp's picture

Re: DHCP fail with current NanodeRF sketch

I've just tested with a spare router with no joy. Also tried the EtherCard/dhcp.cpp timeout tweak with no success. Looks like DHCP is failing network wide when the nanode is powered up, just had a pc refuse to get an IP address until the nanode was unplugged.

Tomorrow, I'll try rolling back to an older iteration of the sketch and libraries and work my way forward from there.

dashrathng's picture

Re: DHCP fail with current NanodeRF sketch

Please let me know if this issue has been resolved. 

I am trying run one of the examples - getDHCPandDNS and I get all the IP addresses as 0.0.0.0.

I used 'ether.staticSetup(myip, gwip, dnsip)' as suggested above and it works fine for me, but the DNS look up for google.com is still failing. 

char website[] PROGMEM = "google.com";

 if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);

The above code prints:

DNS failed.

Server:0.0.0.0

Please suggest me a solution.

 

TrystanLea's picture

Re: DHCP fail with current NanodeRF sketch

Might be worth changing the MAC address on the nanode, that can sometimes help unfreeze things

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.