# Using Leonardo as ISP to burn bootloader on ATMEGA328-pu

**URL:** <https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817>\
**Category:** 3rd Party Boards\
**Created:** [May 8, 2018, 1:08am UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817 "2018-05-08T01:08:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MathPi](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@MathPi](https://forum.arduino.cc/u/MathPi)\
**Post date:** [May 8, 2018, 1:08am UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/1 "2018-05-08T01:08:01Z")

</div>

Hi all,

I am new to working with Arduinos. I appreciate any help.

I purcahsed an Arduino Leonardo from Digikeys. Along with this I also got the ATMEGA328-pu chip - which apparently does not come with the bootloader installed. I've looked at several tutorials on how to hook up the Leonoardo to act as the ISP ("Arduino as ISP" setting). But I am having some trouble.

Here is my software/hardware details:

1. I am using a mac with version 10.11.6
2. I am using the Arduino software version 1.8.5

Here is what I have done so far:

1. Successfully loaded the sketch "ArdunioISP". I did not do any modifications to this sketch.

2. Connected the following:

- Pin 10 on Leonardo to Pin 1 on ATMEGA (Reset)
- Pin 11 on Leonardo to Pin 17 on ATMEGA (MOSI)
- Pin 12 on Leonardo to Pin 18 on ATMEGA (MISO)
- Pin 13 on Leonardo to Pin 19 on ATMEGA (SCK)
- 5V and ground respectively. - I have a 1 k Ohm resistor between Pin 1 and 5V on the ATMEGA. Also have a pushdown button connected to the ground at act as the reset.
- I've connected an 16 MHz clock between pins 9 and 10 on the ATMEGA, with two 104 caps going to ground.
- I've connected Pins 7, 20 and 21 on the ATMEGA to 5 V. And Pins 8 and 21 on the ATMEGA to ground.

1. Set programmer to "Arduino as ISP"

2. Verified that my board is still set to "Arduino Leonardo" and that I have the proper port selected

3. Burn Bootloader is where it fails. The following is the output I get:

Arduino: 1.8.5 (Mac OS X), Board: "Arduino Leonardo"

/Users/MathPi/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/MathPi/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cstk500v1 -P/dev/cu.usbmodem1461 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35  
Copyright (c) 2000-2005 Brian Dean, [http://www.bdmicro.com/](http://www.bdmicro.com/)  
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/Users/MathPi/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"  
User configuration file is "/Users/MathPi/.avrduderc"  
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/cu.usbmodem1461  
Using Programmer : stk500v1  
Overriding Baud Rate : 19200  
AVR Part : ATmega32U4  
Chip Erase delay : 9000 us  
PAGEL : PD7  
BS2 : PA0  
RESET disposition : dedicated  
RETRY pulse : SCK  
serial program mode : yes  
parallel program mode : yes  
Timeout : 200  
StabDelay : 100  
CmdexeDelay : 25  
SyncLoops : 32  
ByteDelay : 0  
PollIndex : 3  
PollValue : 0x53  
Memory Detail :

Block Poll Page Polled  
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack

* * *

eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00  
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00  
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00  
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00  
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00  
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00  
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00  
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500  
Description : Atmel STK500 Version 1.x firmware  
Hardware Version: 2  
Firmware Version: 1.18  
Topcard : Unknown  
Vtarget : 0.0 V  
Varef : 0.0 V  
Oscillator : Off  
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Error while burning bootloader.  
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000  
avrdude: Yikes! Invalid device signature.  
Double check connections and try again, or use -F to override  
this check.

avrdude done. Thank you.

Any thoughts on what I set up incorrectly? Thanks in advance.

Cheers,  
MathPi

---

<div class="post-metadata">

**Author:** ![MathPi](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@MathPi](https://forum.arduino.cc/u/MathPi)\
**Post date:** [May 8, 2018, 4:20am UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/2 "2018-05-08T04:20:09Z")

</div>

Ok I've made some progress. I accidentally had Pin 17 on the ATMEGA connected to ground also (I had three LEDs on the breadboard for debugging and wrongly placed a wire). With this removed, I now get a different error message, as follows:

avrdude: AVR device initialized and ready to accept instructions

Error while burning bootloader.  
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9514 (probably m328)  
avrdude: Expected signature for ATmega32U4 is 1E 95 87  
Double check chip, or use -F to override this check.

avrdude done. Thank you.

I am slightly confused by the device signature. Should I change something in the avrdude.conf file?

Thanks,  
MathPi

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [May 8, 2018, 6:55am UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/3 "2018-05-08T06:55:45Z")

</div>

I’ve done the same and bought a ATMEGA328-pu when the ‘standard’ Arduino Uno chip is the ATMEGA328p-pu (note the extra ‘p’).

If I remember correctly, the solution I used was indeed a temporary hack to avrdude.conf to associate the device signature found with the ‘correct’ chip.

edit  
But which board type did you select as target ? It seems to expect a ATmega32U4 (Leonardo or micro) as target device. Try selecting Uno instead but ONLY if you are intending to use the ATMEGA328 with a 16 Mhz crystal.

edit2  
Also look at this thread which suggests installing MiniCore in the IDE : [Operate Atmega328 on arduino uno board - Microcontrollers - Arduino Forum](http://forum.arduino.cc/index.php?topic=546135.0)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 8, 2018, 3:46pm UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/4 "2018-05-08T15:46:24Z")

</div>

(deleted)

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 8, 2018, 3:57pm UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/5 "2018-05-08T15:57:15Z")

</div>

I have no idea if your setup will work. But the ICSP pins on the Leonardo are not the pins that you used (10..13) but the pins on the 6 pin header.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 10, 2018, 1:40am UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/6 "2018-05-10T01:40:49Z")

</div>

> I've connected an 16 MHz clock between pins 9 and 10 on the ATMEGA, with two 104 caps going to ground.

The 16MHz crystal loading caps are 22pf. 104 is 100nf or 4545 times larger than 22pf. In other words, they’re the wrong caps.

The two 100nf caps are supply bypass caps and should be between VCC/Gnd and AVCC/Gnd.

---

<div class="post-metadata">

**Author:** ![MathPi](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@MathPi](https://forum.arduino.cc/u/MathPi)\
**Post date:** [May 10, 2018, 5:05pm UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/7 "2018-05-10T17:05:27Z")

</div>

> avr\_fred:  
> The 16MHz crystal loading caps are 22pf. 104 is 100nf or 4545 times larger than 22pf. In other words, they’re the wrong caps.
> 
> The two 100nf caps are supply bypass caps and should be between VCC/Gnd and AVCC/Gnd.

Thanks for pointing that out! You are correct, I had these caps wrong. I will get some 22pF caps and report later on the progress on this. BTW, must they be 22pF caps? Can they be a little less or a little more?

---

<div class="post-metadata">

**Author:** ![MathPi](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@MathPi](https://forum.arduino.cc/u/MathPi)\
**Post date:** [May 10, 2018, 6:55pm UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/8 "2018-05-10T18:55:03Z")

</div>

> sterretje:  
> I have no idea if your setup will work. But the ICSP pins on the Leonardo are not the pins that you used (10..13) but the pins on the 6 pin header.

Thanks! I've switched over to use ICSP pins instead. This didn't have much of a difference in terms of the original issue. Something else is still wrong. Will keep at it.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 5:13pm UTC](https://forum.arduino.cc/t/using-leonardo-as-isp-to-burn-bootloader-on-atmega328-pu/524817/9 "2021-05-06T17:13:26Z")

</div>


