jdecked / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

STK500V2 bootloader on Mega 2560 fails on sketches containing !!! #392

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to upload a sketch to a Mega 2560 that contains "!!!".

What is the expected output? What do you see instead?

The upload fails.

See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288392931 for a report of 
this.

Original issue reported on code.google.com by dmel...@gmail.com on 6 Nov 2010 at 6:01

GoogleCodeExporter commented 9 years ago
I have this fixed. I will get the changes posted soon

The problem is the code looks for "!!!" to switch to the monitor. This was 
copied out of the previous bootloader.  What causes it to not work is it NEVER 
stops looking for "!!!" so if it finds it in the middle of programming, it 
jumps to the monitor.

Mark

Original comment by mark.l.s...@gmail.com on 10 Nov 2010 at 2:36

GoogleCodeExporter commented 9 years ago
Issue 459 has been merged into this issue.

Original comment by dmel...@gmail.com on 16 Jan 2011 at 1:47

GoogleCodeExporter commented 9 years ago
I just updated Mark's fix for this. I just need to create a test that show's it 
working. Then I'll upload both.

Original comment by rick.rickanderson on 21 Jan 2011 at 5:46

GoogleCodeExporter commented 9 years ago
Hi Rick, any news concerning the fix? Thanks!

Original comment by jhochenb...@gmail.com on 26 Jan 2011 at 1:19

GoogleCodeExporter commented 9 years ago
Attached is that patch to apply, and attached is the test for it.

In the repository do:
git apply issue392patch.diff
cd ./hardware/arduino/bootloaders/stk500v2/
make mega2560

Then use AVRDUDE to burn the new boot loader.

Original comment by rick.rickanderson on 6 Feb 2011 at 8:50

Attachments:

GoogleCodeExporter commented 9 years ago
I've been having the same problem and I am attempting to use the patch to try 
to fix the error on Mac OSX. Just wondering how to actually apply this patch.

Thanks

Original comment by soundofs...@gmail.com on 7 Jul 2011 at 11:32

GoogleCodeExporter commented 9 years ago
Issue 746 has been merged into this issue.

Original comment by dmel...@gmail.com on 13 Dec 2011 at 3:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This code fixes the problem on the Mega2560, works fine after re-loading the 
boot loader.
HOWEVER, the code is still not in the production build as of 14/Dec/2011 and 
still requires the modification to be made manually.

Original comment by practica...@gmail.com on 14 Dec 2011 at 5:17

GoogleCodeExporter commented 9 years ago
I bet getting Arduino 1.0 out was a huge undertaking, but it would be nice if 
this issue had been resolved in it.  I nearly went mad whittling a program down 
to the "!!!" as a source of a failure to load.

Original comment by pske...@pulse-robotics.com on 10 Feb 2012 at 4:34

GoogleCodeExporter commented 9 years ago
I hit this problem with 'binary' data blob generated by a tool included into a 
sketch.

Original comment by khau...@gmail.com on 17 Feb 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Here's a more minimal patch from WestFW.

Original comment by dmel...@gmail.com on 19 Feb 2012 at 4:09

Attachments:

GoogleCodeExporter commented 9 years ago
I solve an issue where I couldn't upload the Mega 2560 by using one time Visual 
Studio + plugin ArduinoForVisualStudio.

Original comment by fxd...@gmail.com on 11 Mar 2012 at 7:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The diff gives me an error 100644->100755 if i remember correctly.
Can you give us a right hex file and the method to upload it via AVRDUDE using 
the USB cable? I can't use my brand new rev3 mega with the libraries i have..

Original comment by drg...@gmail.com on 24 Mar 2012 at 12:24

GoogleCodeExporter commented 9 years ago
Frequently (not every time) I'm getting timouts uploading my sketch to my brand 
new Mega R3 (Arduino 1.0 on OSX 10.6.8).  I don't have !!! in my code, but I'm 
hoping this patch helps anyway.  The problem is I have no idea how to implement 
this patch.  I've never burned a new bootloader, but I could probably figure 
that out with all the examples in the internet.  Can someone just upload a 
completed bootloader file and I can try to burn it to my Mega R3.

Original comment by scott.go...@gmail.com on 25 Mar 2012 at 1:18

