Yun Shield with Arduino Mega

I am using the Yun Shield with an Arduino Mega. For some reason, when I try to send any build, including an empty project, to the board, I get the following error:

"
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.
"

Any ideas on this? I am running the 1.6.5 Arduino IDE,
Thank you.

Is arduino Mega USB chip put in reset mode?
Does Arduino Yun recognize Mega in Sensors part of the webpage?

racecannon:
::::SNIP::::

Any ideas on this? I am running the 1.6.5 Arduino IDE,
Thank you.

@racecannon,
check your USB cable, also. Make sure it is a data cable and not just for charging.
In the last few months, quite a few of these cable (only intended) for charging have shown up.

The price of copper is the culprit. Even though the prices are normalizing, the demand in China is still high.
http://data.cnbc.com/quotes/%40HG.1/tab/2

Jesse

m4dm4n:
Is arduino Mega USB chip put in reset mode?
Does Arduino Yun recognize Mega in Sensors part of the webpage?

Yes and yes

jessemonroy650:
@racecannon,
check your USB cable, also. Make sure it is a data cable and not just for charging.
In the last few months, quite a few of these cable (only intended) for charging have shown up.

The price of copper is the culprit. Even though the prices are normalizing, the demand in China is still high.
http://data.cnbc.com/quotes/%40HG.1/tab/2

Jesse

The cable works fine programming the mega, as long as I don't use the YUN shield.

racecannon:
The cable works fine programming the mega, as long as I don't use the YUN shield.

I think this is how you will have to use it when uploading sketches - remove the Yun Shield.

Disclaimer: I do not have any experience with the Yun Shield or the Arduino Mega, let alone using them together. My comments are based on analyzing the Yun Shield User Manual and the Arduino Mega Schematic.

Looking at the schematic, you can see the USB interface on the right side of the sheet: IC4. The serial I/O from this chip (M8RXD and M8TXD) pass through a couple resistors (RN4A and RN4B) and connect to the PE0 and PE1 signals. These are the same signals are are connected to the shield digital pins 0 and 1.

The Yun Shield also uses pins 0 and 1 for Bridge communications. Page 7 of the Yun Shield user manual states that it's important to make sure these serial pins are not used by any other hardware. Page 14 shows how to connect to a Mega, and indicates that it is necessary to add a jumper to hold the USB interface in reset. This allows the pins to be used by the Yun Shield.

You indicated that you have added that jumper, and that the Yun can talk to the Mega in this state. But now you want to upload sketches to the Mega, and that requires use of the USB interface.

Obviously, with the USB interface held in reset, you will not be able to connect to the Mega using the USB interface. It simply won't be detected by your computer, and there will be no serial port created for it.

So, it would seem that the solution is to remove the jumper that is holding the USB interface in reset. This will allow the USB interface to be detected by the computer, and the IDE will attempt to download a sketch. However, just as the USB interface can interfere with the Yun Shield's communications with the Mega, the Yun Shield can interfere with the USB interface's communications with the Mega.

It seems to me that to be able to upload a sketch to the Mega using the USB port (or to use the Serial object to communicate over the USB port) it will be necessary to remove the Yun Shield to free up the communications lines.

As an alternative to always removing and reinstalling the Yun Shield, it may be possible to:

  • Hold the Yun Shield's reset button in the whole time that the IDE is trying to access the Mega and upload a sketch.
  • Control GPIO24 on the Linux side to disable the serial communications level shifter on the Yun Shield (U11 on page 3 of the Yun Shield schematic.)
  • Upload the sketch over the network instead of USB (if the Yun Shield supports this feature when connected to a Mega.)

I use the YUN sheild to send all the sketches wirelessly to the Mega. I had this working fine, until I fried the mega trying to wire up a more powerful stepper driver. So, I purchased another Mega. However, before it arrived, the 1.6 Arduino IDE became available. So, I upgraded. Stupid. It was throwing errors regarding the shield. It couldn't understand the YUN sheild config file. So, I had to roll it back to 1.5. Regardless, it is failing repeatedly now. It was working beautifully before. So, I shouldn't have any issues with that. Also, I have nothing but the shield and Arduino connected. There are no other devices connected to the board currently. I can see the Samba share from the YUN shield. The problem can't be with my sketch either, since I can't even upload a blank sketch. It throws the same error.

Setup Dragino and Arduino IDE

sonnyyu:
Setup Dragino and Arduino IDE

I have already done this several times, verified on three different Arduino IDEs.

The uart connection between mega2560 and mega16u2 will influence the bridge feature with Yun Shield. So we have to disconnect it by setting the mega16u2 into reset mode.

I forget put jumper sometime and got AVR device not responding error.

The issue appears to have been something with my YUN sheild. I purchased another one and it seems to be working correctly again. Weird.

Don't update the Yun shield. The newest version does have some bugs.

luckysam:
Don't update the Yun shield. The newest version does have some bugs.

which version are you talking about ?