Go Down

Topic: Arduino Mega2560 as ISP to program another Arduino Mega2560 (Read 36066 times) previous topic - next topic

testato

Nobody know why on UNO it is not necessary change the fuses and on the MEGA it is necessary. (or at least i do not know anyone that have an answer).

for now the only way is change the fuses, the Bootrst is your target, but please study the datasheet and understand what you do, because it is possible brick the chip if you make error whit the fuse.
- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

NicoHood

It would be nice of some can figure it out how this works. The you could program any Arduino with the 16u2.

See this and this:
https://groups.google.com/a/arduino.cc/forum/#!msg/developers/V_T-Uvj8hSs/h9xlGyM9cJoJ
https://github.com/NicoHood/Hoodloader

testato

interesting the hoodloader, i sent you a pm.
i can write a new virtualboard for resolve the "Not Run Mega problem"
- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

NicoHood

we fixed the problem. fuse BootRST must be set to 1. to execute the program. Somehow its not needed for an uno.
stay tuned on further hoodloader releases ;)

mart256


we fixed the problem. fuse BootRST must be set to 1. to execute the program. Somehow its not needed for an uno.
stay tuned on further hoodloader releases ;)


Great.

westfw

Quote
BootRST must be set to 1.

That seems odd.  Exactly what are your (working) fuses set to, now?

NicoHood

#21
Aug 12, 2014, 11:36 am Last Edit: Aug 12, 2014, 02:24 pm by NicoHood Reason: 1
Add this to your boards.txt and burn the bootloader once. The bootloader is not used, its just to change the fuse. Then you can upload via isp and the sketch will load

Code: [Select]
## Arduino Mega w/ ATmega2560 Testato Mega ISP Version
## -------------------------
mega.menu.cpu.atmega2560T=ATmega2560 (Testato ISP Version)

mega.menu.cpu.atmega2560T.upload.protocol=wiring
mega.menu.cpu.atmega2560T.upload.maximum_size=258048
mega.menu.cpu.atmega2560T.upload.speed=115200

mega.menu.cpu.atmega2560T.bootloader.high_fuses=0xD9
mega.menu.cpu.atmega2560T.bootloader.extended_fuses=0xFD
mega.menu.cpu.atmega2560T.bootloader.file=stk500v2/stk500boot_v2_mega2560.hex

mega.menu.cpu.atmega2560T.build.mcu=atmega2560
mega.menu.cpu.atmega2560T.build.board=AVR_MEGA2560

westfw

It was uploading sketches via ISP that wasn't working?
It's possible that that doesn't work on 2560, but does work on 328, because the program counter wrap-around happens differently on a chip with more than 64kwords of flash.  On a 328, if you start in the "bootloader section" at 0x3F00 (where there isn't any actual code), it will execute relatively useless but unharmful instructions till it gets to 0x3FFF, and then wrap around to location 0x0, where your sketch actually begins.  On a 2560, if the bootloader section starts at 0x1F000 and muddles along to 0x1FFFF, I'm not sure whether it will wrap to 0x0 (your sketch), or to 0x10000 (middle of nowhere, where it will eventually wrap again.)

I can't find this clarified in the documentation.  Not that you need a "long" jump/call or to use EIND to change the high bit during normal program execution.

testato


I'm not sure whether it will wrap to 0x0 (your sketch), or to 0x10000 (middle of nowhere, where it will eventually wrap again.)

Hi westfw,
on the 2560 at the end of the flash the PC do not jump to 0x0, I discover this behavior some months ago and found that we need modifie the fuses.
NOrmally in the arduino board the high_fuses=0xD8, we need it change to D9 (the submenu' code posted here is mine  ;))
- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

testato

but Arduino team do not know this ? when it create the "Upload via Programmer" tab/option i test it (i write a guide on it in my sign) and discover that this command do not work on Mega.
I do not know if we must manage this behaviour like a Bug, (bug on Mega, or bug on Uno, depend what the team means whit Upload via Programmer)
I think the team wants to exploit the behavior of the ProgramCounter on the UNO, so the team do not want that the user must change the Fuses, but did not realize that this trick work only on the 328  :)
What do you think ?
- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

SkobyMobil

Hi there,
yes! A Bug's it!
I can use an Arduino Mega 2560 a 328P flashen- without problems.
I can not flash with an Arduino Mega 2560 a Mega 2560.
This only works with foreign hardware or complicated changing the software.
But no one understands. What is this?
Greeting and fun
Andreas

P.S. I try to just:
Arduino Maga 2560 -> Mega 2560
http://www.ebay.de/itm/Mikrocontroller-Atmel-ATMega2560-ATMega-SMD-Adapter-/271224130246?pt=Bauteile&hash=item3f2637cac6
die zweite Maus bekommt den Speck...

westfw

It is equally a bug that the "bootrst" fuse is left programmed (0) on a  m328 when you do "upload using programmer."  It only works if the sketch is short enough not to overlap where the bootloader WOULD be...

This was apparently reported a long time ago, but never understood well enough to fix.  I've added a comment to the bug.
https://github.com/arduino/Arduino/issues/388

testato

the lenght is not a problem, because in the board.txt you have the maximum sketch value, so if you do not change the original boards.txt you do not have problem.
- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

Niri

I have the same problem:

1) when trying to bootload a custom Atmega2560 pcb with arduinoMega as ISP i receive: content mismatch at 0x1e000...

2) i tried uploading blink sketch and no results even after the terminal says uploaded.

I dont know how to change the bootRST to 1 and the change required for boards.txt file. Can someone please clarify this.

Thanks

Niri

we fixed the problem. fuse BootRST must be set to 1. to execute the program. Somehow its not needed for an uno.
stay tuned on further hoodloader releases ;)
How do i change the bootRST to 1?

Go Up