Offline
God Member
Karma: 10
Posts: 870
|
 |
« on: December 12, 2012, 10:44:12 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #1 on: December 12, 2012, 10:53:29 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 10
Posts: 870
|
 |
« Reply #2 on: December 12, 2012, 11:14:17 pm » |
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!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 3
Posts: 230
|
 |
« Reply #3 on: December 12, 2012, 11:19:23 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2237
|
 |
« Reply #4 on: December 13, 2012, 04:38:32 am » |
I've tried this and it works!!!
The 'Mythbusters' approach to science isn't always the best...
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Edison Member
Karma: 27
Posts: 1487
|
 |
« Reply #5 on: December 13, 2012, 04:55:36 am » |
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 /1000msPerhaps that one works even with stray caps only 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #6 on: December 13, 2012, 06:31:34 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 10
Posts: 870
|
 |
« Reply #7 on: December 13, 2012, 06:49:53 am » |
Apparently not so, i've tried  (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.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2237
|
 |
« Reply #8 on: December 13, 2012, 07:23:03 am » |
Apparently not so, i've tried  (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...!)
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2485
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #9 on: December 13, 2012, 09:36:29 am » |
Apparently not so, i've tried  (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.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2237
|
 |
« Reply #10 on: December 13, 2012, 10:33:26 am » |
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...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 71
Posts: 6603
Arduino rocks
|
 |
« Reply #11 on: December 13, 2012, 11:16:47 am » |
(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)
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2237
|
 |
« Reply #12 on: December 13, 2012, 11:54:31 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 15
Posts: 463
|
 |
« Reply #13 on: December 13, 2012, 12:15:49 pm » |
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.
|
|
|
|
« Last Edit: December 13, 2012, 12:18:03 pm by Krupski »
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4644
|
 |
« Reply #14 on: December 13, 2012, 12:29:40 pm » |
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.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
|