GoogleCodeExporter commented 9 years ago
Patch stk500.diff produces and HEX after make that is no able to be uploaded, 
avrdude rejects it with size/memory position some kind of error.

I used the other one and apart the warnings of expected 100644->100755... and 
white space line, all is ok after make and burn the bootloader.

So my question now are:

1- if the first diff has all the necessary and we can ignore the more recent 
and smaler one (stk500.diff)?
2- searching for more information I came out with this issue here: 
http://code.google.com/p/arduino/issues/detail?id=181&q=bootloader%202560
so I ask if the provided bootloaders by Mark on his GIT link are more recent 
and with more fixes than the generated with the diff's provided here?

Thanks.

Original comment by baltasa...@gmail.com on 19 Apr 2012 at 11:29

GoogleCodeExporter commented 9 years ago
Just to update, I checked the stk500boot.c inside of the zip file from the link 
on my second questions and looks like it's newer and with all this and other 
necessary fix's.

Here is the part that specifies what was done:

//************************************************************************
//* Edit History
//************************************************************************
//* Jul  7, 2010    <MLS> = Mark Sproul msproul@skycharoit.com
//* Jul  7, 2010    <MLS> Working on mega2560. No Auto-restart
//* Jul  7, 2010    <MLS> Switched to 8K bytes (4K words) so that we have room for 
the monitor
//* Jul  8, 2010    <MLS> Found older version of source that had auto restart, put 
that code back in
//* Jul  8, 2010    <MLS> Adding monitor code
//* Jul 11, 2010    <MLS> Added blinking LED while waiting for download to start
//* Jul 11, 2010    <MLS> Added EEPROM test
//* Jul 29, 2010    <MLS> Added recchar_timeout for timing out on bootloading
//* Aug 23, 2010    <MLS> Added support for atmega2561
//* Aug 26, 2010    <MLS> Removed support for BOOT_BY_SWITCH
//* Sep  8, 2010    <MLS> Added support for atmega16
//* Nov  9, 2010    <MLS> Issue 392:Fixed bug that 3 !!! in code would cause it to 
jump to monitor
//* Jun 24, 2011    <MLS> Removed analogRead (was not used)
//* Dec 29, 2011    <MLS> Issue 181: added watch dog timmer support
//* Dec 29, 2011    <MLS> Issue 505:  bootloader is comparing the seqNum to 1 or 
the current sequence 
//* Jan  1, 2012    <MLS> Issue 543: CMD_CHIP_ERASE_ISP now returns 
STATUS_CMD_FAILED instead of STATUS_CMD_OK
//* Jan  1, 2012    <MLS> Issue 543: Write EEPROM now does something (NOT TESTED)
//* Jan  1, 2012    <MLS> Issue 544: stk500v2 bootloader doesn't support reading 
fuses

Anyway, if someone is interested in using this new bootloader for mega2560 the 
included HEX file on the zip doesn't work, we have to compile again agains 
Arduino GIT repository using the source file on that zip.

Original comment by baltasa...@gmail.com on 21 Apr 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Hi all, 

I have been search the web for a resolution to this Mega 2560's watch dog timer 
issue.

Is this the solution? If so, how does one go about using it?

Thanks!

Original comment by christop...@gmail.com on 9 May 2012 at 2:44

GoogleCodeExporter commented 9 years ago
I've compiled a version of the bootloader for testing in the hopes of putting 
it into production.  It's based on the latest version of Mark's code; we just 
added a Makefile.  You can find the code here: 
https://github.com/arduino/Arduino-stk500v2-bootloader and the hex file here: 
https://github.com/arduino/Arduino-stk500v2-bootloader/blob/master/goodHexFiles/
stk500boot_v2_mega2560.hex

Can you try this one out and let me know if you have any problems?  

In particular, I've sometimes seen uploads fail (with a verification error) 
when uploading very large programs (e.g. ~250 KB).  Does anyone else see this 
behavior?

Original comment by dmel...@gmail.com on 18 May 2012 at 7:04

