So, after 30 hours of craziness, debug, trial and error, I went directly to show the board to one of the guys of Officine Arduino here in Italy.And it looks like the shield is defective.OMG.Thanks you all for the support

/* Set this to the offset (in seconds) to your local time This example is GMT + 2 */const long timeZoneOffset = 7200L;

/* Syncs to NTP server every 15 seconds for testing, set to 1 hour or more to be reasonable */unsigned int ntpSyncTime = 15;

/* ALTER THESE VARIABLES AT YOUR OWN RISK */// local port to listen for UDP packetsunsigned int localPort = 8888;// NTP time stamp is in the first 48 bytes of the messageconst int NTP_PACKET_SIZE= 48; // Buffer to hold incoming and outgoing packetsbyte packetBuffer[NTP_PACKET_SIZE]; // A UDP instance to let us send and receive packets over UDPWiFiUDP Udp; // Keeps track of how long ago we updated the NTP serverunsigned long ntpLastUpdate = 0; // Check last time clock displayed (Not in Production)time_t prevDisplay = 0;

// This is where all the magic happens...void loop() { // Update the time via NTP server as often as the time you set at the top if(now()-ntpLastUpdate > ntpSyncTime) { int trys=0; while(!getTimeAndDate() && trys<10){ trys++; } if(trys<10){ Serial.println("ntp server update success"); } else{ Serial.println("ntp server update failed"); } }

// Display the time if it has changed by more than a second. if( now() != prevDisplay){ prevDisplay = now(); clockDisplay(); }}

Indeed while copying the code I added a "z" in it but it "works" here it is with the same bug i was talking about earlier :

Hi Ohhopi,

So I understand you still get the same feed back from Serial: "ntp server update failed"

What did you try to find where the bug is? Did you try my suggestion to start from a tested working example and seeing when it starts failing? Another good thing to do is add a lot of debug printouts. So everytime you think your code does something the Serial prints this out for you so you are sure it is actually the way you expect it to be.

One thing I see that is probably not right is this: in getTimeAndDate() :

Which means you are doing this request every second. According to this pagehttp://tf.nist.gov/tf-cgi/servers.cgi you shouldn't query the servers more than once every 4 seconds. You'll see in the UDPNTPClient example that they wait 10 seconds between each call.

I understand what do you say before...but if i want to the udp connection with the shield wifi(R3) plus an arduino Due what i have to do, because i follow the same passage but something goes wrong. This is the message

I have manage to make the UDP work properly on the WIFI shield without too much hassle.The new version of the Arduino environment (1.0.5) already includes the WIFI shield libraries, and among its examples it has one that uses UDP: go to Examples -> WIFI -> WifiUdpNtpClient

First try:

I have just uploaded the sketch to the Arduino (after setting the proper WIFI SSID and password) but it did not work. In fact, watching at the messages on the serial port I saw:

At some point, where in the Arduino sketch says Serial.println( Udp.parsePacket() ); it was printing me out this 0, meaning that probably the library was not supported by the firmware.

Firmware update:

Be careful about the firmware. It seems that there are two git repositories with the shield's code

this: https://github.com/arduino/wifishield

and this: https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/wifishield/binary

I have used the second one, which was more recent and I think is also the one that is more official, so remember, WIFI shield's firmware is here: https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/wifishield/binary !!!!!

You have to donwload the files wifi_dnld.elf and wifiHD.elf.

Then I have followed the instructions given here:

http://arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading

they are not very good, but all the steps are described at least.As I work on Windows I had to download the Atmel's tools here http://www.atmel.com/tools/FLIP.aspx

Then I removed the shield from the Arduino, put the jumper in programming mode and connected the mini USB port to the computer.If the driver for the AT32UC3 is not found you have it available in your computer inside the Flip folder, in my case here: C:\Program Files (x86)\Atmel\Flip 3.4.7\usb

The I have updated BOTH the HDG104 and the AT32UC3 firmwares.For updating the HDG104 firmware type:

Many thanks dariosalvi, I followed your procedure and got the exact screen printout as yours in upgrading the shield. However when I put the shield back and tried the WiFiUdpNtpClient, I didn't get the same result, looks like that I can't connect to the server. What I discovered is that the router returned an IP address of 0.0.0.0, then I used the scanNetworks sketch to check on the router I used. What I found is that this sketch showed my shield's MAC address is 0:0:0:0:0:0 ! As I remembered my shield MAC address was some number other than all zeros! Does that mean I eraseed the MAC address also during the upgrade? Anyone has the same problem? Help please!