What If?. (Regarding Crystals and Caps)

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

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!

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.

cjdelphi:
I've tried this and it works!!!

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

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

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.

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

/*
  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.

cjdelphi:
Apparently not so, i've tried :stuck_out_tongue: (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...!)

fungus:

cjdelphi:
Apparently not so, i've tried :stuck_out_tongue: (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.

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

(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)

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

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?

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.

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.

to paraphrase what dc42 said - You Got Lucky!

It may work fine for now, but when it gets to the real world it may not happen to have sufficient capacitance and it may not prove reliable.

Just like you could drive your car without the cotter pins in the ends of the axles. Until a wheel falls off.

I don't use the stock "low power crystal" fuse setting.... I use full swing.

Most manufacturers provide a few levels of gains / drive for the crystal oscillators, like full swing (for 4-8Mhz crystals to 24-32Mhz crystals), crystal (for 1 - 8 Mhz crystals) and low-power (32khz). Lower gains help minimize the risk of crystal overdrive and its resulting aging / drifting effect.

With a 16Mhz crystal, I would always use the full swing oscillator.

Even from an expensive retailer, the capacitors needed will cost $0.06 and make sure that the crystal oscillates correctly, reliably and within needed tolerances. Seems a small price to pay.

This is purely curiosity, i'd indeed use cap's if i required a crystal.

Meanwhile... Pwillard considers forming the SPCEC. The Society for the Prevention of Cruelty to Electronic Components.

:frowning: