I have made my own version of an Arduino Mega and I am encountering some issues. Whenever I try to upload any sketch to the Mega, I get the following error message:

avrdude: stk500v2 ReceiveMessage(): timeout

I can upload just fine to the 16u2 as well as the 2560 using ICSP and Nick Gammons Atmega_Board_Programmer sketch. I have the correct board and COM port selected, and the cable, computer, and USB(2.0) port can upload to other Arduino boards just fine.

I have had some other troubles with the board that have been solved, but this issue remains. Please see my Arduino forum post for more details on these issues.

My current guess is that there may some sort of issue with the transmission lines between the 16u2 and the 2560. Here is a picture of the pcb traces. Can anyone look them over to see if there are issues with the traces?

If the traces seem fine, can anyone think of another reason why the upload does not work?

  • Comments are not for extended discussion; this conversation has been moved to chat. – Majenko Aug 6 '18 at 10:38

So as of right now the problem has been solved. The issue was that the decoupling capacitor on the reset line near the 2560 was designed to be a 22pF capacitor, but I had put a 100nF capacitor, which increases the time constant by a factor of 5000, prohibiting the auto-reset circuitry from operating correctly. Removing the 100nF and putting in the 22pF seems to have solved the issue of only being able to upload once after burning the bootloader.

Thank you everyone for your support.

  • Can you elaborate? A decoupling capacitor is usually between Vcc and Gnd, so it wouldn't be "on the reset line". The capacitor in series with Reset (and usually going to RTS on the FTDI header) should work fine as 100nF. If you really have a decoupling capacitor on Reset (between Reset and Gnd) then you shouldn't have it. – Nick Gammon Aug 3 '18 at 21:23
  • Example schematic, which has always worked for me (this is the Atmega328P but it is the same concept). – Nick Gammon Aug 3 '18 at 21:25
  • Sorry for delay. For the reset connection between the 16u2 and the 2560, I have a 10k pull-down resistor on the 16u2 side, then a 100nF capacitor in series from the 16u2 to the 2560, a 10k pullup resistor on the 2560 side, and a 22pF shunt capacitor (shunt is a better word than decoupling). The shunt capacitor was a 100nF and that was causing the auto-reset to not work correctly. – bos1714 Aug 7 '18 at 12:15
  • Whatever word you use, you don't need that capacitor between Reset and ground. The schematic I linked to above shows a diode between Reset and Vcc which should suppress any inadvertent pulses which might put it into high-voltage programming mode, but that probably won't be required unless you have problems with it not resetting. – Nick Gammon Aug 7 '18 at 21:32
  • So there are some issues. I made three boards. One of them works correctly, the other two do not. I can manually program each chip (16u2 and 2560) with FLIP, Arduino as ISP, and your board programmer sketch. The circuitry is the same in each of the three boards. I have checked the resonators of each chip and they are functioning at 16MHz. Is the capacitor in question the culprit? The capacitor is populated on genuine Mega boards so I made sure to have it in mine. I have also noticed that when I program the blink sketch to the 2560 using ArduinoISP, The LED will stay on for 1s and off for 0.5s – bos1714 Aug 8 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.