I am making my own Arduino Mega board and have encountered a strange issue. When I upload the bootloader to the board using an Uno as an ISP, I am able to upload using the USB port. However, if i try to upload again, I get the stk500v2 timeout error, and I have to re-upload the bootloader. I have checked the fuse bits of the mega2560 chip as well as those on a good board before and after programming. Please see the details below for information.
Good board: (Low, High, Ext, Lock)
Checked with Nick Gammon's sketch: FF D8 FD FF
Uploaded blink sketch twice and rechecked: FF D8 FD FF
Uploaded bootloader with Nick Gammon sketch: FF D8 FD EF
Uploaded blink sketch twice and rechecked: FF D8 FD EF
My Board: (Low, High, Ext, Lock)
Checked with Nick Gammon's sketch: FF D8 FD CF
Uploaded bootloader and rechecked: FF D8 FD EF
Uploaded blink and rechecked: FF D8 FD EF
I have looked around and I cannot find any reason why the bootloader doesn't seem to stay on the board. Does anyone have suggestions?
Usually the "can only upload once after burning bootloader" is caused by your auto-reset circuit not working. Normally you need to do a hardware reset of the ATmega2560 to activate the bootloader, then start an upload before the bootloader times out and starts the user application. However, after burning bootloader the bootloader is perpetually activated so no reset is necessary. The auto reset circuit is the DTR pin of the USB-TTL serial chip connected to the reset pin of the ATmega2560 via a 0.1 uF capacitor. You could see whether you can get an upload to work by pressing the upload button right after compilation finishes, just as the upload is starting. It's kind of tricky to get the timing just right.
If that's not the problem I'd try the regular Tools > Burn Bootloader instead of that Atmega_Board_Programmer thing.
Please excuse the rotated picture.
I will not. First off, posting pictures of text is stupid. Second, if you know it's rotated then why not fix it? If you're capable of making your own Mega then you're certainly capable of rotating a picture.
Yes I am not sure why I didn’t put the text there to begin with. I have fixed that.
For the circuitry, I have the following schematic. The reset net between the pull-up resistor and the 100nF decoupling capacitor goes straight into the chip. I believe I removed the diode in the pull-up circuitry for the 2560 chip. Is that needed for the reset?
I've always only used a 10 kOhm resistor for the reset pin pull-up and a 0.1 uF capacitor for the auto-reset, no other components, as shown in Nick Gammon's minimal board instructions:
I never had a problem with that. But I haven't done my own ATmega2560 board and I've only worked with the (conterfeit) FT232 USB-TTL serial chips, not an ATmega16U2 like on the official Mega board.
I populated the diode and tested the upload, still only getting one upload per burn bootloader. I looked at the circuitry and found that the decoupling capacitor for the reset line near the 2560 should be a 22p, where I had a 100n, which is a big difference. I am able to upload ten times in a row without any issues so far, so I consider the matter solved. Thank you so much for putting up with my lack on knowledge.