Avrdude Timeout error and USB 1.1 Hub

I'm not sure if this is the correct place to post this since I have solved the problem to my satisfaction. However, doing searches on Google and on the Arduino forum, while I found similar issues, I didn't find this solution. I'm hoping that this information is new and may help others with similar issues.

I purchased an Arduino Mega 2560 about a month ago. The first thing I did when I received my parcel was to plug it into a USB port. It seemed to boot fine. The LED on pin 13 flashed as it should. However, when I tried to upload my own test sketch to the board, the IDE displayed the following error message repeatedly:

avrdude: stk500_2_ReceiveMessage(): timeout

I performed a loopback test which showed no errors. I deleted the serial device from the OS X Network Preferences device list. Still, no go.

I often use the USB 1.1 hub built into my 10 year old Apple Pro keyboard since the ports on the back of my Mac Mini are inconvenient for devices not permanently plugged in. The hub works perfectly fine, and I often use it to transfer small amounts of data to/from usb keys. However, having no other ideas at the moment, I decided to plug the Arduino directly into the Mini, which has solved the problem. I have since programmed my Arduino several times over without further problems.

I don't know if this may be a problem with the firmware of the Atmega 8U2 used as a USB interface chip, but I thought it might be nice to have this problem and solution on record in case someone else has similar issues.

What version of OSX?

I use my Uno with a 1.1 and a variety of 2.0 hubs without issue. However, others have reported issues using the Uno with USB hubs.

the problem probably are with the way the hub chip work. Also problem with uploading passing through an USB hub has been reported. (i've read something on the old forum, so old arduino 2009)

I'm using Snow Leopard, and at the time it was updated to 10.6.3.

I wonder if this is a problem specific to the Una and Mega boards, or if boards with FTDI usb to serial interface chips also had this issue? I would also like to know if the reported problems have been from folks like myself who use usb 1.1 hubs, or are usb 2 hubs also not working correctly in some cases?

I find it odd that a loopback test works just fine, but uploads to the Arduino fail. It doesn't seem likely, even with a keyboard and mouse connected, that even a limited 12mbps usb hub's bandwidth would be maxed out by a 19.2 kbps serial connection. I mentioned earlier a possible need for firmware updates on the 82U, but it seems almost as likely that the boot program on the 2560 could be at fault. I am a bit of a noob with the Arduino, so maybe I'm just blowing smoke here, but it doesn't seem to add up that a loopback test should work fine, but transferring the program to the Arduino fails. If I get some extra time, I may write a script to transfer more substantial amounts of data over loopback and see if it still holds up.

if the mega board hasn't been updated, they should use FTDI chip, arduino UNO is the only one using 82U.

maybe the HUB block some reset code or something similar used by avr-dude(the program that upload sketch)?

Do serial comunication works fine?

if the mega board hasn't been updated, they should use FTDI chip, arduino UNO is the only one using 82U

I'm guessing that the Mega2560 (my board) is pretty new them. It does have the 8U2 chip.

My board is the Mega2560, shown here: http://arduino.cc/en/Main/ArduinoBoardMega2560

I think you are referring to the Mega shown here: http://arduino.cc/en/Main/ArduinoBoardMega

maybe the HUB block some reset code or something similar used by avr-dude(the program that upload sketch)?

I don't believe that this is the case. When I attempt to upload through the hub, the LED on pin 13 flashes as usual to indicate a reboot. Even both RX and TX LEDs flash for a short time. I could attempt a manual reset at the appropriate time during upload to make sure, but the blinking LED I think means that its rebooted. (The sketch that was last uploaded makes use of an LCD display and doesn't touch pin 13.)

Do serial comunication works fine?

I can say with a certainty that the serial com works fine. Loopback works perfectly. Also, I have written a couple different sketches that rely on serial communications. I tested both by going through the hub after connecting direct to my computer for upload, and serial communications work fine with these sketches, no matter what route the data goes through.

This problem is specific to 8u2 based boards. The 8u2 is emulating an USB Modem. While the generic drivers with most operating systems work, they do not always. Think of it this way: A generic device driver on the host is talking to a generic device. Some issues are going to crop up.

Given how few USB Modems exist in the world today and that USB was just getting off the ground when they were around, it isn't a surprise to me that a hub causes an issue (even though it shouldn't.)

The FTDI-based Arduino didn't have this same problem. However in that case, you have specific hardware drivers for specific operatin systems to talk to a specific device (chip). So it is an apples-to-oranges comparison.