Arduino Mega 2560 R3
Moderators: adafruit_support_bill, adafruit

Arduino Mega 2560 R3

by kctan90 on Mon May 06, 2013 4:07 pm

I need both technical support and customer service support here!

I am working on a prototype development using Arduino Mega 2560 R3. It is used for my final year project which is due in 2 days. I have got this same board from sparkfun earlier and it worked fine, until I fried the Vin board, which means I can only turn on the board using the USB port. This is not good because I need to submit the prototype to the client and they are expecting to use it without having to connect it to a computer. So I got a new one expedited from Adafruit last week, and the board was doing fine for the first 2 uploads. After that, uploading takes forever and I keep getting error like this when I try to upload my code to the board:

Binary sketch size: 4560 bytes (of a 258048 byte maximum)
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 the TX and RX LED does not blink at all.

I was using Arduino 1.0.3 earlier but I have also tried using Arduino 1.0.4 on a different computer, which results in the same error. I tried pressing the reset button and the L LED does blink, which means it probably has the bootloader in it. I checked the board.txt as recommended by Arduino forums, but my board.txt file does have =wiring and not = stk500v2 as stated. I need to submit this prototype to my client in 2 days and I really dunno what to do. I got another board from Radio Shack today (because I have no choice), and it worked fine(my codes are getting uploaded properly). I just found out that I cannot return opened products to adafruit, but there is no way Adafruit can do a replacement and have a new (confirmed working) Arduino Mega board to me in a day without sky high shipping fees.

I need help here!!
kctan90
 
Posts: 4
Joined: Mon May 06, 2013 3:57 pm

Re: Arduino Mega 2560 R3

by adafruit_support_mike on Mon May 06, 2013 6:45 pm

I've seen one similar issue, so wierd as it seems, does your code contain the character sequence: '!!!'?

If so, take it out. There's a known-but-obscure bug in the loading code that chokes when it sees three exclamation marks in a row.

As a second option, are you sure you have the correct board type and serial port set under the Tools menu?
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9411
Joined: Thu Feb 11, 2010 1:51 pm

Re: Arduino Mega 2560 R3

by buton on Tue May 07, 2013 8:59 am

I've seen one similar issue, so wierd as it seems, does your code contain the character sequence: '!!!'?

If so, take it out. There's a known-but-obscure bug in the loading code that chokes when it sees three exclamation marks in a row.

As a second option, are you sure you have the correct board type and serial port set under the Tools menu?



i can confirm this.. take out any "!!!" it will do wierd thinks
buton
 
Posts: 54
Joined: Fri May 11, 2012 7:06 am

Re: Arduino Mega 2560 R3

by kctan90 on Tue May 07, 2013 8:09 pm

Yes, I have no !!! in my code. i even try loading just a normal test code that contains no comments or anything. not even a single !. and yes, i selected the correct board. i mean, currently i have 3 boards. so i dont think its a software problem since i am using the same laptop to upload the same code and this is the only board that doesn't work.
kctan90
 
Posts: 4
Joined: Mon May 06, 2013 3:57 pm

Re: Arduino Mega 2560 R3

by adafruit_support_mike on Tue May 07, 2013 9:14 pm

Okay, let's see if udpating the firmware will do any good: http://arduino.cc/en/Hacking/DFUProgramming8U2
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9411
Joined: Thu Feb 11, 2010 1:51 pm

Re: Arduino Mega 2560 R3

by kctan90 on Wed May 08, 2013 10:54 am

I have seen that page and I have tried downloading the hex and FLIP program. But after installing FLIP, I don't know where to proceed from then because I couldn't upload the hex file into the Arduino. The FLIP software I downloaded was Atmel - FLIP 2.4.6. I don't know which device to select as it doesn't have anything that's similar to atmega or atmega 2560 or anything like that. Please let me know where to proceed from here on.
kctan90
 
Posts: 4
Joined: Mon May 06, 2013 3:57 pm

Re: Arduino Mega 2560 R3

by adafruit_support_mike on Wed May 08, 2013 9:05 pm

I don't have FLIP on my machines at the moment, but do you see an item for "at90usb82"? That's the chip on the Mega, and that's what you want to program.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9411
Joined: Thu Feb 11, 2010 1:51 pm

Re: Arduino Mega 2560 R3

by kctan90 on Mon May 13, 2013 10:21 am

nope.. Only have at89-something. :( Could this be like a defect in product or something?
kctan90
 
Posts: 4
Joined: Mon May 06, 2013 3:57 pm

Re: Arduino Mega 2560 R3

by adafruit_support_mike on Mon May 13, 2013 12:00 pm

A bit of Googling around brought me to this walkthrough for programming a chip with FLIP: http://code.google.com/p/micropendous/w ... reWithFLIP

The information on Atmel's website says the current version of FLIP does support the AT90USB82, so if you don't find it in the "Devices" list there's something wrong with the version of FLIP your downloaded.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9411
Joined: Thu Feb 11, 2010 1:51 pm

Re: Arduino Mega 2560 R3

by tbada on Mon Jun 03, 2013 9:32 am

I'm seeing the same problem with a Mega 2560 R3 I just got a few weeks ago from Adafruit. Code I had running on my Uno didn't seem to be responding to serial communications when I tried using it on the Mega. I tried using a simple Echo sample program, still no luck.

I then realized that the code itself wasn't loading at all to the Mega. (Uploading from a Windows XP machine on COM8.) I Googled for others seeing problems, and thought at one point it might have to do with frequent resets that one poster reported.

Then, however, I tried loading the IDE on my wife's OSX machine and uploading the sketch, and wouldn't you know it, everything worked fine.

I still want to figure out the solution on Windows as that's my development environment and ultimately the environment I plan to use in connecting the Arduino (I'm running a Java program that interfaces with the sketch via USB.) Has anyone definitively tracked this down? I've seen a number of other recent posts (last 2 months) on different forums that report this problem with the Mega 2560 R3 specifically, so it sounds like something's going wrong systemically. Maybe a problem with how it's communicating with Windows?

