Pages: [1] 2 3 ... 5   Go Down
Author Topic: [SOLVED] Set Low Fuse Bit, Now Can't Program over ISP  (Read 5069 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
> 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

« Last Edit: November 18, 2012, 11:43:35 pm by Aakash » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Clock output on PORTB0; [CKOUT=0]

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

Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: November 17, 2012, 03:23:15 am by Aakash » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does the resonator have to be removed?

No.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
Logged

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.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nick,

I tried using -B250:
Code:
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)


* Screen Shot 2012-11-17 at 3.12.08 AM.png (163.98 KB, 1434x860 - viewed 42 times.)
Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: