I may have damaged a few 328P micros while trying to get bootloaders in using a AVRtinyISP through the IDE. After going through three brand new 328P I discovered that I has a 10Meg pull up resistor in the reset line instead of a 10K. When programming in the bootloader with 10M resistors in place I could start installing the bootloader but it would give an error message at the final stage. Now that the proper 10K is in place when I try and put in a fresh bootloader I get an immediate error message of initialization failed, rc=1. Is there an easy way to save these micros? I've also tried programming in a blink sketch directly, without any bootloader at all but I get the same error message.
If these are "factory fresh" chips, you may need to communicate with a "slow clock" option the first time you try to establish communication ICSP programming. What clock are you using?
It sounds like it may still be possible to recover them after all. That's great! I'm using 8Mhz resonators right now.
After working on the board the next morning I discovered another hardware issue on the power supply that was causing the problem. I removed the three micros with a hot air tool to another board and they work fine.
Good to hear. BTW, if you aren't too fussed about clock speed sensitivity to temperature change, you can set the fuses to use the internal oscillator as the 8MHz clock source, eliminating the need for the external resonator.
Sometimes when you work on a project for a while and get stuck you just need to walk away, clear your head and go at it again. Usually the solution comes to you then. I have no experience setting fuses. So far I've been cheating by simply clicking Burn Bootloader from the IDE. I'd also like to modify the crystal frequency and maybe the PID but I have no idea where to begin.
Well, the best place to begin is the Atmel datasheet for the 328p -- look for atmel_doc8721.pdf.
Section 9 is "System Clock and Clock Options". Section 9.6 is "Calibrated Internal RC Oscilator". That's the internal 8MHz clock source option.
Table 9-11 tells you the four CLKSEL bits should be set to 0010 to enable this option.
Where are these bits? Jump to section 28, "Memory Programming". 28.2 is "Fuse bits". It details the settings for all three fuse bytes, in tables 28.6, 28.8, and 28.9. In table 28.9 it shows the CLKSEL bits are the lowest four bits of the Fuse Low byte.
Now that you know what to program, you have to decide how to do it. A simple way is just to modify the fuse settings in the IDE entry for the 328p in boards.txt (in hardware/arduino).
uno.bootloader.low_fuses=0xff -> uno.bootloader.low_fuses=0xe02 (also changing SUT bits to 10... table 9-12)
uno.build.f_cpu=16000000L -> uno.build.f_cpu=8000000L
then program as an Uno, that should do it.
Even better to make a copy of the whole Uno section in boards.txt, and create your own modified custom variant, if you plan to do this a lot.