Cannot upload project after conecting wi-fi shield

Hi, I got my Arduino mega 2560 rev3 and EMW3162 WiFi Shield. After connecting shield to arduino i cannot upload any sketch to arduino. After about 10 seconds of uploading it i got

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

And if i try to test my connection through WiFi101 Firmware/Certificates Updater i get "connection error: programmer not responding" and

java.lang.Exception: Programmer not responding
    at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:105)
    at cc.arduino.plugins.wifi101.flashers.java.JavaFlasher.testConnection(JavaFlasher.java:51)
    at cc.arduino.plugins.wifi101.UpdaterImpl$2.run(UpdaterImpl.java:110)

Am I doing something wrong ?

It uses serial port and USB too, so there is conflict. You have to disconnect the shield before upload.

So i heave to disconnect shield every time i upload new sketch to arduino ?

Ehm.. yes, or try to upload wireless, via wifi.

But here, http://www.waveshare.com/emw3162-wifi-shield.htm You can read in description

"16. WiFi serial port configuration jumpers connect the WFRX to FTTX, WFTX to FTRX respectively, you can communicate with the EMW3162 through USB TO UART interface connect the WFRX to TX, WFTX to RX respectively, you can communicate with the EMW3162 through Arduino interface " doesn't that mean i can choose with way i want to use ?

Yes, but if you want to use it with the Arduino, Rx/Tx have to be connected.

And they are connected. This error occurs when WFRX is connected to FTTX and WFTX to FTRX and shield is disconnected from arduino and i try to upgrade firmware with usb.

Sorry, I misunderstood you little bit. You are trying to upload via USB which is on the shield. Right? I have no experience with this shield, just studying specification on web.

Shield USB can be used for direct communication with wifi module. The jumpers 16 have to be in FTRX/TX position. In this case the Arduino serial is disconnected from wifi. The second situation is for jumpers in RX/TX position. In this case Arduino can communicate with the wifi but shield USB is disconnected and it doesn't work. In this case could be a problem to upload sketch to the Arduino because two devices are connected to the serial port: 1st - USB/serial transceiver on the Arduino board and 2nd - wifi, due to impedance inadaptability. It is frequent case. There is no schematics of wifi, so hard to say if no or yes. At the moment, the Arduino's USB is disconnected, the USB/serial transceiver disconnects the rx/tx from the ATmega (I/O s goes to high impedance) and the communication between wifi and Arduino should work without the problem.

Here is how it looks aruino ide, mega 2560 and wi-fi shield the connections and my device manager. I can't upload any sketch when shield is on. http://imgur.com/a/6mOBy

What is about it if the jumpers 16 are opened to RX/TX? Are you able to upload? Try it and provide a feedback.

BTW: You are using IDE v1.7.x. It is from .org but here on .cc we use 1.6.x version.1.7 is not higher version of 1.6. It is different SW. Nothing wrong but if you will want any future SW support, I am recommending to go to 1.6.

If jumpers 16 are connected to FTRX and FTTX I am able to upload but i get WL_NO_SHIELD from WiFi.status();

That is exactly I was talking about. In the post #7. It is frequent problem with the impedance inadaptibility of serial line if more than one device are connected at time.

I have my own Arduino version: Another Arduino clone with 1284P. It has not only additional I/Os but in addition it has DTR and RTS signals on extra header. Those are used for Arduino reset prior to upload starts, but in new Arduinos the RTS is not used. I am using modified version of avrdude which keeps RTS active during upload. It enables to disconnect other device from Rx/TX via electronic switch. If USB port is active. I'm using this approach in my designs.

The second manner could be to use wifi also for code uploading (I don't know how about the reset).

So what can I do about it ? 1. Find modified version of avrdude which keeps RTS active during upload ? or 2. Use wifi for code uploading ? and can I find this modified version of avrdude anywhere ?

  1. You need Arduino like my, with the RTS signal output + electronic switch for Rx and Tx driven by the RTS, like 74HCT4066 + modified avrdude. It is simple modification and the avrdude tool is open source. I have modified one, no problem to share.
  2. WiFi is the way but once again, the reset signal (DTR or RTS) from the wifi shield is needed to start the bootloader. You can do this manually by pressing the reset button but it is hard to hit right moment. Less comfort like simply to remove tx jumper. Probably some of GPIO on wifi could be used as reset signal.
  3. Remove the jumper at each upload. :(