-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hello:
In the last two years, I have been updating Dick Cappels' AttoBASIC for certain flavors of the AVR. I just received an ARDUINO Mega 2560 R3 and was adding support for it to AttoBASIC. I had to use ISP to enable JTAG debugging and blew away the bootloader so I could debug on the hardware.
I realize that technically this is not an issue because the HEX files are available. However, I would like to have the source code for the "stk500v2" bootloader so I can compile it for various clock frequencies (AttoBASIC doesn't just work on ARDUINO) and include it in the versions of AttoBASIC that contain a bootloader for someone to ISP program into their part and still have a bootloader available.
I have found the newest version of the source code in the ARDUINO IDE (version 1.0.5) and managed to successfully compile it at several different clock frequencies. The problem is that even the newest version of the stk500v2 bootloader source, "stk500boot.c" dated "2013-05-17", does not seem to work.
Here's what's happening. Using the avrdude (version 5.11.1) command line:
[code]
avrdude -p atmega2560 -c stk500v2 -P /dev/ttyUSB0 -U flash:w:ATTOBASICV230_m2560-16MHZ-uart_nobtldr.hex
[/code]
... yields an avrdude error of:
[code]
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x1e9801
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: stk500v2_command(): command failed
avrdude done. Thank you.
[/code]
This happens when using the ARDUINO IDE as well. Yes, I know its using avrdude and I would expect to see the same error.
Using "avrdude -p atmega2560 -c stk500v2 -P /dev/ttyUSB0 -e" does the same so it appears there is a problem erasing the FLASH on the mega2560.
If I use the HEX file named "Mega2560-prod-firmware-2011-06-29.hex" contained with the "stk500v2" folder then then I can consistently upload via avrdude without error. The ARDUINO IDE uploads fine as well.
I can tell you that the HEX file I compiled shows no difference when compared to the "stk500boot_v2_mega2560.hex" HEX file in the "stk500v2" folder, which exhibits the same failure. Yet there are considerable differences between the "Mega2560-prod-firmware-2011-06-29.hex" and "stk500boot_v2_mega2560.hex" files.
I have not reprogrammed the on-board Mega16U2.
I am am somewhat familiar with C/C++ programming but not fluent. AttoBASIC is completely assembly language.
What other information does anyone need to know to assist in resolving this issue?
Peace,
Scott