GoogleCodeExporter commented 9 years ago
How should we burn the new bootloader, when I copy the hex file into my 
Arduino.app directory on my mac (running Lion) - overwriting the existing 
version and then re-start Arduino, go into Tools | Burn Bootloader - I get 
"avrdude: usbdev_open(): did not find any USB device "usb"" - probably because 
it runs the command line with -Pusb instead of -P/dev/tty.usbmodemfd131 - but 
even if i replace the -P option and re-run the command line, I end up getting 
the attached logfile output.  

It appears to find the device, I get some output including the following:

         AVR Part                      : ATMEGA2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53

but mostly it just cycles on the 

avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 

Original comment by danielga...@gmail.com on 27 May 2012 at 4:54

Attachments:

GoogleCodeExporter commented 9 years ago
To re-burn the bootloader, you need an ISP (in-system programmer) like the 
AVRISP mkII.

Original comment by dmel...@gmail.com on 27 May 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Issue 797 has been merged into this issue.

Original comment by dmel...@gmail.com on 14 Jun 2012 at 2:43

GoogleCodeExporter commented 9 years ago
I tried the hex file in comment 20 with my 2560 rev3 board.  it seemed to have 
fixed my 'triple bang' problem (some random sequence in the code, not anything 
I could have avoided).

I did not try a large file but the 25k or so of ported 328p code I used to test 
DID upload and didn't time-out like the shipping code does.

I'd recommend that this be the new shipping code.  (I had to buy the avrisp2 to 
burn this; and that was an extra time/expense that I did not plan on).

Original comment by bryan.le...@gmail.com on 23 Aug 2012 at 8:58

GoogleCodeExporter commented 9 years ago
This is still a problem on my Mega ADK

Original comment by slmil...@gmail.com on 10 Feb 2013 at 10:39

GoogleCodeExporter commented 9 years ago
I still have the same problem!

Original comment by lim...@gmail.com on 11 Feb 2013 at 12:10

GoogleCodeExporter commented 9 years ago
Please look at the patch here:

https://github.com/arduino/Arduino/pull/1183

The updated hex bootloader is available here:

https://github.com/cmaglie/Arduino/blob/mega2560-bootloader/hardware/arduino/boo
tloaders/stk500v2/stk500boot_v2_mega2560.hex

Please check it out and report on github 
https://github.com/arduino/Arduino/pull/1183 success or failures.
Thank you!

C

Original comment by c.mag...@arduino.cc on 11 Feb 2013 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by c.mag...@arduino.cc on 11 Mar 2013 at 11:58

GoogleCodeExporter commented 9 years ago
I was able to fix this issue by removing "!!!" from my code.  As stated from 
the response from  dmel...@gmail.com on Nov 6, 2010.  I did a find for "!!!" 
and just made it "!" and it worked !!

g

Original comment by garyjalv...@hotmail.com on 3 Apr 2013 at 12:11

GoogleCodeExporter commented 9 years ago
Why has this not been fixed? I spent about 4 hours trying to figure out what 
had broken on a brand new mega.

Original comment by mike.ila...@gmail.com on 2 May 2013 at 12:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This still seems unresolved.  I ran into this issue today (15 Dec 2013):

Arduino IDE 1.0.5, Mega ADK R3, Linux Mint 15 (Olivia) KDE.

Original comment by marty.va...@gmail.com on 16 Dec 2013 at 2:01

GoogleCodeExporter commented 9 years ago
The problem was in the bootloader burned in the Atmega2560, just upgrading the 
IDE is NOT sufficient to solve the problem, you must upgrade the bootloader on 
the CPU using an AVR ISP programmer or similar.

The patch, with some discussion is here:

https://github.com/arduino/Arduino/pull/1183

The updated firmware is available in your Arduino installation or here:

https://raw.github.com/cmaglie/Arduino/8fa7d94a45b58696cd828f6a637f9da3b5404180/
hardware/arduino/bootloaders/stk500v2/stk500boot_v2_mega2560.hex

C

Original comment by c.mag...@arduino.cc on 16 Dec 2013 at 12:00

GoogleCodeExporter commented 9 years ago
Issue 459 has been merged into this issue.

Original comment by c.mag...@arduino.cc on 25 Dec 2013 at 4:16

GoogleCodeExporter commented 9 years ago
Issue 459 has been merged into this issue.

Original comment by c.mag...@arduino.cc on 29 Dec 2013 at 7:25