Go Down

Topic: [SOLVED] Set Low Fuse Bit, Now Can't Program over ISP (Read 6988 times) previous topic - next topic

Aakash

Nov 17, 2012, 08:38 am Last Edit: Nov 19, 2012, 05:43 am by Aakash Reason: 1
Hey all,

I'm using an ATMEGA328P in one of my projects and am having a slightly big issue. I have an 8MHz resonator attached to the XTALI/O pins of the AVR, the same resonator that's used in the Arduino Pro. I was using the AVR ISP MKII along with AVR Studio and read in the factory set fuse bits. Then I changed the low fuse bit to 0x05, thinking this would set the chip to use the resonator. Boy, was I wrong. AVR Studio then gave me the error that fuse programming failed, and now I can't really do anything with the chip (note, regular .hex flash programming was working fine beforehand)

I read various articles online and tried debugging with avrdude at a slow speed, and below is the output:

Code: [Select]
> avrdude -p m328p -c avrispmkii -P usb -B5 -F

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F

avrdude done.  Thank you.


I read that high voltage programming would fix this up, but the ATMEGA328P is soldered professionally on the board in the QFN package, so unsoldering is not really an option. And it was pretty expensive to have the board manufactured and assembled. Also, when I designed the board, I only added an ISP header.

Is there a way I can recover this chip while it's in-circuit?

I greatly appreciate any help.

Thanks a lot,
Aakash


Coding Badly

Quote
Clock output on PORTB0; [CKOUT=0]


...is now enabled.  What is connected to B0?

Aakash

#2
Nov 17, 2012, 09:09 am Last Edit: Nov 17, 2012, 09:23 am by Aakash Reason: 1
If by B0 you mean PB0 (ICP), there is nothing connected to it except a male header pin. Should I do something with this pin?

Thanks!

dc42

Programming the low fuse byte should not prevent you from programming via ICSP. Did you program the high fuse byte as well? If not, then most likely your resonator is not oscillating. You appear to have programmed the CKSEL bytes for a crystal or resonator in the frequency range 0.9 to 3.0 MHz (CKSEL 3..0 = 1010), whereas you are using a 8MHz resonator.

If you have an oscilloscope, then you can check whether you have a clock signal on the CKOUT pin. If there is no signal, then I suggest you disconnect the resonator and feed a clock signal to the XTAL1 pin. That should allow you to reprogram the fuse bytes.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Coding Badly

If by B0 you mean PB0 (ICP), there is nothing connected to it except a male header pin. Should I do something with this pin?


Connect an LED + current limiting resistor.  If the LED lights, the resonator is running.  If the resonator is running, you can reprogram the processor; it's just a matter of getting the ISP bitrate low enough.

If the LED does not light, the resonator is not running and you will have to follow @dc42's advice: remove the resonator and provide a clock signal on XTAL1.

@dc42: Does the resonator have to be removed?  Will it be damaged by a clock signal on XTAL1?

Nick Gammon

Quote
...am having a slightly big issue ...


A small issue?

You have set the "divide by 8" fuse. If you slow down programming you can probably talk to it.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Quote
Does the resonator have to be removed?


No.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Aakash

@Coding Badley - the system runs at 3.3V, when selecting the current limiting resistor should I account for that voltage or a lower one?

@dc42 - I have Saleae Logic analyzer, should I be able to use that to test if there is a signal being outputted?

@Nick - Should I go lower than -B5 rate?

Thanks for the help everyone!

Aakash

dc42


Connect an LED + current limiting resistor.  If the LED lights, the resonator is running.  If the resonator is running, you can reprogram the processor; it's just a matter of getting the ISP bitrate low enough.


Don't you need to connect the LED+resistor between the pin and ground, and then between the pin and Vcc, and check it lights in both cases? I wouldn't like to guess what state the CKOUT pin will have when there is no clock.


@dc42: Does the resonator have to be removed?  Will it be damaged by a clock signal on XTAL1?


I don't think there is any danger of damaging the resonator if you leave it in place. However, the resonator will present quite a low impedance at frequencies that are not very close to its resonant frequency, and the signal from XTAL2 will provide negative feedback via the resonator to XTAL1. So it may be difficult to provide enough drive from the clock source, unless you match the resonator frequency. I guess it's worth trying with the resonator connected first.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Nick Gammon


@Nick - Should I go lower than -B5 rate?

-B5?

I set mine to run at 128 KHz and could reprogram it with -B250. So, no.

Quote
@dc42 - I have Saleae Logic analyzer, should I be able to use that to test if there is a signal being outputted?


I don't think that's relevant.

Have you reprogrammed the high fuse by any chance?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Coding Badly

@Coding Badley - the system runs at 3.3V, when selecting the current limiting resistor should I account for that voltage or a lower one?


3.3V.

Coding Badly

Connect an LED + current limiting resistor.  If the LED lights, the resonator is running.  If the resonator is running, you can reprogram the processor; it's just a matter of getting the ISP bitrate low enough.


Don't you need to connect the LED+resistor between the pin and ground, and then between the pin and Vcc, and check it lights in both cases? I wouldn't like to guess what state the CKOUT pin will have when there is no clock.


Ooh.  Good point.  LED needs to light both ways around to ensure the clock is running.


Quote
@dc42: Does the resonator have to be removed?  Will it be damaged by a clock signal on XTAL1?


I don't think there is any danger of damaging the resonator if you leave it in place. However, the resonator will present quite a low impedance at frequencies that are not very close to its resonant frequency, and the signal from XTAL2 will provide negative feedback via the resonator to XTAL1. So it may be difficult to provide enough drive from the clock source, unless you match the resonator frequency. I guess it's worth trying with the resonator connected first.


Is a series resistor between the clock source and XTAL1 pin necessary?  A good idea?

dc42


@dc42 - I have Saleae Logic analyzer, should I be able to use that to test if there is a signal being outputted?


I'm not familiar with that device, but if you connect one of the channels to the CKOUT pin, then it should give you a frequency readout for that channel if there is a clock signal there.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dc42


Is a series resistor between the clock source and XTAL1 pin necessary?  A good idea?


As I've very little idea what sort of impedance the resonator will present, I would use one for safety, but only 100 ohms or so.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Aakash

Nick,

I tried using -B250:
Code: [Select]
avrdude -p m328p -c avrispmkii -P usb -B250 -F

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F



And regarding the high fuse question, I'm pretty sure. All I did was read in the fuse bits from the fresh chip and change the low bit by hand in AVR Studio. Though, I always could be mistaken.


@dc42 - I don't think CKOUT is outputting anything (see attached screenshot)

Go Up