WiFi Shield not recognized by Arduino Mega 2560

Hi All

I have trouble connecting my Arduino Mega to my WiFi network. Here's the code in question:

#include "WiFi.h"

byte _ip[] = {192,168,0,122};
char ssid[] = "MyNetworkName";
char pass[] = "password";

void setup() {
	Serial.begin(9600);
	Serial.print(F("Starting Arduino. Free RAM: "));
	Serial.println(freeRam());

	int status = WiFi.status();
	Serial.print(F("Wireless Status: "));
	Serial.println(status);

	Serial.print(F("Wireless Firmware Version: "));
	Serial.println(WiFi.firmwareVersion());


	while (status != WL_CONNECTED) {
		Serial.print(F("Starting Network on SSID: "));
		Serial.println(ssid);
		WiFi.config(_ip);
		status = WiFi.begin(ssid, pass);

		for (int i=10;i>0;--i) {
			Serial.print(i);
			Serial.print(F(".."));
			delay(1000);
		}

		status = WiFi.status();

		Serial.print(F("Status:"));
		Serial.println(status);

	}

 }

First of all, any calls to functions of the WiFi-Object block the process. If I add the following to the beginning of the setup function, the Library doesn't block anymore, but all calls fail, i.e. the connection is not established, the returned firmware number is empty and the status remains on 255 (WL_NO_SHIELD).

pinMode(8, OUTPUT);
digitalWrite(8, HIGH);

This modified behaviour is only observable with pin 8, all other pins lead to the same blocking behaviour. I also tried different versions (1.0.2, 1.0.5, 1.0.6 and 1.6.0) of the libraries and the firmware but that didn't help a thing. When I attach a Serial-to-USB-Cable to the debug port of the shield I only get scrambled data, nothing like a human readable message or interface.

Unfortunately I don't have an Arduino Uno for comparison testing available.

Also the example code from http://arduino.cc/en/Tutorial/ConnectWithWPA shows the same behaviour.

Does anyone have a clue, what the root cause might be?

Thank you and best regards

Stefan

Which WiFi shield are you using?

The official Arduino WiFi shield. Both shield and arduino are Rev. 3 boards

The DFU programming jumper is not installed over both pins, correct?

Did you try to upgrade the firmware?

Yes, the jumper is not installed and I tried different firmware versions (all versions shipped with the library versions listed above)

Sounds like your firmware upgrade failed. I have a WiFi shield I test stuff with, and it works ok to a point. I upgraded the firmware included with IDE v1.0.5.

Yeah. looks like. I just tried to update the firmware once more, but the dfu is not recognised anymore...

Thank you anyway.