HTTP server only works when serial connected?

Hello - I am completely stumped.

I have a very simple HTTP server working on the arduino - it simply responds to any GET request with a hardcoded response. It all works, as long as I connect a terminal app to the serial port - if I don't, then the communication doesn't work. For example:

  1. Power up arduino, with 5V power and usb. Connect a terminal app - send a HTTP GET request from a browser, and see the response. No problems. Can disconnect the usb and quit the terminal app, and all continues to work fine.

  2. Power up arduino, with 5V power, but no usb - there is no response from HTTP - nothing. The LEDs flash on the board, but I get no response. If I then hook up usb and connect with terminal app, then things start to work (can disconnect and quit and continues to be fine).

I have nothing connected to tx/rx, nor am I making ANY calls to Serial - I am not even using the serial connection, but for some reason, it needs to see a terminal app before the Ethernet server will work.

I am pulling my hair out - completely mystified. Any help is greatly appreciated - something strange is going on.

Here's setup:

void setup()
{
uint8_t ipAddress[] = DEFAULT_IP_ADDRESS;
uint8_t macAddress[] = DEFAULT_MAC_ADDRESS;
Ethernet.begin(macAddress, ipAddress);

delay(100);

restServer.initialize();
}

Where 'restServer.initialize' is my wrapper around 'Server.begin'.

Any help is appreciated - cheers.

b...

Yup - definitely looks like a problem. I am now running just the example web server outlined:

If I run with Serial (ie. just upload the sketch) all is fine. If I then power down the board, remove the usb cable, and power back up, the simple web server does not respond (until I connect back up with a terminal).

Something very very fishy is going on - it's not in my code.

Cheers,

b...

Another way to get it working it to power up, and then hit the reset button on the ethernet shield - this also kicks it into working.

I checked my server setup and have the same issue. The arduino server won't start when power is applied, but will if the reset is pushed after the power is supplied. This is a significant issue in that the arduino won't make a reliable stand alone server as it won't boot back up if there is a power interruption.

Thanks zoomcat- I thought I was going crazy- happy to have confirmed (wasn't 100% it wasn't some other weirdness.

Am shill trying to track down, but I'm a bit outta my league.

Cheers,

b...

It is interesting that I can unplug the USB cable (or the laptop goes in the suspend mode) and then plug the cable back in and the arduino server boots back up.

This has been talked about quite a bit here. The Arduino team addressed it in the latest version of the Ethernet shield. If you search around I believe there was a hack involving adding a small cap that made it more reliable.