Go Down

Topic: What If?. (Regarding Crystals and Caps) (Read 1 time) previous topic - next topic

cjdelphi

Take any Atmel chip which relies on a 2 pin crystal oscillator.

You attach the 27pf caps, wire it all up correctly, upload and have it blink 1second of / 1 second off.

We now remove the 2 ceramic caps. (i've tried this)

In my test.

2 Attiny85s

1 Attiny, used the Caps and a 2 pin 20mhz crystal
2nd Attiny, used just the 20mhz crystal

The only visible difference was the LED's were starting to shift out of phase, maybe 1 - 2ms gain/loss every second..


But what i found interesting is the chip kept on working without the Caps.... I wish i tried to upload without the caps and just relying on the crystal now, so why
are the 2 ceramic low value cap's so vital in the role of time keeping?

retrolefty


Take any Atmel chip which relies on a 2 pin crystal oscillator.

That is really a 2 pin crystal resonator. A crystal oscillator is a different animal. A crystal resonator plus the internal clock electronics inside a AVR chip creates a crystal controlled oscillator.

You attach the 27pf caps, wire it all up correctly, upload and have it blink 1second of / 1 second off.

We now remove the 2 ceramic caps. (i've tried this)

In my test.

2 Attiny85s

1 Attiny, used the Caps and a 2 pin 20mhz crystal
2nd Attiny, used just the 20mhz crystal

The only visible difference was the LED's were starting to shift out of phase, maybe 1 - 2ms gain/loss every second..


But what i found interesting is the chip kept on working without the Caps.... I wish i tried to upload without the caps and just relying on the crystal now, so why
are the 2 ceramic low value cap's so vital in the role of time keeping?

Because the marked frequency of the crystal resonator was manufactures based on it working with a specified fixed amount of external capacitance loading. Some of the capacitance loading comes from the internal capacitance of the clock pins of the AVR and the external 'padding capacitors' supply the rest. The crystal resonator will still oscillate at different cap loading values, but just not at the exact frequency it is marked at. So it still works but at a slightly different frequency, typically higher as you lesson the cap loading.
Lefty


cjdelphi

ahhh, well out of curiosity, i went and just re-tried what i tried a few weeks back

I was wrong..


You CAN upload via ISP of an Arduino and flash the bootload and upload binaries, with nothing more than just a 20mhz crystal, no caps.
You CAN'T however run a sketch and have it run with just the 20mhz crystal, eg let's say pin 0 on/1000ms/0 off , what will happen is pin 0 will trigger high or low and not turn off, no idea what's going on here.

Interesting, to simply flash a new bootloader or upload a sketch, the Cap's don't appear to be needed!

be80be

If he doing this on a solder-less bread board the board has capacitance
That let's the chip run but the same setup on a PCB will not run. Seen people do this.
Ive even seen the solder-less bread board load a crystal using caps remove them and it  runs fine.

fungus


I've tried this and it works!!!


The 'Mythbusters' approach to science isn't always the best...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

michael_x

Quote
eg let's say pin 0 on/1000ms/0 off , what will happen is pin 0 will trigger high or low and not turn off


I'm specialist for silly errors:
What about a sketch like: pin 0 on/1000ms/0 off /1000ms
Perhaps that one works even with stray caps only ;)

dhenry

Quote
why
are the 2 ceramic low value cap's so vital in the role of time keeping?


You can upload / run a mcu without those caps, except that the clock will be off by 100ppm (for most crystals). That translates into about 10 seconds off every 24 hours, or 0.1ms per second.

cjdelphi

Apparently not so, i've tried :P (yes you can upload just fine).

Code: [Select]

/*
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.

 This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 0;

// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);    
}

// the loop routine runs over and over again forever:
void loop() {
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);               // wait for a second
}


Uploaded to an Attiny85 using a 20mhz crystal no problems!

Running it however.... just a no go, the Pin stays high or low, it seems a little erratic.

Place the caps back, reset it, off it goes quite happily.

fungus


Apparently not so, i've tried :P (yes you can upload just fine).


I don't think you need a clock for uploading a program.

(somebody correct me if I'm wrong...!)
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Jack Christensen



Apparently not so, i've tried :P (yes you can upload just fine).


I don't think you need a clock for uploading a program.

(somebody correct me if I'm wrong...!)


A clock is required for ICSP programming and when using the bootloader.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

fungus


A clock is required for ICSP programming and when using the bootloader.


Sort of...

The datasheet says you need a clock input if the fuse bits have been set to 'external clock'. If the fuses are set for 'internal clock' then you don't need a crystal.

(This seems a bit silly - why not always use the internal clock when programming? That way it can never fail...)


Obviously some sort of clock is always needed for the bootloader it's a program running on the chip...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

MarkT

Quote

(This seems a bit silly - why not always use the internal clock when programming? That way it can never fail...)


Its probably that the relevant parts of the chip (clock source select and ICSP programming) aren't neighbours so
you'd have to route a signal all the way across the die to implement it (and this wasn't deemed a priority as the
chip comes from the factory with internal 8MHz clock pre-fused - the common case is programming the chip
once from factory-state during mass-production)
[ I won't respond to messages, use the forum please ]

fungus


Its probably that the relevant parts of the chip (clock source select and ICSP programming) aren't neighbours


They don't have to be. The relevant signal comes from the RESET pin and that's connected all across the chip.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Krupski

#13
Dec 13, 2012, 06:15 pm Last Edit: Dec 13, 2012, 06:18 pm by Krupski Reason: 1

Take any Atmel chip which relies on a 2 pin crystal oscillator.

You attach the 27pf caps, wire it all up correctly, upload and have it blink 1second of / 1 second off.

We now remove the 2 ceramic caps. (i've tried this)

In my test.

2 Attiny85s

1 Attiny, used the Caps and a 2 pin 20mhz crystal
2nd Attiny, used just the 20mhz crystal

The only visible difference was the LED's were starting to shift out of phase, maybe 1 - 2ms gain/loss every second..


But what i found interesting is the chip kept on working without the Caps.... I wish i tried to upload without the caps and just relying on the crystal now, so why
are the 2 ceramic low value cap's so vital in the role of time keeping?


I don't know what real good the capacitors do. I've built bare boards with replica Duemilanove boards and I never use the crystal loading caps.

Also, for what it's worth, I don't use the stock "low power crystal" fuse setting.... I use full swing. I get double the waveform height on the crystal, more immunity from stray capacitance (i.e. finger touching the board or wiring in a protoboard) and it draws a whopping 1 milliamp more.

If you want to do this, change "LOW FUSE" from 0xFF to 0xF7.
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

dc42

Apart from loading the crystal to get the correct frequency, the caps form a grounded centre-tap on the resonant circuit so that the signal inserted at one end is phase shifted by 180 degrees when it emerges at the other end. Look up Colpitts Oscillator on wikipedia.

If you don't connect the capacitors, you are relying on pin + stray capacitance, which will often work, but isn't guaranteed to. So you should always use the capacitors, unless you use a 3-terminal ceramic resonator instead of a crystal.
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.

Go Up