I created a new bootloader for 1Mhz (8Mhz internal oscillator / 8), 1.8V BOD, 4800 baud rate and tried to upload it using my USBasp. Now I can't do anything with the Nano. It won't even accept the original unmodified Nano bootloader. I can still upload a bootloader to a different Nano, so it's not the USBasp or Arduino IDE that's the problem.
The output is the same as normal until it gets to here:
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Error while burning bootloader.
Thanks for any help.
That's mysterious, as you shouldn't be able to brick it unless you screw up the fuses. No matter what you scribble over the flash.
What fuse values did you write to it? Doublecheck you didn't set it to an external clock, disable reset, or disable SPI programming.
Does your USBAsp work on freshly bought (virgin, unbootloaded, 1mhz from factory) chips? Some versions of the USBAsp firmware have issues with how to set the SCK speed - I've had the best results with the PeterVH/bperrypap firmware they posted on 5/18/2016 (both the common chinese f/w and that one set the SCK speed on their own. Some don't, and on those, this can be an issue. I think there's a command line switch you can pass AVRDude to tell those to slow down SCK)
I attempted to write
low fuses=0x62
high fuses=0xDA
extended fuses=0xFE
It was simply a continuation of something else I was doing a few months back:
http://forum.arduino.cc/index.php?topic=451595
DrAzzy:
Does your USBAsp work on freshly bought (virgin, unbootloaded, 1mhz from factory) chips? Some versions of the USBAsp firmware have issues with how to set the SCK speed - I've had the best results with the PeterVH/bperrypap firmware they posted on 5/18/2016 (both the common chinese f/w and that one set the SCK speed on their own. Some don't, and on those, this can be an issue. I think there's a command line switch you can pass AVRDude to tell those to slow down SCK)
I'm not sure. I'm using a genuine USBasp. According to the website the firmware hasn't been touched since year 2011.
http://www.fischl.de/usbasp/
DrAzzy:
I think there's a command line switch you can pass AVRDude to tell those to slow down SCK)
I've just had a thought. My USBasp has a jumper for 'slow clock', so I may as well try that.
Oh ya, if you have an official one with that old f/w, that could be the issue (it's not an issue on the clones from ebay, at least not most of them). Try the slow clock jumper - it may work.
Otherwise, I'd be inclined to try updating it to the 5/18 firmware (or maybe get a new USBAsp and upgrade that one, so you don't take out your ASP if you slip up).
The problem with actually using your bootloader is probably the accuracy of the internal oscillator (that's why most 8mhz boards still use a crystal!) - UART requires +/- 2%, but factory cal is +/- 10% (though you can tune it to within 1%, though this has to be done for a specific voltage and temperature, as the internal oscillator's frequency is fairly strongly dependent on voltage and temperature).
DrAzzy:
Oh ya, if you have an official one with that old f/w, that could be the issue (it's not an issue on the clones from ebay, at least not most of them).
Strange that USBasp never bothered updating. Maybe they lost interest due to all the clones.
DrAzzy:
Try the slow clock jumper - it may work.
It worked. Thanks for helping me work out the problem.
DrAzzy:
factory cal is +/- 10% (though you can tune it to within 1%, though this has to be done for a specific voltage and temperature, as the internal oscillator's frequency is fairly strongly dependent on voltage and temperature).
I think the 10% is mostly Atmel covering themselves. Most units will probably be fairly close to 8Mhz, although as you said, there will be variations with temperature and voltage.