Switching from a crystal to a resonator, actual experiences?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know this has been discussed many times before, but this time from a different perspective.

I think I have never used an AVR with a ceramic resonator, only with a crystal.

Now I would really need the PCB real estate for something else, so I am considering a resonator, as they are smaller and require less external components (load caps are built-in to some resonators, but not all).

So my question is that what problems have you encountered with ceramic resonators, if any? Should I just expet it to work and forget about it? Any startup problems? Any suggestions about setting fuses differently or including series or feedback resistors in the circuit?

I am also interested in what way do I have to take into account serial port communication knowing that resonators are only 1%-2% accurate while crystals are 100ppm-200ppm in non-tuned circuits? Should I include delays between bytes, or between some amount of bytes, if transmitting bursts of continuous data as fast as possible (interrupts or not, don't know yet. Baud rate 115200 maximum.) I only know that 2% is good enough for a single byte, but is it good for data packets?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

2% is fine, 1% is nicer. The fact that it is a "packet" is not significant if it is async serial. Each character starts with its own unique timing and things have to stay good only for the duration of the character. That is what the start bit is for. This is a little different if you use Manchester or NRSI encoding but its fine for UART based data.

I am putting together a board right now (not running yet) with a resonator for the same reasons. It is not running yet so I don't have details. I chose a 1% resonator just for the reasons you mentioned. A resonator-based oscillator SHOULD start up faster because its Q is lower than a crystal.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd have to read the specs of few different uarts (AVR, 8250/16550 and maybe few others), but it seems that the start bit is detected on the edge, and sampled half a bit time later, and subsequent bits (8 data and 1 stop in my case, propably no parity or no 2 stop bits) are sampled in the middle, and after sampling the stop bit in the middle, the uart is ready for new start edge, even if the stop bit end time has not yet reached.

I just have to verify most uarts do it like this. They propably do so, but for example the AVR uart samples the data 3 times in the middle of the bit, so if this is true for stop bit too and other usarts, I just need to be sure that the 2% maximum error suggested in the datasheets is okay for other usarts too.

I never thought of the clock drift and how early the usart is ready before the next actual start bit, mainly because less than 1000ppm at least works.

And it seems I've forgotten the fact that most computers have it 0.16% off - thats 1600 ppm! They generate the usart clock from 24MHz/13, and the 24MHz is again generated from 14.318MHz colourburst with PLL.

Edit: Also can anyone suggest good small SMD ceramic resonators with internal load caps (three legs)? I've only seen ones with +/- 0.5% initial accuracy, +/- 0.3% for temperature between -20/+80 celcius and +/- 0.3 for 10-year aging - that is where I took the 1-2% figure. I believe they were manufactured by Oscilent. Frequency preferably 4,6,8 or 12 MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We have always used crystals as well. On a recent contract job with important timing requirements, the design has a resonator. And I was thus skeptical...

They are apparently less expensive. Re board real estate: That depends somewhat on the speed, doesn't it? Higher frequency crystals come in a tiny package. I forgot what the cutoff for the lowest frequency of the smaller package though; like 8MHz maybe?

The resonator has much worse specs on temperature drift.

When I actually started using it on the target app board, it seemed very accurate and with no bothersome drift at least over reasonable temperatures.

This 20.0MHz module is a 6-pin device, and is certainly no smaller than a crystal & 2 caps.

Now, crystals are supposed to be sensitive to vibration and shock, right? Are the resonators tougher in that respect? That could be a justification as well in a vibration environment such as mounted on a piece of equipment or vehicle.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using AVX PBRC series. EIther from DigiKey or Mouser, not sure which.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm in a similar situation to the OP. I am about to tweak a current board enough to warrant looking at the whole design. I make about 200 of these a year and it's a through-hole design.

 

If I swap from a crystal and two ceramic capacitors to a 3-pin resonator I can...

 

a) reduce the part count by 67%

