After successfully hacking the Christmas tree lights with my Arduino Leonardo I realized I had an abandoned project: lots of brand new ATmega328P-PU chips, which are only waiting to be programmed. I knew that an existing Arduino can be used to achieve this but I experienced problems with a Leonardo.
There are a handful of how-tos online, why you need an other one? Well, I found the available solutions inaccurate and non functional. Let's start with the basic specs: Arduino Leonardo, Windows 10 1709, Arduino IDE 1.8.5 and the target chip is ATmega328P-PU.
I successfully loaded the ArduinoISP sketch on my Leonardo (enabling the OLD_STYLE_WIRING) and wired up my chip based on the wonderful instructions HERE
. The problem is that I continuously received timeout error messages, saying that the programmer is not replying.
There is a lot of deep technical explanation on why it's not working, but they all said the solution is to define a new programmer for Arduino IDE. Again, there are lots of different advices on where to put and what, only the below worked for me!
Open the following file with and elevated WordPad (Notepad will not display the line breaks correctly):
C:\Program Files (x86)\Arduino\hardware\arduino\avr\programmers.txt
Go to the end of the file, add an empty line and then the below:
arduinoispleo.name=Arduino as ISP (Leonardo)
Save the file and theoretically when you re-start the Arduino IDE, you'll see a new programmer in the list:
That was all the hard part. Now select Arduino/Genuino UNO as board, select the port of your Arduino Leonardo and the new programmer we just created. If you wired everything up correctly, burning the bootloader or uploading sketches will now succeed! Just be careful, when you upload always hold SHIFT first, otherwise you will simply try overwrite the ArduinoISP sketch on your Leonardo
As a result, my ATmega on a breadboard is now running the Blink sketch:
A final touch: I went to the workshop and soldered a programmer shield for easier, further use.
Enjoy! Hope the above saves you some trouble