edited:
I just found out that there is a different forum for the WiShield 2.0, I posted to the new topic there
viewtopic.php?f=23&t=309
Original post:
This is what is confusing me. You say it all works fine for you. One thing I do see that might be different, my WiShield is v2.0 at least that is what is printed on the PCB.
Could you try this little sketch on your Arduino Mega with WiShield and let me know if it works for you.
It sinks the Time of the Arduino with a NIST server. It works fine on at Duemilanove and on the Arduino Mega with the interrupt remapping. But not on the Arduino Mega with the WiShield and no interrupt remap. (the remap uses interrupt 2 with is on pin 21 which is also SCL of the i2c bus)
Thanks
Tim
Not sure if the sketch is being attached or not. If not I will try again.
attaching did not work, cut and past.
#include <Time.h>
#include <TimeAlarms.h>
#include <WiShield.h>
#include <WiServer.h>
// Wireless configuration parameters
unsigned char local_ip[] = {192,168,11,6}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,11,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"Bismark1"}; // max 32 bytes
unsigned char security_type = 1; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = {0x83, 0x94, 0xf9, 0xa3, 0x94};
// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
//---------------------------------------------------------------------------
//Set up nist time server to sync our time to
byte ip[] = {64,90,182,55};
GETrequest getDaytime(ip, 13,"nist1-ny.ustiming.org", "/");
void setup () {
Serial.begin (9600);
Serial.println ("we are in setup");
WiServer.init(NULL);
WiServer.enableVerboseMode (true);
getDaytime.setReturnFunc (syncTime2NIST);
}
int one = 1;
void loop () {
if (one) {
getDaytime.submit ();
}
one = 0;
WiServer.server_task ();
Serial.print ((timeStatus() == timeSet)?"yes":"no");
Serial.print (hour());
Serial.print (":");
Serial.print (minute());
Serial.print (":");
Serial.println (second());
Alarm.delay (1000);
}
void syncTime2NIST (char *data, int len) {
char *pointer;
byte nistTime[6];
byte n;
Serial.println ("syncTime2NIST");
if (len == 51) { //expecting 51 bytes, the rest relys on that.
pointer = &data[7];
//remove data from return string
for (n = 0; n < 6; n++) {
nistTime[n] = (byte) atoi (pointer);
pointer += 3;
}
setTime (nistTime[3], //hour
nistTime[4], //minutes
nistTime[5], //seconds
nistTime[2], //day
nistTime[1], //month
nistTime[0]); //year
adjustTime (-4*60*60); //advance UTC time to local
}
}