Hoping for a quick response. I'm working on a project that needs the number of I/O pins that Mega provides, and it goes "live" in 1 week (June 10th). Backup plan will be to run on OSX until this gets resolved.

Thanks in advance for any help on this.
tbada
 
Posts: 2
Joined: Fri Apr 12, 2013 6:09 pm

Re: Arduino Mega 2560 R3

by adafruit_support_bill on Mon Jun 03, 2013 10:21 am

@tbada - When it fails to upload, what error messages do you see?
Once it uploads, are you able to see serial communication over the USB connection?

The R3 Megas have been out for a while now and we haven't had many reports of problems. Most come down to bad cables or missing drivers. There have been a few with bricked 16U2 chips, but if yours is talking to the OSX machine, it is clearly not bricked.
User avatar
adafruit_support_bill
 
Posts: 29610
Joined: Sat Feb 07, 2009 9:11 am

Re: Arduino Mega 2560 R3

by CircuitBurner on Mon Jun 03, 2013 10:36 am

just recently, I put 2 and 2 together and determined the same problem you have that happens to me now and then, no rhyme or reasoning to timing it seemed, was in fact the loaded sketches that use digital ports 0, and 1 and if the sketch loaded in the arduino (you know how they run as soon as any power up) if the program happens to be machine-gunning bits out the ports constantly as it runs, uploading new sketches can flake out just as described...or be hit and miss roulette.
I figured out by pulling digital 0, 1 plus any other digital I/O lines for that matter before uploading, makes a world of difference.
Yellow LEDs make their high speed frenetic wiggle like we expect, lol.
This may or may not be the solution in your case, but something wise to know, because 'it does happen' either way.
Good luck!
AMSAT terrestrial loc - (grid square) EM-12

wings are for fairies, and runways are for fashion models!
User avatar
CircuitBurner
 
Posts: 21
Joined: Mon Apr 15, 2013 1:18 am
Location: grand prairie, texas

Re: Arduino Mega 2560 R3

by tbada on Mon Jun 03, 2013 1:06 pm

@CircuitBurner: The underlying mechanisms you describe fit well with my situation. In my code, and in the serialECHO program I tried, there are write statements coming back to the computer to give feedback. If these are colliding with the upload it would cause problems.

Do you have any sample code for pulling the pins before writing? I'm new to the communications side of all this so I'm not certain how you'd do that prior to uploading code. Is it through the Serial Monitor?

It took me awhile to figure out on the Uno that example serial communications code I was finding needed to have some delays added in to work. I wonder if the issue here is that the Mega needs different delays due to it being a different (faster?) processor than on the Uno?


@adafruit_support_bill: The error message I was seeing originally was the same as the original poster on this thread, (except for the size of my sketch). I won't repeat here because they are literally identical. It looked like the IDE tried numerous times to communicate, then gave up.

After I did get it loaded, however, things still were not quite right. Even using the Serial Monitor in conjunction with the serialECHO code, nothing would come back (when there should have been mirroring.) I'd try strings of 3-4 characters, but no success.

Then something odd: I typed a string of about 30 random characters into the Serial Monitor text field and all of a sudden the serialECHO program started working normally. Typing even short strings from that point on was working.

Flush with success, I tried uploading my own program (which again works fine on a Uno I have connected with the same USB wire to the same computer). Now when I send a string the Rx leds flash, but there's never a transmit light (and there should be, as they do send things out.)

I'm not sure what it could be about the long string, other than some sort of timing issue and/or some certain character sequence that "unsticks" the problem? Is there some sort of timeout mismatch issue in using this (faster?) chip? Is there more overhead in getting set up to do serial communications that would require a longer initial delay?

Sorry for the long post, but hopefully this will helps others down the line as well.
tbada
 
Posts: 2
Joined: Fri Apr 12, 2013 6:09 pm

Re: Arduino Mega 2560 R3

by Fozzie on Mon Jun 03, 2013 1:49 pm

I recently got a MEGA and couldn't get it to upload at first either. Then I read that if you are runnings W7 64 bit you have to make sure that you get the proper device driver in. I had assummed that if it worked with the UNO it would be no different with a MEGA--wrong. Once I pointed my machine to the driver folder of my Arduino install it recognized the MEGA and things have worked fine ever since.
Fozzie
 
Posts: 20
Joined: Sun Mar 17, 2013 9:53 am

Re: Arduino Mega 2560 R3

by CircuitBurner on Mon Jun 03, 2013 2:07 pm

I was talking about physically pulling the digital I/O lines out with fingers, hehe.
Im working on a english/spanish translator bot and in testing stages, its repeating phrases and sentences between an interval.
I had to pull out the I/O wires to upload...then I got smart and used a small reed relay DPST (dual pole, single throw) and used a momentary push button that energizes the coil and opens two circuits at once... Digital 1, and 0.
When sketch loads, release button... stupid simple but it sure makes things easier.
AMSAT terrestrial loc - (grid square) EM-12

wings are for fairies, and runways are for fashion models!
User avatar
CircuitBurner
 
Posts: 21
Joined: Mon Apr 15, 2013 1:18 am
Location: grand prairie, texas