Burning bootloader on standalone Atmega328(internal clock 8MHz)

John, every advice from you is taking me further, but I am still not quite there yet. Now I have another error message:

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

Error while burning bootloader.'

I can see this error in both cases: for LilyPad and for standalone Atmega 328 and on both IDE's: 1.6 and 1.6.1.

Do you have any idea what to do next?

I'd try with 1.0.6 IDE, 1.6 I recommend for Yun and Due.

Did you, by any chance, purchase an ATmega328 instead of the ATmega328P used in all the Arduinos? The 'P' (Pico-power) version has a different signature.

johnwasser: Did you, by any chance, purchase an ATmega328 instead of the ATmega328P used in all the Arduinos? The 'P' (Pico-power) version has a different signature.

He should set to verbose output (in preferences) to obtain exact signature bytes. If it is zero or not.

johnwasser: Did you, by any chance, purchase an ATmega328 instead of the ATmega328P used in all the Arduinos? The 'P' (Pico-power) version has a different signature.

No. I checked that and I have only ATmega328P. I am able to run my project with the external oscillator but I would like to shrink it, and that is why I need to use internal oscillator.

Budvar10: He should set to verbose output (in preferences) to obtain exact signature bytes. If it is zero or not.

I did it as well and this is what I am getting:

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

Using Port : /dev/tty.usbmodem14211 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.05s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.05s

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

What model Arduino are you running the ArduinoISP sketch on? One of the page you link to is for an Arduino Micro.

Did you select "Arduino as ISP" (not "ArduinoISP") from Tools->Programmer before selecting Tools->Burn Bootloader?

"avrdude: Device signature = 0x000000"

That tends to indicate a wiring error. The wiring will somewhat depend on which model Arduino you are using for ArduinoISP.

Has the ATmega328P you are programming been set to expect a crystal? If so you have to provide a crystal or an alternative clock. Adafruit has an alternative version of ArduinoISP that uses Arduino Pin 9 for an 8 MHz clock output. You can connect it to pin 9 (XTL1) of the ATmega. https://github.com/adafruit/ArduinoISP

johnwasser:
What model Arduino are you running the ArduinoISP sketch on? One of the page you link to is for an Arduino Micro.

I am running ArduinoISP sketch on UNO.

johnwasser:
Did you select “Arduino as ISP” (not “ArduinoISP”) from Tools->Programmer before selecting Tools->Burn Bootloader?

Yes

johnwasser:
“avrdude: Device signature = 0x000000”

That tends to indicate a wiring error. The wiring will somewhat depend on which model Arduino you are using for ArduinoISP.

This is what I using for wiring: oddWires: Burning a bootloader into a bare ATmega328

johnwasser:
Has the ATmega328P you are programming been set to expect a crystal? If so you have to provide a crystal or an alternative clock. Adafruit has an alternative version of ArduinoISP that uses Arduino Pin 9 for an 8 MHz clock output. You can connect it to pin 9 (XTL1) of the ATmega. GitHub - adafruit/ArduinoISP: A fork of the ArduinoISP that has 8mhz output clock

I have 3 ATmega 328P. Only one of them should be set to work with crystal and it works with crystal. The other 2 are new and it shouldn’t work with external crystal but when I was trying burn bootloader on them I can see this:
’ Oscillator : Off’

so I am not so sure anymore.

I tried to use 'https://github.com/adafruit/ArduinoISP' file.

  • I enabled LOW_SPEED, and loaded it to the programmer.
  • I connect Arduino pin 9 with with Atmega XTL1
  • I switched to 'LilyPad Arduino'
  • I tried to 'Burn Bootloader'

This is the error message I got:

'avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e950f avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex" avrdude: writing flash (32652 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x00 avrdude: stk500_cmd(): programmer is out of sync Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.'

After previouse attempt I loaded regular 'ArduinoISP' sketch, and with the Arduino pin 9 still contected to ATmega XTL1 I tried to burn bootloader again. In this case I recived below error message:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e950f avrdude: erasing chip avrdude: reading input file "0x3F" avrdude: writing lock (1 bytes):

Writing | ***failed;

############################################ | 100% 0.16s

avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x3F: avrdude: load data lock data from input file 0x3F: avrdude: input file 0x3F contains 1 bytes avrdude: reading on-chip lock data:

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

avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0000 0x00 != 0x3f avrdude: verification error; content mismatch

avrdude done. Thank you.

That symptom looks like what I saw when I had not disabled auto-reset on the Arduino UNO running ArduinoISP. The Arduino bootloader uses the same protocol as the ArduinoISP. The bootloader will return the signature for an ATmega328P but then it will return 0 if you try to read memory or fuses.

Did you connect a 1 to10 uF capacitor from Reset (+) to Ground (-)?

I tried with the capacitor and I have exactly the same errors like before…

I've run out of ideas. :(

John, could you please give me the setup which you are using for the same task to make me sure that I have done everything as it should be? I will not give up on this :) The only thing is that for the next 2 weeks I will be offshore so I have to suspend my efforts.

Burning a Bootloader
(Arduino 1.6.1 running on MacBook Pro w/ OS X 10.10.2)
ISP Arduino: Arduino Diecimila w/ATmega168 (didn’t have a second ATmega328P available)
Target chip in breadboard: ATmega328P (has UNO bootloader and no crystal)

Connect the USB cable to the PC and ISP Arduino

Install the ArduinoISP sketch in the ISP Arduino.
File->Examples->ArduinoISP
Tools->Board->Arduino Duemilanove or Diecimila
Tools->Processor->ATmega168
Tools->Port->(serial port for ISP Arduino)
File->Upload

Go to Preferences… and check the box for “Show verbose output during: compilation upload”

Install the breadboard wiring:

