Crystals doing strange things - ideas?

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

Hi all,

 

Brief explanation: I built a small project using an ATTINY85 and a 22.1184 MHz. crystal. I edit the source using the NANO editor and compile/upload the code using a Makefile, GCC and Avrdude. The programmer is an Atmel AVR-ISP MK-II (a real one).

 

I made a programming cable that has a 6 pin connector on one end and an 8 pin "PDIP8" test clip on the other. The idea is to be able to program / test / program / test... the board. Across pins 2 and 3 of the test clip, I have a little SMD crystal of 16.000 MHz connected so that I can burn Tiny85 chips without needing an external clock. It all works fine.

 

Now, here's what I am wondering about: I was testing a new board I built, programming it with the little adapter (which, as usual, I left connected to the MCU). It slipped my mind that I had two crystals in parallel, and of two different frequencies (22.1 and 16.0).

 

My test code had a quick and dirty serial output using the 8 bit timer bit-banging an output pin - this also worked like a charm. However, when I first programmed the chip (leaving the test clip and it's 16 MHz crystal connected), I got serial gibberish on the terminal.

 

At first I thought I made a mistake with my bit-bang serial output code. I finally discovered that the 16 MHz crystal was "taking over" the 22.1 crystal. That is, with F_CPU in the Makefile set to 22118400UL and the programmer NOT connected, it all worked fine (at 115200 baud). If I left the programming cable connected (which placed it's 16 MHz crystal in parallel with the 22.1), the board ran at 16.0 (which I proved to myself by looking at the crystal on the 'scope and putting 16000000UL in the Makefile - then the serial output was perfect).

 

My questions are, how in heck did this thing work AT ALL? Why did the 16.0 seem to "take over" the 22.1?

 

Also, if this matters, I have a 105 (1 meg) resistor across the crystal and an 18pF NP0 from each terminal of the crystal to ground.

 

Any ideas or info will be appreciated. If you need any more circuit details to figure this out, let me know and I'll try to provide it.

 

(See attached pics for clarification)

 

Thanks!

 

 

Attachment(s): 

This topic has a solution.

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Last Edited: Thu. Sep 24, 2020 - 03:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The impedance of the !6MHz crystal was probably lower,so the oscillation favoured it.

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

Kartman wrote:

The impedance of the !6MHz crystal was probably lower,so the oscillation favoured it.

 

It's that simple?

 

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

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

Why two in parallel? Seems bizarre to me!

 

The oscillator has more gain at lower frequencies. This likely favors the 16MHz one than the 22MHz one.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

The 22Mhz crystal will be high impedance. After all, it is a high-Q resonant circuit that is off-resonance.
.
So it is just a question of which crystal won at power-up. I suspect that a high activity 22Mhz might beat a low activity 16Mhz but West Coast Jim's answer is probably the best.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

Why two in parallel? Seems bizarre to me!

 

The oscillator has more gain at lower frequencies. This likely favors the 16MHz one than the 22MHz one.

 

Jim

 

As I said in the first post, I used my 8 pin test clip to connect to the Tiny85 installed on my board. The board, of course, has a crystal. My test clip also has a crystal connected to it so that I can program Tiny25/45/85 parts stand-alone (bare chip, not plugged into anything).

 

I merely FORGOT that I had the crystal attached to the test clip.

 

The idea that the crystal oscillator has more gain at lower frequencies seems to be the most plausible explanation for the effect I saw. <--The "Solution"

 

 

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Last Edited: Thu. Sep 24, 2020 - 03:51 AM