Using Arduino Mega2560 as Arduino ISP for Atmega328p

This might be redundant but I need your help. I am a newbie and I have repeatedly failed in uploading the bootloader into my Atmega328p. I used my Arduino Mega 2560 and used a blank chip of Atmega328p. Here is the error message with the verbose option in the preferences on:

Arduino: 1.8.5 (Windows 7), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

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

System wide configuration file is "C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM7
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
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 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 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.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

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

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.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here are the things I have tried:

  • Connecting the pins from Arduino Mega 2560 to Atmega 328p with the pinouts: 51 to 17, 50 to 18, 52 to 19, 53 to 1. Of course with the crystal oscillator, capacitor, and the source (VCC and GND with AVCC, Aref, AGND)
  • With the pins connected as I indicated, I removed the pins and the error message is still the same
  • Of course I tried experimenting with removing the capacitor in the reset pin on the arduino mega to remove auto reset, using values 100uF, 100nF, 10nF
  • And before getting this error I tried to upload a blinking sketch into my Arduino Mega and it worked properly so I doubt my Mega is broken.

Possible situations that causes the error that I think:

  • The Arduino Mega chip can't read the Atmega328p at all (Thats why connected pins or not same error)
  • Is using Arduino Mega these days to bootload an Atmega328p chip still possible?
  • I used the built-in sketch of the Arduino ISP, so I thought is there another sketch solely for using Arduino Mega as the Arduino ISP for Atmega328p?
  • Might just be, but the blank Atmega328p I bought might be broken? (Hope not)

Please help me guys... I don't have anymore cash to spend on this project.. What should I do?

jmba909:
53 to 1

Unless you have modified the ArduinoISP sketch, this is wrong. You need to connect pin 10 on the Mega to the reset pin on the ATmega328P.

Where did you get the information about this wiring? This is the second time I've seen someone try this exact wiring recently. If there's some wrong information out there I'd like to try to get it fixed.

Oh my god the error output changed but it changed the way I wanted. Here is the error message now:

Arduino: 1.8.5 (Windows 7), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

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

System wide configuration file is "C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM7
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
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 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 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.02s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATmega328P is 1E 95 14
Double check chip, or use -F to override this check.

Error while burning bootloader.
avrdude done. Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I edited the avrdude.conf after I read another article in the internet so I'll be back later and see if it works, but dude it finally read the chips signature.

There are tons of tutorials in the internet telling us that pin53 was supposed to connect to RST(1). I'll also be back with the links a bit later(Due to slow internet) but almost all tutorials I read told me that.

Thanks a lot Mr.Pert! :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Re-edit:
IT FINALLY WORKED!!!

Here are the links of tutorials I got from the internet:

Bootloading Atmega328p with Arduino Mega2560-Instructables
How to Use Arduino Mega 2560 As Arduino Isp
Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU)

These are a few, but in general they are telling that pin 53 is supposed to be connected to RST

jmba909:
I edited the avrdude.conf after I read another article in the internet so I'll be back later and see if it works, but dude it finally read the chips signature.

Did you edit it to signature = 0x1e 0x95 0x14; for id = "m328p";? [tt]signature = 0x1e 0x95 0x0F;[/tt] should be the default value in the avrdude.conf that comes with the Arduino IDE. signature = 0x1e 0x95 0x14; is the signature of ATmega328, not ATmega328P.

Yes yes! Indeed I did that and it worked fine, but thanks anyway. You’re a big help bro!

OK, I added notes to all three of those links to try to prevent others from having this problem. What happened is that the ArduinoISP sketch was changed in Arduino IDE 1.6.6 so that the connections are different when using Mega 2560 as a programmer. The reason is that on an Arduino Uno it has always been pin 10 and this makes it so that you can get an "Arduino as ISP shield and use it on Uno or Mega interchangeably with the same unmodified ArduinoISP sketch. But that change broke who knows how many tutorials so I'm not sure that was a good change. You can actually just edit one line of code in that sketch to use any pin you like but most people will just use it as is.

I knew it! Thought those tutorials are too old they couldn't hold water anymore, so I doubted them. Thank you very much!

IMO, editing the avrdude.conf is a terrible approach here - I would instead recommend using MCUDude's minicore, which builds in support for both p and non-p versions of the x8 series atmegas.