Go Down

Topic: ATmega2560 custom board problem (Read 7818 times) previous topic - next topic


If the sketch doesn't start, it may be because the auto-reset needed.  Did you try a manual reset?  Do you have a reset button?

I will be away for work until late this week so I'll give your reset idea a try then.

Hi again, I have tried out the reset idea you had but nothing changes.

I had a look whats in the flash in the two different situations and when uploading a sketch directly the same code can be found at four positions in the flash memory, at 0x000000, 0x010000, 0x020000 and 0x030000. When I upload the bootloader the flash gets emptied and all bytes are 0xFF. The only difference I notice is that when the bootloader is uploaded the lockbits set "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" while programming directly via programmer sets the fuse to "Boot Loader Protection Mode 1: No lock on LPM and SPM in Boot Loader Section".

Conclusion from before is that the hardware can't be the problem because the bootloader works and I can get code to run if I just program it through the bootloader.

Have anybody uploaded a sketch directly to the Mega2560 via programmer and got it to work? Why is it for instance working with my ATMega644PA board without problems...

Thanks for all the help so far, Cheers!


Problem solved!

The problem was that Arduino sets the fuse "Boot Reset vector Enabled" which makes the MCU look for the firmware at another place then the start of the memory. When setting the "Boot Reset vector Enabled" to "Unprogrammed" the MCU starts it's execution at 0x000000 and everything works great!

Thanks again for all your help!


Go Up