Target
Pin
Arduino
Pin
Target
Pin
Arduino
Pin
1 Pin 10 28
2 27
3 26
4 25
5 24
6 23
7 +5V 22 GND
8 GND 21
9
20 +5V
10 19 Pin 13
11 18 Pin 12
12 17 Pin 11
13 16
14 15

Attempt to burn bootloader without disabling auto-reset on ISP Ardiuino.
Tools->Board->Arduino UNO
Tools->Port->(serial port for ISP Arduino)
Tools->Programmer->Arduino as ISP
Tools->Burn Bootloader.

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

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

Note: If the ISP Arduino had an ATmega328P processor this check would have passed and an error would occur further into the process. Here is what happens if I put an ATmega168 into the breadboard and try to burn a Diecimila 168 bootloader to it:

avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing |  ***failed;  
################################################## | 100% 0.13s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

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

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x3f
avrdude: verification error; content mismatch

Added a 10 uF capacitor to the ISP Arduino with the positive side of the capacitor going to Reset and the negative side of the capacitor going to Ground.

Now attempt to burn a bootloader. If the chip is not set to expect a crystal or external clock then this should be successful. If the chip came with (or has had burned) an Arduino bootloader it will fail like this:

Tools->Burn Bootloader.

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

This is a symptom of the target chip’s clock not running. An ATmega that is expecting a crystal won’t accept serial programming without a crystal or ceramic resonator between pins 9 and 10, or an external clock injected into pin 9. I found a crystal between 8 MHz and 20 MHz (14.3180 MHz in my case) in my ‘salvaged parts’ box and plugged it into the breadboard between pins 9 and 10.

Attempt to burn bootloader again: Tools->Burn Bootloader.

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

SUCCESS!

Here's what I did: 1) locate your installed boards.txt (mine was in /usr/share/arduino/hardware/arduino/avr/boards.txt) 2) add the following at the end. Restart the IDE and choose ATmega328 on a breadboard from the list

hope that works for you!

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=arduino atmega328bb.upload.maximum_size=30720 atmega328bb.upload.maximum_data_size=2048 atmega328bb.upload.speed=57600

atmega328bb.bootloader.tool=arduino:avrdude

atmega328bb.bootloader.tool=avrdude

atmega328bb.upload.tool=avrdude

atmega328bb.bootloader.low_fuses=0xE2

atmega328bb.bootloader.low_fuses=0xFF

atmega328bb.bootloader.high_fuses=0xDA atmega328bb.bootloader.extended_fuses=0x05

atmega328bb.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex atmega328bb.bootloader.unlock_bits=0x3F atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p atmega328bb.build.f_cpu=8000000L

atmega328bb.build.core=arduino:arduino

atmega328bb.build.core=arduino

atmega328bb.build.variant=arduino:standard

atmega328bb.build.variant=standard

Experimental name:

atmega328bb.build.board=AVR_BARE

Guys thank you for all your help.

Final I managed to burn bootloader on the standalone Atmega328P.

To accomplish that I removed all old Arduino IDE's (all together with the all boards.txt files with which I was playing), I installed Arduino 1.6.3, afterwards I edited boards.txt with the instructions from johshmoh, I took brand new Atmega328P and followed johnwasser instructions. Everything went smoothly. It works even without 10uF capacitor.

I checked all my microcontrollers with Atmel Studio and Atmel ICE and I found that during my first attempts of upload bootloader I changed the fuses to use external oscilator... I don't know how it happend.

Anyway now everything works how it should.

update 1.6.4 broke things. here's the new boards.txt section:

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.tool=avrdude atmega328bb.upload.protocol=arduino atmega328bb.upload.maximum_size=30720 atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2 atmega328bb.bootloader.high_fuses=0xDA atmega328bb.bootloader.extended_fuses=0x05 atmega328bb.bootloader.path=arduino:atmega atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex atmega328bb.bootloader.unlock_bits=0x3F atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p atmega328bb.build.f_cpu=8000000L atmega328bb.build.core=arduino:arduino atmega328bb.build.variant=arduino:standard

johshmoh, your update is not corect, i had to add the line “atmega328bb.bootloader.tool=arduino:avrdude” to make it work.
Please check and confirm.

Vilimerth: Guys thank you for all your help.

Final I managed to burn bootloader on the standalone Atmega328P.

To accomplish that I removed all old Arduino IDE's (all together with the all boards.txt files with which I was playing), I installed Arduino 1.6.3, afterwards I edited boards.txt with the instructions from johshmoh, I took brand new Atmega328P and followed johnwasser instructions. Everything went smoothly. It works even without 10uF capacitor.

I checked all my microcontrollers with Atmel Studio and Atmel ICE and I found that during my first attempts of upload bootloader I changed the fuses to use external oscilator... I don't know how it happend.

Anyway now everything works how it should.

Some time try Nick's burner program, it's really good. http://www.gammon.com.au/bootloader

I have yet to bootload chips without wiggling some wires to get all the contacts right. Need to solder. With Nick's software I didn't have to edit text to get my 328P-PU chips recognized.

There is also Nick's minimal breadboard blog that covers so much so well. http://www.gammon.com.au/breadboard

Hey there. I have the same problem but the instructions doesn't really helped. I try to put biitloader in ATmega 328P with a Leonardo board as ISP.

I tried to do it on 1.6.4 IDE and took the same steps Johnwasser has adviced to Vilimerth but after taking the 2nd step I got this msg :

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

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 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 avrdude: Send: 0 [30] [20] avrdude: ser_send(): write error: sorry no info avail

and it works the same for both internal and external CLK source, and for 1.6.4. IDE the same as for 1.0.6., I also used 2 different MCUs.

Could you pls help me with that trouble or at least say what may be wrong?