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

You won't measure an 8 MHz signal at an 8 MHz sampling rate.

http://en.wikipedia.org/wiki/Nyquist_rate
Logged


United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6614
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 don't think CKOUT is outputting anything (see attached screenshot)

I think you're right, although you'll need to use a sampling frequency much greater than 8MHz to reliably see a 8MHz signal, so check with it set to 24MHz.

If you have an Arduino, you can use it to generate a clock signal to feed to XTAL1. Don't forget to use a potential divider to drop the voltage if it is a 5V Arduino.
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: 6614
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

PS - is it a 3-terminal resonator? If yes, have you grounded the centre pin? If no, are you certain that the capacitors you connected between the XTAL pins and ground are about the right value, and you haven't accidentally used a value that is much too large?
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

@dc42

I think the output looks the same at 24MHz. I have a 3.3V Arduino, what freq signal should I be generating to feed to XTAL1? Also, should I still try connecting XTAL1 and CKOUT?

And regarding your resonator question: It is a three terminal resonator. I didn't use my own caps as I believe they're built in. http://www.digikey.com/product-detail/en/CSTCE8M00G55-R0/490-1195-1-ND/584632

Thanks,
Aakash

EDIT: And yes, the center terminal is grounded.


* Screen Shot 2012-11-17 at 3.30.40 AM.png (158.65 KB, 1434x860 - viewed 21 times.)
« Last Edit: November 17, 2012, 04:37:55 am by Aakash » Logged

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

The datasheet says that resonator has internal caps. I've use 8MHz ceramic resonators in my designs with no problems, although not at 3.3V and I set the low fuse byte to a more appropriate value.

Try feeding a clock signal from your 3.3V Arduino to XTAL1 through a 100 ohm resistor. The frequency doesn't matter much, I would try around 1MHz in the first instance. Leave CKOUT connected to your logic analyser so that you can check that you have a signal there.

Here's a sketch I use to get bursts of a known frequency on the OCR1A pin (pin 9 on an Arduino Uno):

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

#define REQUIRED_FREQUENCY  (38000)
#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

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

PS - have you checked for solder bridges on the XTAL1 or XTAL2 pins of the mcu?
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

@dc42 Thanks for the suggestion. I'll check for bridging tomorrow. I'll have to order a 100ohm resistor to test out the clock signal feeding. So that'll take a few days. I'll reply back with results then.

Thanks again everyone.
Logged

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

If you haven't got 100 ohms, try with 1K or whatever value >100 ohms you do have - it might work.

[EDIT: the datasheet for that resonator very helpfully gives the impedance at various frequencies. Based on that, at a clock frequency of 1MHz, even a 10K resistor may not be too high a value for it to work.]
« Last Edit: November 17, 2012, 08:50:56 am by dc42 » 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

@dc42 - I attached various screenshots of logic analyzer outputs. The file names are as follows:

  • RAW_SOURCE: the output of connecting the analyzer directly to Pin 9 of the clock source Arduino, which is running your code, through a 1.5K resistor.
  • XTAL1: The analyzer output on CKOUT due to connecting Pin 9 of source Arduino to XTAL1 pin on m328p through a 1.5K resistor
  • XTAL2: The analyzer output on CKOUT due to connecting Pin 9 of source Arduino to XTAL2 pin on m328p through a 1.5K resistor


I connected both the Arduino, m328p, and the logic analyzer to a common ground throughout these tests.

How should I proceed?

Thanks again!
Aakash


* RAW_SOURCE.png (166.71 KB, 1434x860 - viewed 25 times.)

* XTAL1.png (163.88 KB, 1434x860 - viewed 20 times.)

* XTAL2.png (169.71 KB, 1434x860 - viewed 20 times.)
« Last Edit: November 17, 2012, 06:21:42 pm by Aakash » Logged

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

Try running my "chip detector" sketch:

http://www.gammon.com.au/forum/?id=11633

That generates a clock signal on pin 9 as well in case you need it.
Logged


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

Nick,

I installed your sketch and hooked up the ICSP lines and the only serial output I got was "Atmega chip detector." I also tried connecting D9 to XTAL1 through a 1.5K resistor and the same was outputted.

Should I be doing something differently?

Thanks,
Aakash
Logged

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

I wouldn't worry about the resistor, but that sounds OK, assuming you followed my wiring. Sounds to me confirmation that it isn't responding to programming.

I wonder if, when you were changing the fuse in the Atmel Studio, you accidentally didn't notice that at the same time the high fuse was set to something that wasn't appropriate (like SPIEN). Once you turn off SPIEN you can't program through the SPI interface.
Logged


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

Nick,

AVR Studio read in the existing fuses, and showed me that only the low fuse had been modified (the field shows up with a notice once you modify it)

So, I'm pretty confident that I didn't change anything except low fuse.

Thanks though. 
Aakash
« Last Edit: November 17, 2012, 11:46:42 pm by Aakash » Logged

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

OK, well I would remove the resonator if that is possible. Then feed the clock (XTAL1) from the clock output on my test sketch with no resistor. No capacitors or anything on XTAL1 or XTAL2. Check the voltages on the other pins (VCC, AVCC). Use the logic analyzer to confirm you are getting the 8 MHz clock in, and that the SPI data is arriving on the correct pins.

Do you have decoupling capacitors on VCC, AVCC?
Logged


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

Nick,

I do have decoupling caps on both. I'll have to buy a hot air gun to remove the resonator. I'll order one and update this thread in a few days.

Thanks,
Aakash
Logged

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