Loading Sketches Problem with Mega2560 and Ethernet Shield

I have a Mega2560 with an Ethernet Shield, and I have found that I have to remove the Ethernet shield to get my sketches to load.
Here is my standard operating procedure to compile/load/test a sketch...

  1. Unplug USB/power to Arduino
  2. Remove Ethernet Shield from Arduino Mega
  3. Plug in USB/power to bare Mega board.
  4. Confirm that COM5 shows up in Tool/Serial Port
  5. Compile/Load Sketch
  6. Fails to Upload the first time and times out...I can tell it fails by watching that the TX/RX LEDs do not blink steadily.
  7. Unplug USB/Power, then plug in USB/Power
  8. Confirm that COM5 shows up in Tool/Serial Port
  9. Compile/Load Sketch
  10. Usually is successful this 2nd time attempt and the TX/RX LEDs flash and Arduino gets to "Upload Done".
  11. Unplug USB/power to bare Arduino
  12. Re-attach the Ethernet Sheild
  13. Plug in Arduin USB/Power
  14. Test Sketch

This is becoming a big time sink and I am hoping someone can suggest something to help.

Thank you in advance.

I have to add...
I am using Arduino 1.0 IDE
My Mega 2560 is NOT a Rev3, so it does not have the 2 pins closest to the USB port.
My Ethernet Shield IS Rev3 compatible, so it attaches with an offset so that 2 sets of 2 pins are hanging free, to where they would have plugged into a Rev3 Mega. I bent them away, slightly, to ensure that they do not short to the power cap on the Mega.
Thought these details might help.

Thanks again.

My Mega and shield work fine. I do not need to disconnect the shield to program it. Maybe your shield has a defect?

I know this question sounds a bit strange, but do the Serial.read(), Serial.print() and Serial.println() routines work ok after you program the Mega and install the shield?

SurferTim,
Thanks for the reply, but "yes" everything, including the Serial.read() Serial.print() and Serial.println() work fine.
I cannot imagine that it is defective because everything works once loaded and running. I'm successfully serving webpages, etc. as well as use the onboard SD card to log files and access them through the webserver.

I have a Mega2560 with an Ethernet Shield

You don't say what ethernet shield you have, as there are several types. The wiznet shields with PoE support specify that they have to be removed from the arduino in order to load programs on the arduino.

zoomkat,
Thanks. I forgot that detail :stuck_out_tongue:
It is a Wiznet chip model: Arduino Ethernet Shield Ethernet (R3)

Does the R3 mean with PoE support?

zoomkat,

This is the exact model..

In the description, it states...
"The shield does not come with the PoE module built in, it is a separate component that must be added on."

I've just seen the warnigs like the one included in the below link (the schematic link might provide the reason why). The origional wiznet ethernet shield required a small mod to overcome loss of power recovery issues. These might be included in the PoE versions and affecting the normal board code upload/reset sequence.

http://www.ebay.com/itm/Arduino-W5100-Ethernet-Shield-support-micro-SD-Card-POE-Mega-1280-2560-00930-/180795770741?pt=LH_DefaultDomain_0&hash=item2a18448775

zoomkat,
Understood, but I'm not clear if this only applies once you add the PoE module, or if it remains true even without.
However, if you look at my original procedure, above, it still does not explain why, even with the Ethernet removed, I have to go through the upload process twice. Once with a failure to load, then the second is successful. This is VERY reproducible.
This does not occur with other simple example sketches, non Ethernet Sketches. However, I have not tested to see if Ethernet simple examples load the first time.
I can test that.
Even so, I'm not sure what is going on. Is it possible that something in my Sketch is causing the issue, even though I have absolutely no errors in the compile?

Per the below quote from your board link, you appear to have a PoE ethernet shield that requires removal to load programs. The bottom link describes the issue with the old boards and the workaround. If you want to be on the cutting edge, you can study the wiring differences between your new shield and the old shields to figure out what needs to be temporarly cut/jumpered to allow installed shield program loading.

The shield also includes a reset controller, to ensure that the W5100 Ethernet module is properly reset on power-up. Previous revisions of the shield were not compatible with the Mega and need to be manually reset after power-up.

zoomkat,
Thanks. Good info for me. I will check this out.
For now, during development, I can deal with it. After I install the final solution, it would be preferable that future upgrades to code do not require me opening the panel and pulling off the board.
Thanks.

I had the same issue, and the problem was than the USB connector from my computer doesn't give enough power to the board +shield, but it's enough for the Mega.

You can try using an external source for power when uploading sketches, or a powered usb hub

Alberto,

Thanks for that. I used an external power source and it works fine now.

DG