I guess this is a typical issue, however having followed some tens of tutorials I thought that there might be an update I am missing.
I am trying to use ArduinoUNO R3 to burn the bootloader on an ATMega328P using the internal oscillator.
My breadboard set up is seen on the picture below, built following http://arduino.cc/en/Tutorial/ArduinoISP and adding the 10uF capacitor between the reset and GND.
The three extra leds are the one described in the ArduinoISP code.
The steps I am taking are:
->upload ArduinoISP to the UNO board
->Connect UNO to the breadboard
->choose "ATmega328 on a breadboard (8 MHz internal clock)" on the ISE
->choose Programmer -> Arduino as ISP
->Burn bootloader
However I am always receiving a message from the avrdude:
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
You need a pullup resistor on the breadboard chip's reset pin. You should also have bypass caps (.1uF) on the power pins of the breadboard chip power pins as near to the CPU as you can get them. Make sure you are picking the board type for a 328p on a breadboard with 8MHz internal clock. Be sure to use "File/Upload Using Programmer". I don't think it's really important unless the boards.txt file is written to use it, but the "Tools/Programmer" should be set to ArduinoISP.
Erni:
2. Your atmega fuses has been set to use external x-tal
I have no idea what that means or any way to check it and work around it.
Erni:
atmega328bb.upload.protocol=stk500
to
stk500v1 or arduino
I tried that but with no luck.
I will try to post some more detailed avrdude messages soon, however I do not have access to the board for the time being.
Erni:
or you simply has bad connections.
Well that is always a problem, however I have double checked them with a multimeter and they look ok.
What make me wonder is why so many people, just like afremont, suggest adding more circuity (pullup resistors, caps etc) while others just do it with the minimal schematic described on the official page. If all these elements are needed how can many people achieve programming the ATMega just by following the tutorial? Excuse my ignorance, I am very very new to these domains.
I have discovered thru trial and error, that you do indeed need them because sometimes it just doesn't work any other way
Just because somebody else go away with not doing something right doesn't mean that you will
Not having a pullup on the reset pin is just plain wrong. The programmer might be driving it high and low actively, but once you want it to run on its own in the circuit, it needs the pullup. See item number 3. They clearly left it out of the first breadboard diagram on that page, but it is in the one on the right (that uses crystal oscillator).
Not nearly as many as you might otherwise think.. I've tried it both way's because I was in a hurry one night I forgot them and the chip might program 2 of 3 times... Different also is the PSU used.. If the wires from the pus to the chip are 3 - 4 " long and the power supply is well bypassed, It may well work fine.
The common consensus however is that Atmel recommends them because they make programming stable under all but really bad power supplies.
Microcontrollers make noise when they change states internally thousands of very small capacitors charging and discharging at the same time can mean some large fast current pulses, fast enough to make wires look like inductors.. The resistance to the flow of pulses or AC in an inductor increases as frequency increases.. A capacitor decreases it's resistance to the flow of fast pulses or AC as the frequency increases. So the two, the inductance and the added capacitance of the bypass capacitors work together to eliminate the noise at the source, both by the changes with increasing frequency and they help to overcome the weakness of breadboards inductive and very high (relative to a PCB) resistance of the power and ground rails by acting as a reservoir of energy close to the processor pins and thus quieting those little current spikes.
Any questions?
There is a pull-up on the reset line of the 328 But it's one of those weak pull-up things and ATmel's recommendation is to supplant it with a resistor of 4K7 to 10K. For reasons of reset timing the 10 K/100nF combination works well with the DTR pulse from the computer to insure an adequate reset when programming via the USB cable or (same thing) an FTDI adapter.
afremont:
Not having a pullup on the reset pin is just plain wrong.
They're a very bad idea if you're worried about power consumption.
I made a device the other day which consumed an average of 3 microamps. If I added a 10k pullup on the reset pin it would consume 0.3 milliamps - 100 times more than the device just for the pullup!
Great! Clarified answers! Thank you all. I will come back to thins when I get some resistors and caps.
Could you please describe how the bypass caps are connected?
afremont:
Not having a pullup on the reset pin is just plain wrong.
They're a very bad idea if you're worried about power consumption.
I made a device the other day which consumed an average of 3 microamps. If I added a 10k pullup on the reset pin it would consume 0.3 milliamps - 100 times more than the device just for the pullup!
Something else must be going on. I always have a 10K pullup on the reset pin and have no trouble achieving 0.1µA in power-down mode as per the datasheet. In fact, my SOP is to make all unused pins inputs with pullups. CMOS circuitry has exceedingly high input impedances, a pullup on an input pin will draw effectively no current. I was just taking some measurements yesterday:
there is no way a pullup can cause increased consumption if its the only thing on that pin. almost certainly there was other circuitry there. i will however add that imo the reset pullup serves no real purpose. recommendations for it are probably a holdover from the old days when mcus lacked sophisticated debounce circuit of avr. in most cases nothing at all should be connected to that pin. in rare situations where a long cable is attached a 1k series may be used but removed when cable is removed. during arduino upload with that cap to ftdi attached a 10k is needed but for stand alone i find anything at all connected to the reset pin is cause for trouble.
So after following all suggestions I still have no luck. I will post the total avrdude results. Sorry for the long post but I am hopping that this might help somebody help me.
I did as you had previously suggested, however still no result.
However I moved to a lower step. I just try to read the address and it looks like it is not possible.
I still get the nuliffied Device signature.
:~$avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p m328p -n
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
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.