Am i bootloading wrong?

Hi,

I have some custom atmega328s (same as Pro Mini) on a customised PCB. I believe I bricked (no longer responsive) the atmega328 on a few of the chips although I am not sure exactly how this was done.

I got as far as changing the 'bricked' atmegas. After swapping this with a new one, I uploaded a simple program to test it, selecting the board as 'Arduino Pro or Pro Mini (3.3V 8MHz) w/ATmega328'. Everything worked fine. I changed another 'bricked' atmega and tested the same way using the AVRISP mkii. Then realised the time was out so tried to bootload the chip, then got the same error for both,

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

Does this screw the chips? Looks like I will need to replace both again.

Thanks

Your custom board has a 8mhz crystal connected to it, along with loading caps as specified by cap manufacturer?

Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

--------------------------------------------------

(snip)
pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF

IE, internal crystal - same as:

pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF

If you were planning to use the internal RC oscillator, you should not have bootloaded it with a board def that specified use of an external crystal.

You need to set the fuses back. But you can't do that, because the chip can't enter programming mode because it has no clock. You can sometimes get away with connecting a crystal (doesn't need to be 8mhz) to the appropriate pins, or you can supply an external clock signal, or use an HVSP programmer to unbrick it.

If burn bootloader bricks the part, what you don't do is grab the next one from the pile and brick that one too :wink:

Thanks for your response.

Your custom board has a 8mhz crystal connected to it, along with loading caps as specified by cap manufacturer?

No, my board uses the internal crystal.

Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

--------------------------------------------------

(snip)
pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF

IE, internal crystal - same as:

pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF

What fuse settings should be used? I would like to use the watch dog timer also. Do I need to use an option from Optiboot?

If you were planning to use the internal RC oscillator, you should not have bootloaded it with a board def that specified use of an external crystal.
If burn bootloader bricks the part, what you don't do is grab the next one from the pile and brick that one too :wink:

Yeah, I learnt the hard way :slight_smile:

I used to frequently have issues getting the fuse settings that I want selected from using “burn bootloader” for stand alone boards. Also I really loathe using command line interface, so I downloaded a GUI for avrdude (the one I downloaded is AVRDUDESS), you can pick your chip, use a pre defined profile, set the fuse, and even upload sketches without a bootloader (if you are using an ISP programmer such as the USBsasp, AVRISP, etc). Certainly not saying that this program works for every situation, but it has helped me out a few times when I messed up chips using burn bootloader.

Also as far as fuse setting, handy fuse calculator website…

http://www.engbedded.com/fusecalc

Thanks for your suggestions.

With the post on using the 8MHz internal clock, http://www.lydiard.plus.com/chapter11.htm, will this enable the use of the watchdog timer also? I'd like to burn the bootloader using my avrisp mkii.

atmega328.name=ATmega328 (INT 8MHz Clock ArduinoISP)
atmega328.upload.using=arduino:arduinoisp
atmega328.upload.maximum_size=30720
atmega328.bootloader.low_fuses=0xE2
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x05
atmega328.bootloader.path=arduino:atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F
atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=8000000L
atmega328.build.core=arduino:arduino
atmega328.build.variant=arduino:standard

Greatly appreciate any support.

I'm not sure if the bootloader works with the WDT on, IIRC some bootloaders don't know to reset the WDT.

Note that you don't need to set the WDT always on fuse to enable the WDT at runtime.

But high fuses should be CA if you really do want to set the WDT always on fuse