Ӕ Central

Welcome to the hidden lair of AE Central. From cars and beer to hardcore software development, you might find interesting topics in all areas. Feel free to browse!
Home

To menu | To search

Programming an ATmega328P with Arduino Leonardo (Arduino as ISP)

, 18:58 - Permalink

Do It YourselfAfter 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 and 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
or if you are using the Windows Store version:
%USERPROFILE%\Documents\ArduinoData\packages\arduino\hardware\avr\1.6.21\programmers.txt
Go to the end of the file, add an empty line and then the below:
 

arduinoispleo.name=Arduino as ISP (Leonardo)
arduinoispleo.communication=serial
arduinoispleo.protocol=arduino
arduinoispleo.speed=19200
arduinoispleo.program.tool=avrdude
arduinoispleo.program.extra_params=-P{serial.port}

 
Save the file and theoretically when you re-start the Arduino IDE, you'll see a new programmer in the list:
  • Arduino Leonardo as ISP
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:
  • It's working!!!
A final touch: I went to the workshop and soldered a programmer shield for easier, further use.
  • The home made ATmega328P programmer shield
 
Enjoy! Hope the above saves you some trouble :)

Comments

1. On 2018.10.09, 18:48 by m coll

Hello friends, how is the whole thing, and what you want to say
concerning this article, in my view its genuinely remarkable for me.

Add a comment

HTML code is displayed as text and web addresses are automatically converted.

This post's comments feed