Ethernet Shield

Hi I'm new on this. I'm working with the Mega 2560 and the Ethernet Shield. When I upload the program, this is what the error that print

avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_command(): failed miserably to execute command 0x10 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_command(): failed miserably to execute command 0x11 avrdude: stk500v2_disable(): failed to leave programming mode

What that means?

Does it upload the sketch ok if the shield is removed? Windows, Mac, or Linux?

Do you have an appropriate com port selected?

Is windows and before the upload is complete it crash. This is my code using the example of DhcpAdrressPrinter:

Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13
    */
    #include <SPI.h>
    #include <Ethernet.h>
    // Enter a MAC address for your controller below.
    // Newer Ethernet shields have a MAC address printed on a sticker on the shield
    byte mac = {0x00, 0xA2, 0xB3, 0xC4, 0xD5, 0x02 };
    byte ip = { 192,168,2,101};
    byte server = { 192,168,2,7 };
    // Initialize the Ethernet client library
    // with the IP address and port of the server
    // that you want to connect to (port 80 is default for HTTP):
    EthernetClient client;

void setup() {
// start the serial library:
Serial.begin(9600);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// no point in carrying on, so do nothing forevermore:
for(;:wink:
;
}
// print your local IP address:
Serial.print(“My IP address: “);
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(”.”);
}
Serial.println();
}

void loop() {

}

Can you upload and run the simple "blink" example program?

Every example I try o write it says the same. Even the copy/paste.

I'm using Mega 2560

You ignored my com port question. You may be trying to upload to an internal modem on your computer. You may also have a bad USB cable.

I'm using com1 and the usb cable is good because I already used to upload other programs.

I'm using com1

Com 1 thru 4 are often hardware serial ports occupied by modems, bluetooth gizmos and such. You need to verify that the mega has established a virtual com port on your pc and verify that it is actually com 1. The arduino IDE has a drop down to select an available com port to use. Verify the corrrect port is selected in the IDE.

Where did you buy your Ethernet shield from? eBay?

Remove it from the Arduino and then upload your code.

I already did that and it upload perfectly, but when I connect the Ethernet shield again don't print anything.

Some Ethernet shields cause that issue, especially the ones sold on eBay. Some people bends pins 0 and 1 on the shield so that they don’t connect to Arduino when plugged in.

Yes,mine is from ebay. Question, if I connect the ethernet shield it suppose to be in my network connection. Because I have 3 laptops connected in the same network and the arduino does not appear.

I already did that and it upload perfectly, but when I connect the Ethernet shield again don't print anything.

If you have a PoE type shield like below, then was there a warning where you bought it like below? There has been a workaround for this type of ethernet shield posted so the board can stay attached while uploading programs.

(Buyer may need to upload sketches to the Arduino mainboard without attaching this ethernet shield on it. Otherwise the sketches cannot be uploaded.)

http://www.ebay.com/itm/W5100-Ethernet-Shield-SD-Card-POE-ready-for-Arduino-2009-Mega-1280-2560-00930-/180855422705?pt=LH_DefaultDomain_0&hash=item2a1bd2bef1

AnddyPR: Yes,mine is from ebay.

Re-read your item's description. It says you have to disconnect the shield.

AnddyPR: Question, if I connect the ethernet shield it suppose to be in my network connection. Because I have 3 laptops connected in the same network and the arduino does not appear.

Is your sketch running the NETBIOS protocol? (Hint, it's not.) NETBIOS is how PC's running a full blown operating system (and higher levels of the networking protocol stack) about each other.

Discussion on how to use the reset button.

http://arduino.cc/forum/index.php/topic,67777.msg586050.html#msg586050

That is the same I have. When I upload the program to the Arduino, which pins must be used to connect the Ethernet Shield in the Arduino Mega 2560?

I upload the program without the ethernet shield, but when I connect the ethernet shield and click the serial monitor this what appears

processing.app.SerialException: Serial port ‘COM1’ already in use. Try quiting any programs that may be using it.
at processing.app.Serial.(Serial.java:144)
at processing.app.Serial.(Serial.java:91)
at processing.app.SerialMonitor.openSerialPort(SerialMonitor.java:204)
at processing.app.Editor.handleSerial(Editor.java:2415)
at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:352)
at java.awt.Component.processMouseEvent(Component.java:6260)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4235)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

I upload the program without the ethernet shield, but when I connect the ethernet shield and click the serial monitor this what appears

Probably the easiest solution for you is to purchase another ethernet shield with out the PoE/upload issues. :roll_eyes: