Go Down

Topic: Trouble programming a custom PCB using a ATmega2560 and ATmega16U2 (Read 159 times) previous topic - next topic

robertworeilly

Hey Guys, I'm running into trouble programming an ATmega2560 on a stand alone PCB and have not been able to fix the below issue. Does anybody have ANY idea as to what the problem might be because I've been a month trying to fix it  :smiley-confuse: ANY help would be greatly appreciated. Here are the details, thanks so so much if you can help!
Rob :)

1/ We built a custom PCB using the basics of an ARDUINO mega board with a 16U2 and an ATmega2560. Everything works perfectly, except when we try to re-program the ATmega2560 through the 16U2 a second time, it fails. I then need to re-burn the bootloader using an ICSP MKii. Then I can again program it once more through the 16U2, but after one programming, it fails again!

2/ I have set the fuse register in our board to
- "EXTENDED" 0XFD
- "HIGH" 0XD8
- "LOW" 0XFF
In the Arduino Mega, it reads the same. (this is done using Atmel Studio)

3/ I have set the Lock Bit Register to 0xCF.
In the Arduino Mega, it reads the same.

4/ I can successfully burn the bootloader (with the Arduino IDE) using the MKii to the ATMega2560 on our board.

5/ I can upload  our code to the board through the 16U2 without any problems and everything works perfectly (I have put an equivalent to the Arduino bootloader on the 16U2 with the mkii and it works fine).

6/ However, when I try to re-program the ATmega2560 through the 16U2 a second time, it fails. The only way that I can then re-program it using the 16U2 is to re-burn the bootloader with the MKii. Then it works again, but only once!

7/ With the arduino, using the same two devices and the same bootloaders, lock bits and fuse register, I can re-program the ATmega2560 through the 16U2 as many times as I like.

Go Up