b) reduce the BOM line count by 50%

c) reduce the parts cost by 40%

d) reduce the solder joint by 50%

 

The resonator I'm looking at is +/-0.5% tolerance which is more than good enough for serial comms.

 

It feels like a no-brainer. In the intervening 9 years has anyone had any bad experiences with resonators?

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I stepped on one in bare feet... and no my name is not Tom. cheeky

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jepael wrote:
PCB real estate
So the underlying idea is making your pcb smaler and not nessecarilly the Ceramic thingie itself?

Below a picture I stole from Ali from an "arduino nano". I don't know exacly what's under that little can but lots of (Chinese) arduino's seem to be sold lately with such an oscillator component.

Edit:

It's almost certainly a ceramic or quarts oscillator. There is a small gnd plane between it and the uC (connected to GND pins 3 & 5 and the Xtal pins 7 & 8 of the TQPF  are connected to the little can.

That oscillator is probably also the cheapest you can find. Chinese are good at selecting cheap parts smiley

It might be worth buying a few just to look at the oscillator performance.

 

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Mon. Feb 5, 2018 - 03:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:

 don't know exacly what's under that little can but lots of (Chinese) arduino's seem to be sold lately with such an oscillator component.

Oscillator pins are on pins 7 & 8 for TQPF and those are connected to the little can.

 

Is that a ground connection running under the part? So it might be an SMT three-terminal resonator.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
... has anyone had any bad experiences with resonators?
Conversely, one who designed in a resonator for a mega328PB ;

http://www.avrfreaks.net/forum/fan-control-prototype-unsure-some-parts-circuit#comment-2088696

by JoniS

...

E: resonator is co-operating, based on PWM signal applied to pins, which is what it is supposed to be.

...

Edit: link target

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Feb 5, 2018 - 03:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Arduino folk replaced the 16MHz Crystal on the the original "Uno" with one of the tiny SMD resonators that Paul mentioned (beating China's Nano Clones, I think.)

Ever since there have been complaints about Ardunios making lousy clocks (0.5% is about 7minutes/day), but AFAIK no other serious problems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should I include delays between bytes, or between some amount of bytes, if transmitting bursts of continuous data as fast as possible (interrupts or not, don't know yet. Baud rate 115200 maximum.) I only know that 2% is good enough for a single byte, but is it good for data packets

With a normal 10 bit (1 start, 8 data, 1 stop) a byte take 160 clk, and a "normal" UART can start receive next byte after 154 clk so that is 3.75%, so that is max difference for a packet of data. 

A common way to make a small delay is to have the transmitter have 1.5 or 2 stop bits, and the receiver 1.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:
a "normal" UART can start receive next byte after 154 clk so that is 3.75%
But don't forget that both the transmitter and the receiver have to fit in that error budget.

To be safe you have to split that value in 2. So 1.87% for each.

 

Jepael wrote:
I only know that 2% is good enough for a single byte, but is it good for data packets?

The receier resynchronizes on the startbit of each received byte, so it does not matter how many bytes you want to receive.

 

=====================

Special case:

I once had a project where a PC send data to an AVR and the AVR modified the data a bit for an RS485 network.

The uC was an attiny2313 with only 128 bites RAM, but packets could be upto 240 bytes long.

To be "safe" the AVR would have to accumulate approximately ceil(1+240*0.04) =  11bytes in it's buffer before starting to send.

I did not calculate that back then and started sending after 4 bytes were received.

And I had errors on long packets, they did not pass completely hrough the AVR because the original AVR program just stopped sending if the circular buffer ran empty.

I also wanted to keep latency low and did not want to accumulate more bytes in the circular buffer of the AVR.

I finally solved it by adding small delays between bytes in the AVR if the circular buffer ran empty before a complete packet was sent.

To do that properly I had to decode the packets in the AVR and what I first thought to be a "small" project turned into an effort of a week to do it "neatly".

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com