WiFi Udp NTP client / firmware updates / Xively timestamp / Xively -1 error

Hi all,

I have an R3 MEGA 2560 with Arduino's WiFi shield and am having several issues - I hope someone can point me in the right direction. I'm using it to do some data collecting and logging to an SD card and updating a Xively stream. I'm having several issues:

1) inconsistent connections to Xively: I only get a 200 OK response from xively about 75% of the time - most of the errors are -3 or -4, but some are -1. This wouldn't be a big deal, but often, after running for anywhere for a few hours to a few days, all requests fail and the only response I get is -1. I have it set up so that if it has too many failures in a row it will reset the wifi connection - this will fix the problem if it got stuck with a -3 or -4 error, but it won't fix the -1 connection error. If I do a manual reset it doesn't have a problem connecting (aside from the typical -3 or -4 errors). I looked up a -1 error and it means 'connection to api.xively.com has failed' but I don't know how to fix it - any ideas? I have a fairly good signal (-50 to -70 dBm), using WPA security on the router.

2) Xively library parsing error: When downloading data from a xively feed, it occasionally (maybe 3% of the time) has an error in reading the data value and will either duplicate a digit or two, or drop a digit or two. Digging through the libraries, I think it has to do with the String.h core, which is responsible for parsing the string into a number, but I can't figure out what would cause it to have the digit error. Note, an example response from Xively is: "Status,2013-07-15T18:16:52.643526Z,3.00". Also, my code does use an interrupt routine, but I can't imagine this would lead to this type of error. Any ideas?

3) I also want to record the date and time for each data point, but am having a heck of a time: the xively string has a timestamp, but there's no easy library command to pull it out and I'd have to heavily modify it to pull it out and return it in to the main code; I could use the UDP NTP client example in the new 1.0.5 compiler, but the example code just returns "0" once it's connected to the server; some searching found a suggestion that it might be a firmware issue; I update the firmware on the wifi shield and now the wifi shield can't get a MAC address assigned (just gets 0:0:0:0:0:0). Is there a way to fix these issues, or another way to get the arduino to figure out the real world time?

The code is quite lengthy so I don't want to post the whole thing here, but most of the issues can be replicated using the basic examples. Let me know if you have any questions. I have a bunch of hacks and work arounds for these issues, but would like to properly fix them - thank you all for your help!


Do you have a SD card in the shield’s slot? If you do, and it is not disabled or initialized, it could cause those types of errors.

I do have an SD card loaded, but it is initialized.

My project is very similar and I have exactly the same problems ! (error -1 Xively and impossible to recover the time NTP)

I have not updated the firmware Shield Wifi ... but obviously it does not work?

If you find some info on your side, I'm interested. In contrast, if I progress, I'll post here.