0

I'm trying to burn the arduino bootloader onto my ATmega328P so it uses the internal clock. I followed the tutorial in this page but I'm getting this error.

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
 Copyright (c) 2007-2014 Joerg Wunsch
 System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
 Using Port : COM5
 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.

I tried placing a cap from reset to ground but it doesn't wort either.
Any idea on what might be wrong with my procedure?

Thanks

[EDIT]

  • I followed the procedure described at the bottom of the page linked (Minimal Circuit (Eliminating the External Clock)).
  • I used the bootloader in "breadboard-1-6-x.zip"
  • I am using the Arduino IDE v1.8.1
asked Feb 15, 2017 at 14:40
9
  • It isn't clear from question+webpage what your procedure is, or what you want to do. What "internal clock" do you mean? The built-in 8 MHz RC oscillator ? If so, please edit question to say so. Also edit question to include a schematic of how you have things hooked up. Do you have a USBasp to program the ATmega328P system, or what? Commented Feb 16, 2017 at 2:54
  • I followed precisely the instructions listed on the link I provided. And yes it is the internal 8MHz RC oscillator Commented Feb 16, 2017 at 5:57
  • You could edit the question and say what your programmer is, what fuse settings, which bootloader. Or just let people guess. Commented Feb 16, 2017 at 6:05
  • I though providing a link of the tutorial which answers all of your questions was enough, but I'll edit it out. Commented Feb 16, 2017 at 6:08
  • 1
    Please run my chip detector sketch and report the results (copy/paste). Commented Feb 20, 2017 at 21:22

2 Answers 2

1

If your ATMEGA328P has already been used with a crystal or already has a bootloader on it, then the fuses will be set to expect a crystal oscillator. In this case, you must initially have a crystal & the associated 2 capacitors connected. Once you have succeeded in burning the bootloader (this process also sets the fuses) you can dispense with the crystal.

answered Feb 17, 2017 at 16:51
5
  • can I connect the ATmega Cristal pins to the arduino board? Commented Feb 17, 2017 at 17:09
  • According to this, it should be possible to share a crystal (or resonator in the case of most newer Arduino boards) : forum.arduino.cc/index.php?topic=78584.0 Commented Feb 18, 2017 at 6:51
  • I tryed connecting to the board oscillator. Now it gives me this error: Commented Feb 18, 2017 at 12:35
  • avrdude: Device signature = 0x00ffff avrdude: Expected signature for ATmega328P is 1E 95 0F Double check chip, or use -F to override this check. Commented Feb 18, 2017 at 12:35
  • Also the device signature keeps changing every time I try to burn the bootloader. Does this mean the ATmega is broken? Commented Feb 18, 2017 at 12:39
1

As noted in 6v6gt's answer, if the ATmega328 has been set to use a crystal, thereafter a crystal (or an external oscillator) are required for programming, until the fuses have been set to use the internal RC oscillator. Here are a few thoughts, unfortunately somewhat scattered, on the matter.

If you have a parallel programmer (that delivers high voltage to the Reset pin and uses 8-bit parallel data signalling) you can use it to reset the fuses, since with that programming mode the clock is irrelevant.

Also, USBasp programmers interact with Avrdude to generate a programming clock of some specified frequency, 100kHz by default, 8kHz with the "Slow Clock" jumper installed. Also see § "Set the clock in software" within USBasp ICSP programmer quickstart guide at freetronics.com.au. Unlike the Avrdude man page, that reference says the default programming frequency is 375kHz and says "Avrdude’s -B option allows you to set the programming clock speed from software", while the man page says -B specifies bit clock period (in microseconds) for the JTAG interface or the ISP clock of the JTAG ICE only. Anyhow, a USBasp can reprogram fuses away from the crystal setting if a crystal or external oscillator is used, without depending on serial port data rates. I don't know for certain whether it will work without a crystal or oscillator.

Note, rather than "sharing" a crystal via wires from one board to another – a practice that will broadcast lots of RF noise and might not get the signal across anyway – you could instead write a program on one Arduino to toggle a pin at high frequency, and use that output as an external oscillator to drive one of the crystal pins on another chip. For example, the program below should generate a 2.67 MHz square wave on pin PB0 of an Uno or a Nano.

void setup() {
 cli(); // Avoid timer interrupts
 pinMode (8, OUTPUT); // PB0 is pin 8 on Uno / Nano
 while (1) PINB = 1;
}
void loop() {}

In the ATmega328 data sheet, see §14.3.1, Alternate Functions of Port B, and Table 14-3, which lists PB7 as XTAL2 (Chip Clock Oscillator pin 2), and PB6 as XTAL1 (Chip Clock Oscillator pin 1 or External clock input), indicating external oscillator attaches to the PB6 pin.

answered Feb 20, 2017 at 17:45
4
  • I would cli() before the while, otherwise the timer interrupt would make long glitches. Commented Feb 20, 2017 at 18:52
  • After that, how I have to connect it. The pin PB0 of the "clock generator" board to XTAL1 or XTAL2? Commented Feb 20, 2017 at 19:15
  • @jagjordi, see last paragraph of edit Commented Feb 20, 2017 at 19:28
  • I did what you said (configured the UNO to output the clock, connect pin 8 to XTAL1 (PB6) but I still get the same error. Device signature keeps changing every time I try to burn the bootloader. Any ideas? Commented Feb 22, 2017 at 12:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.