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

I'm not offering a magic bullet here. The symptoms as you describe them do not have a simple solution. I have a Uno here that just stopped working. I am assuming I zapped it with static, but can't be sure what is wrong. Maybe you did that yourself. Who knows? But if the thing isn't working, you may as well explore as many options as you can.
Logged

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

Nick,

It's possible! I'm just trying to find anything I can do before sending off to get rework done to replace the AVR and resonator.

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

Referring back to the logic analyser screen shots you posted earlier, the middle one (clock connected to XTAL1 through 1.5K resistor) looks exactly as it should. The frequency at CLKOUT is 1/8 of the clock you are feeding it because you have the fuse set to use the clock prescaler. We know that the your mcu wasn't oscillating before because you were unable to detect a clock on CLKOUT, and this explains why your ICSP was unable to read the device signature.

Have you tried using your ICSP to read the fuses, with the clock configured like this?
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: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

dc42 - I set your sketch to run at 1MHz and connected it to XTAL1. Then ran "avrdude -c avrispmkII -p m328p -P usb -B250" but no-go unfortunately. I suppose I'll just inquire about getting rework done to replace the mcu and resonator.

Thanks anyways guys, I really appreciate your help. When I get the board back I'll be sure to ask on this thread what fuses to set to what values. :-)

Thanks,
Aakash
Logged

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

Referring back to the logic analyser screen shots you posted earlier, the middle one (clock connected to XTAL1 through 1.5K resistor) looks exactly as it should.

Are you certain?  I does look like a nice clean clock signal but I read that horizontal scale as 1/10 of a second.

If I'm reading it correctly, the SCK period would have to be about 1/2 of a second (which may actually work).
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

Referring back to the logic analyser screen shots you posted earlier, the middle one (clock connected to XTAL1 through 1.5K resistor) looks exactly as it should.

Are you certain?  I does look like a nice clean clock signal but I read that horizontal scale as 1/10 of a second.

If I'm reading it correctly, the SCK period would have to be about 1/2 of a second (which may actually work).

Good catch! I assumed that the horizontal scale of the 1st and 2nd images was the same, without looking at the figures. But how could a 1MHz signal on XTAL1 give rise to a signal of about 12Hz on CLKOUT ?

Aakash, are you certain that images 1 and 2 were taken with the same sketch generating the clock signal?
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: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aakash, are you certain that images 1 and 2 were taken with the sane sketch generating the clock signal?

I'm 100% sure. I just tried it again today and the output was identical.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

Can you post the sketch you are using to generate the clock signal?
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: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post the sketch you are using to generate the clock signal?

Code:
// Generate a square wave of a given frequency on the OCR1A pin

#define REQUIRED_FREQUENCY  (1000000)
#define REQUIRED_DIVISOR ((F_CPU/REQUIRED_FREQUENCY)/2)

#if (REQUIRED_DIVISOR < 65536)
# define PRESCALER  (1)
# define PRESCALER_BITS  (1)
#elif (REQUIRED_DIVISOR < 8 * 65536)
# define PRESCALER  (8)
# define PRESCALER_BITS  (2)
#elif (REQUIRED_DIVISOR < 64 * 65536)
# define PRESCALER  (8)
# define PRESCALER_BITS  (3)
#elif (REQUIRED_DIVISOR < 256 * 65536)
# define PRESCALER  (8)
# define PRESCALER_BITS  (4)
#elif (REQUIRED_DIVISOR < 1024 * 65536)
# define PRESCALER  (8)
# define PRESCALER_BITS  (5)
#else
# error Bad frequency
#endif

# define TOP        (((REQUIRED_DIVISOR + (PRESCALER/2))/PRESCALER) - 1)

void setup()
{
  pinMode(9, OUTPUT);
  digitalWrite(9, LOW);
  TCCR1A = 0;
  TCCR1B = (1 << WGM12) | PRESCALER_BITS;    // turn on
  TCCR1C = 0;
  OCR1AH = (TOP >> 8);
  OCR1AL = (TOP & 0xFF);
}

void on()
{
  TCNT1H = 0;
  TCNT1L = 0; 
  TCCR1A = (1 << COM1A0);
}

void off()
{
  TCCR1A = 0;
}

void loop()
{
  // Generate a burst 2ms long, then wait 10ms before generating the next one
  on();
  delay(2); 
  off();
  delay(10);
}
Logged

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

Note: I tried removing the void loop() and just putting on() at the end of setup() and that resulted in no clock signal being output on CKOUT. There was a clock signal being output on the source Arduino, however.
Logged

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

But how could a 1MHz signal on XTAL1 give rise to a signal of about 12Hz on CLKOUT ?

I suspect witchcraft.  Or possibly a gypsy curse.
« Last Edit: November 18, 2012, 03:04:42 pm by Coding Badly » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

Note: I tried removing the void loop() and just putting on() at the end of setup() and that resulted in no clock signal being output on CKOUT. There was a clock signal being output on the source Arduino, however.

That should have been exactly the right thing to do. Try doing it again, but also reduce REQUIRED_FREQUENCY in case 1MHz is a little high, given that you have the resonator still connected and a 1.5K resistor in series with the clock signal. As the Arduino you are using to generate the clock is also 3.3V, I think you can also safely try it without the 1.5K series resistor. What you are looking for is a signal on CLKOUT at a reasonable frequency.
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: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That should have been exactly the right thing to do. Try doing it again, but also reduce REQUIRED_FREQUENCY in case 1MHz is a little high, given that you have the resonator still connected and a 1.5K resistor in series with the clock signal. As the Arduino you are using to generate the clock is also 3.3V, I think you can also safely try it without the 1.5K series resistor. What you are looking for is a signal on CLKOUT at a reasonable frequency.

So what you're saying is that I should lower the REQUIRED_FREQUENCY to a number until CLKOUT starts showing a steady clock? Right now, at 1MHz, the analyzer doesn't detect anything on CLKOUT at that speed.
« Last Edit: November 18, 2012, 03:15:55 pm by Aakash » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

Yes, try that and/or try removing the 1.5K resistor. I'm guessing that turning the clock on/off in loop() is what is actually causing CLKOUT to toggle. Maybe the clock signal is not strong enough to drive XTAL1 @ 1MHz given that 1.5K is on the high side (I suggested 100 ohms originally) and the resonator is still connected. At a lower frequency, the resonator impedance should be higher, judging from the impedance plot in the datasheet, which will result in a stronger signal on XTAL1.
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: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a signal generator? Try pushing through some low frequency like 128 KHz until CLKOUT mirrors it. Or just modify the sketch that outputs a clock to get the same result.

Can you isolate /RESET from the rest of the circuit? Or, put it another way, is /RESET connected to any other devices?

If safe, you should be able to use an AVR Dragon (around $50) in high-voltage programming mode to recover, if the chip isn't actually damaged. High-voltage mode requires around 12V on the /RESET pin, which is why it needs to be isolated from other things (chips).
Logged

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