Problem while uploading to Yun (board seems to disconnect?)

Hello, I've been using a Yun for about a month and have regular problems with uploading but I've encountered one I can't figure out how to deal with:

-took every shield or wire off the Yun board
-plugged the naked arduino to my Win10 computer with USB
-selected the correct port and board in the tools menu
-with both an empty sketch or a working one
-hit the upload button

it seems to compile just fine, but as soon as is says it's uploading, my computer makes a 'device disconnected' sound. the Rx LED flashes a few times, the Tx is constanly on (red), the on is on (green) and the WLAN blinks slowly(blue).

then it keeps saying 'uploading' for at least 10 minutes, nothing changes.

I checked and the port is still recognized in the tools menu.

then I tried the exact same thing on a Mac:

first time I tried it, it showed an error 'not in sync' 'attempt 1 of 10' but I didn't write it down. after spamming the button out of frustration, it eventually did the same it did on the windows, eternally uploading. Unplugged and replugged the board, it reset to an Uno, reconfigure everything and I get this:

Found programmer: Id = "0
0
0"; type =
Software Version = 0.
; Hardware Version =
.0
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check

avrdude: error: programmer did not respond to command: exit bootloader
avrdude: error: programmer did not respond to command: exit bootloader

I have no idea if this is the same problem with both machines.
as I've said there have been other problems uploading to this board in the past: upon hitting the upload button it would switch to an other COM port and fail to upload. it kept alternating and it did that on different machines too. eventually I think it just stopped happening without doing anything in particular.

It is very interesting. I need more information on this.

McraeDye:
It is very interesting. I need more information on this.

What information? I thought I put everything relevant. Are there tests/experiments you want me to run?

Normal operation for the Yun (or any Arduino based on the '32U4 processor, such as a Leonardo, Pro Micro, and others) is to appear as two different USB devices: one that is active in normal use, and one that is active with the bootloader. I'm not familiar with how it works on a Mac, but on Windows, these appear as two different com ports, each with their own driver.

The first time you plug the Yun (or other '32U4 Arduino) into a particular USB socket on a Windows machine, you will get the device connected sound, and the regular mode driver will load (will take some number of seconds.) The port will appear with a new number. Then, the first time you load code, you will hear the disconnected sound as the normal mode port is closed, then the bootloader port is opened, and it will take some seconds to load that driver, after which there will be a new port number, generally one greater than the other port number. When the upload is done, the bootloader port closes, the normal port opens, and you are back to the original port number.

After that first time, an upload is normally fluid: you hear the sound that the normal port disconnected, then you hear the sound of the bootloader port connecting, then the code is loaded. Then you hear the sounds of the bootloader port disconnecting, and the normal port connecting. As an aside, if you have the Arduino Serial Monitor open, it will automatically disconnect and reconnect as the normal port goes away and comes back. But, if you are using another program to talk to the Yun over the USB serial connection, the port will be closed out from under that program when you load code, and will probably not automatically reopen: you will likely have to tell that other program to close and reopen that port again.

This is all expected behavior so far. However, sometimes things go wrong. I've seen Windows get confused and be unable to load the bootloader driver, perhaps because something went wrong the first time the bootloader appeared on that particular USB socket (Windows loads a new driver copy and assigns a new port number even if the same device is plugged into a new USB socket.) Maybe the Yun was unplugged or reset while Windows was trying to identify the bootloader for the first time on that socket, maybe there was a problem reading the driver file, or whatever. Then, on subsequent times that it enters the bootloader mode, Windows won't recognize it.

Trying to fix this is difficult since the Yun only stays in the bootloader mode for a few seconds, so it's difficult to select the non-working device in the Windows device manager to reinstall the driver. The simplest solution may be to just use a different physical USB port on your computer, and to make sure you do not disturb anything when you load code for the first time and Windows tries to enumerate the bootloader device driver.

in response to @ShapeShifter, (quoting would take up a lot of space)

Thank you for your reply.

I've used this board on a number of different machines but never has it showed up as two different ports. Unless you mean COM 3 which is always there no matter if anything is plugged in.

I used a USB hub to add extra physical USB ports as the board had been plugged in each one (just in case) and when I pugged it in I got a windows notification in the lower left corner of the screen saying it was configuring arduino yun. (good sign?) then is said it was ready, so I sent an upload and the same exact thing happened.

So I tried in on an other port of the hub and again it said configuring. I clicked on it, took me to win10 settings app. It seems to recognize the yun as a keyboard judging by the icon next to it.

I let it stay plugged the time t write this hoping maybe I just leave it enough time before and I'm about to upload again.
No luck. same exact thing again.

If it's a problem with the bootloader, would "burn bootloader" help? I have no idea what it really does and I don't own the board, it's my school's. (currently using AVRISP mkII bootloader and it seems to be default)

also, I have managed to upload from this computer and very probably to this very card (not sure, we have many and it might have been exchanged)

Syborg64:
I've used this board on a number of different machines but never has it showed up as two different ports.

That doesn't mean it didn't happen, only that you haven't noticed it.

Using the information HERE, I showed all of the comm ports on my computer, a portion of which is shown in the attachment. In there, you can see several sets of Yun serial ports:

  • COM6 (normal port) and COM7 (bootloader port)
  • COM11 (normal port) and COM12 (bootloader port)
  • COM15 (normal port) and COM16 (bootloader port)
  • COM32 (normal port) and COM33 (bootloader port)
  • COM39 (normal port) and no associated bootloader port

I suspect that if I were to plug a Yun into the USB ports where it enumerates as COM6, COM11, COM15, or COM32, I would have no issues loading code. But if I were to load code when it is enumerated as COM39, I could have problems. (I don't have time to try plugging a Yun into my multitude of USB sockets and see if it will load code in each one.) I do recall having trouble getting the bootloader to be recognized in the past, but I don't know if it was the Yun enumerated as COM39 - because I do a lot of embedded development (it's not only a hobby, but has been my profession for over 30 years) I occasionally delete the multitude of serial ports or I would have hundreds of comm ports hanging around. So it's equally possible that I plugged a Yun into a port that resulted in COM39, and haven't tried loading code yet from that port.

I used a USB hub to add extra physical USB ports as the board had been plugged in each one (just in case) and when I pugged it in I got a windows notification in the lower left corner of the screen saying it was configuring arduino yun. (good sign?) then is said it was ready, so I sent an upload and the same exact thing happened.

If by the same thing, you mean you heard the disconnected sound, then that means the "normal" port is being closed. But if the "bootloader" port is not being recognized, that seems to be pointing to a problem with the driver setup on your Windows computer which prevents it from recognizing the bootloader port, or perhaps all of those ports have already tried and failed to enumerate the bootloader in the past? I'm not a Windows or driver expert, so I can't really say for sure.

So I tried in on an other port of the hub and again it said configuring. I clicked on it, took me to win10 settings app. It seems to recognize the yun as a keyboard judging by the icon next to it.

Interesting. What sketch is currently loaded on the Yun? Is it a sketch which makes it act like a keyboard or generic HID device? The way I understand it, the bootloader is triggered by the way that the normal serial port is closed/reopened when starting to load code. If the Yun is acting as a HID device, maybe it doesn't react the same way and doesn't enter the bootloader? Perhaps loading a standard sketch (Blink?) will make it work properly? Oh, wait, you're having trouble loading a sketch... (more on that idea in a moment.)

If it's a problem with the bootloader, would "burn bootloader" help? I have no idea what it really does and I don't own the board, it's my school's.

It might. Burning the bootloader means to program a fresh copy of the bootloader onto the board. You need external hardware to do this, either using a programming pod, or using another Arduino as the pod.

But there is another option with the Yun: try loading a sketch over the network (wireless WiFi or wired Ethernet, it makes no difference.) On the Arduino IDE "Port" menu, select the Yun's network address instead of a COM port. Then, when you load a sketch (I would suggest the standard Blink example) it will load a fresh copy of the bootloader when it programs the sketch. It's a useful side effect of programming over the network that it reloads the bootloader.

I have managed to upload from this computer and very probably to this very card

I don't doubt that. Maybe something has changed in the driver files (maybe reload the Arduino IDE?) or maybe it's something in the currently loaded sketch (is it acting as a keyboard?) or maybe the bootloader got clobbered somehow (You mention using an AVRISP mkII, and if that's how code was previously loaded on the board, that could clobber the bootloader.)

DevMgmt.jpg

ShapeShifter:
If by the same thing, you mean you heard the disconnected sound, then that means the "normal" port is being closed.

By the same exact thing I mean it's still stuck on uploading and I can't tell a difference between then and previous attempts .

ShapeShifter:
What sketch is currently loaded on the Yun?

I wasn't there when the last sketch was uploaded (group project) but it's supposed to work with a 4D-systems uLCD with touch using its own dedicated shield and a a base shield to attach sensors. the code itself is something close to this earlier prototype: Link to docs page with the code

ShapeShifter:
Perhaps loading a standard sketch (Blink?) will make it work properly? Oh, wait, you're having trouble loading a sketch... (more on that idea in a moment.)

I have noticed a SD card slot underneath the yun. is that a way to upload code? export compiled to the card then put it in.

ShapeShifter:
try loading a sketch over the network (wireless WiFi or wired Ethernet, it makes no difference.)

I have tried plugging it into my computer's ethernet port with both a direct cable and a cross-over as well as onto my internet box (with both also) and I didn't detect it. do you need to set up something for it to work? am I missing something? (and yes the board had power from a USB, tried with both a only charging and a communication cable). I've done it in class so I know how it's supposed to work. power the board, plug it in the wall ports with a cross-over and it shows up as an IP adress in thr tools menu.

Syborg64:
I have noticed a SD card slot underneath the yun. is that a way to upload code? export compiled to the card then put it in.

Yes, but that's a cumbersome way to do it. You would need to compile your sketch, find the resulting .hex file and copy that to the SD card. Then, put the card into the Yun, and wait for it to boot. Finally, log into the Linux side of the Yun using SSH and a network connection, and type the appropriate commands onto the Linux command line.

The typical ways to load a sketch:

  • Using the USB port and the Arduino IDE, selecting the Yun's USB port in the IDE Port menu.
  • Using a network connection and the Arduino IDE, selecting the Yun's network address in the IDE Port menu.
  • Using a network connection and a web browser: log into the Yun's configuration pages, and there is an "Upload Sketch" section on the page. Click the "Browse..." button and find the .hex file generated by the IDE, and it will transfer the file to the Yun and program the sketch.

I have tried plugging it into my computer's ethernet port with both a direct cable and a cross-over as well as onto my internet box (with both also) and I didn't detect it. do you need to set up something for it to work? am I missing something?

Yes, a DHCP server. If you only have a cable between the Yun and the computer, odds are that neither end will have a network address. Your computer is probably set up to find a DHCP server (usually your main router) on the network, get an address from it, and configure the computer's Ethernet port. By default, the Yun is set up the same way: it is expecting that there is a DHCP server on the network that will give it an address. Without an address, neither the computer nor the Yun will talk over the network.

It is possible to run a DHCP server on your computer, or to enable one on the Yun. But that is beyond the scope of a simple forum thread like this, and enabling the DHCP server on the Yun requires a network connection to configure it - a kind of Catch-22. It's also possible to assign static addresses to the computer and the Yun, and not need a DHCP server, but again, you need a network connection to the Yun to set that up.

Rather than try the direct connection between the computer and the Yuy, the simplest way is to plug both your computer and the Yun into an existing network that has a DHCP server.