From reading through the avrdude documentation, many tutorials on the web & the avrdude commands that the Arduino IDE attempts when setup to upload sketches using the ISP, I think the following command should work to upload a sketch;
This seems to upload successfully, but the Uno doesn't then start blinking. Instead, the L LED lights up & remains lit. I have tried changing the pin used for the LED from 13 (the onboard LED) to 8 (an LED on a breadboard).
Update - Another discovery, not sure how diagnostic it is. If I burn the regular 328 bootloader, the IDE cannot even upload a sketch over USB. If I burn the 328 pro 8MHz bootloader however, the IDE successfully uploads the sketch but it doesn't then run.
It's a standard Uno R3, so there is a SPK16.000G oscillator on the board. It should work 'out of the box' with the IDE, which it did before I started playing about with the ISP - I just want to return it to such a state so I can actually get sketches working on the thing!
Can somebody confirm the 'correct' behaviour of the L LED when everything is working correctly?
If I burn the ATmegaBOOT_168_atmega328.hex bootloader & cycle the power, L blinks once per second. I can't upload sketches via the IDE & USB with this bootloader burnt.
If I burn the ATmegaBOOT_168_atmega328_pro_8MHz.hex bootloader & cycle the power, L blinks once per half second (presumably because it's an 8MHz bootloader & the Uno R3 has a 16MHz oscillator). I can't upload sketches via the IDE & USB with this bootloader burnt.
If I burn the optiboot_atmega328.hex bootloader & cycle the power, L blinks quickly 3 times & then turns on & remains on. I can upload sketches via the IDE & USB with this bootloader burnt, but they don't run correctly when I cycle the power. If I upload Blink (using digital pin 8 for an LED on a breadboard), when I cycle the power L blinks 3 times & then turns on permanently, at which point the LED on pin 8 turns on permanently - it doesn't blink.
If I upload Blink using the ISP & then cycle the power, L lights up permanently & the LED on pin 8 lights up permanently. I don't know whether this replaces the bootloader or not, however the reset is much faster so it may do.
One final point, I have set the fuses as follows, can anybody tell me whether these are the correct values?
'Burn Bootloader' in the IDE simply calls avrdude with the settings defined in boards.txt for the particular board being used. I have already called avrdude with the settings defined in boards.txt for my Uno many times, doing it via the IDE isn't going to change anything.
But I'm getting nowhere so I'll humour the idea.
Firstly, here are the settings for the Uno from boards.txt;
As you can see, they are the same. The -C flag in the IDE's commands is ignored because the conf file it references doesn't exist so it just uses the default.
I did actually burn the bootloader from the IDE & as I expected it made no difference - Blink still does not run.
Another update for anybody reading along or coming via Google. This morning I received a 'clone' Arduino R3 from Hong Kong (an 'EKitsZone Uno'). I didn't touch the programmer or do anything to the bootloader & it presents the same behaviour - Blink without the Serial.begin doesn't work, with Serial.begin does work, so it is very unlikely that there is anything wrong with my official R3.