Main Page | Report this Page
 
   
Science Forum Index  »  Electronics - Basics Forum  »  Correct crystal oscillator choice.
Page 1 of 1    
Author Message
Guest
Posted: Mon Jan 29, 2007 2:34 pm
I am building one of these http://plazma.kapsi.fi/diy/lanc_controller/
Its a LANC Controller (ie. remote control) for a Sony camcoder.

The project uses a PIC16F84A chip, which is a programmable
microcontroller.
I am very comfortable working with assembler, but I am not so
profficient with electronics. I'm having a problem with this project.

I've assembled everything on a breadboard (the chip is programmed and
verified), but it doesn't seem to work. I have a striking suspicion
that I bought a wrong crystal oscillator, and I can't find any
information on how to choose the correct device.

Do crystal oscilators come in different flavors when it comes to
waveform shape? Since this oscillator is used as a clock in the
circuit, does that mean that I need one that generates a square wave?

The oscillator I bought and am currently using is this one: http://
www.newark.com/jsp/Passives/Crystals/VISHAY+DALE/XT49S-204M/
displayProduct.jsp?sku=18C1488

Also I bought 22pF capacitors instead of the 18pF suggested in the
project. Would that affect anything?
As a related question, I've noticed that the clock signal circuit for
many chips is the same as the one in this project (crystal oscilator
and two caps), how do you know what capacitor values to use? I've read
in several places that it depends on the characteristics of the
specific oscillator, but I could not find any more detail.

Thanks in advance,
Nick.
Colin
Posted: Mon Jan 29, 2007 3:04 pm
Guest
<pacemkr@gmail.com> wrote in message
news:1170095699.167248.25570@q2g2000cwa.googlegroups.com...
Quote:
I am building one of these http://plazma.kapsi.fi/diy/lanc_controller/
Its a LANC Controller (ie. remote control) for a Sony camcoder.

The project uses a PIC16F84A chip, which is a programmable
microcontroller.
I am very comfortable working with assembler, but I am not so
profficient with electronics. I'm having a problem with this project.

I've assembled everything on a breadboard (the chip is programmed and
verified), but it doesn't seem to work. I have a striking suspicion
that I bought a wrong crystal oscillator, and I can't find any
information on how to choose the correct device.

Do crystal oscilators come in different flavors when it comes to
waveform shape? Since this oscillator is used as a clock in the
circuit, does that mean that I need one that generates a square wave?


No



Quote:

The oscillator I bought and am currently using is this one: http://
www.newark.com/jsp/Passives/Crystals/VISHAY+DALE/XT49S-204M/
displayProduct.jsp?sku=18C1488



That is the correct crystal.



Quote:

Also I bought 22pF capacitors instead of the 18pF suggested in the
project. Would that affect anything?



Any value between 15pF and 33pF is fine for the 4 MHz crystal.



Quote:
As a related question, I've noticed that the clock signal circuit for
many chips is the same as the one in this project (crystal oscilator
and two caps), how do you know what capacitor values to use? I've read
in several places that it depends on the characteristics of the
specific oscillator, but I could not find any more detail.


You can find this information in the datasheet for the PIC

http://pdf1.alldatasheet.com/datasheet-pdf/view/74979/MICROCHIP/PIC16F84A.html



My guess is that you have probably made a mistake somewhere in your
breadboard layout.

Quote:

Thanks in advance,
Nick.
DJ Delorie
Posted: Mon Jan 29, 2007 3:08 pm
Guest
This is a standard type of crystal clock. Note that IMHO you bought a
crystal, not a crystal oscillator (the latter implies some internal IC
logic to run the clock), but you did buy the right part. Based on the
crystal's part number, it wants 20pF caps (each crystal wants a
specific cap value, read the data sheets) but 22pF is probably close
enough, at most the frequency might be off a little.

The first thing to check is your wiring, especially the power, ground,
and reset lines. The caps should be grounded on the other side. Keep
the wires relating to the crystal as short as practical.

Now, do you have a way of checking to see if the crystal *is*
oscillating? Note that only one side of the crystal is safe to probe,
if you probe the other side you'll likely stop the clock (it won't
hurt anything, though) so check both pins. On some MCUs, the crystal
always runs, on others it has to be started in software.

After reading the specs for the crystal and the PIC, I make the
following observation: The crystal is an AT strip cut crystal. The
PIC spec says that a series resistor may be needed for AT strip cut
crystals; the PIC spec has a schematic. Also, make sure the FOSC
configuration bits are correctly chosen.
Guest
Posted: Mon Jan 29, 2007 5:53 pm
First of all, with all your guidance I got it to work. Thank you so
much!
In more detail, read on:

On Jan 29, 2:08 pm, DJ Delorie <d...@delorie.com> wrote:
Quote:
This is a standard type of crystal clock. Note that IMHO you bought a
crystal, not a crystal oscillator (the latter implies some internal IC
logic to run the clock), but you did buy the right part. Based on the
crystal's part number, it wants 20pF caps (each crystal wants a
specific cap value, read the data sheets) but 22pF is probably close
enough, at most the frequency might be off a little.

Thanks for clarifying the terminology. I think thats what drove me to
getting 22pF caps in the first place, looking at the crystal and PIC
datasheets, and the fact that I couldnt find a physically small 18pF
cap on Newark.

Quote:
Now, do you have a way of checking to see if the crystal *is*
oscillating? Note that only one side of the crystal is safe to probe,
if you probe the other side you'll likely stop the clock (it won't
hurt anything, though) so check both pins. On some MCUs, the crystal
always runs, on others it has to be started in software.

I do have a way of checking if the crystal is oscillating. My friend
gave me an extra Tektronix 485 oscilloscope he had laying around. I
use some high end oscilloscope in college so using this "old school"
electron beam scope was a new experience in its own. To make a long
story short, I saw no intelligible waveform on the scope, hence why I
though that my choice of crystal was the problem, although I had no
idea if the scope was even working correctly.

Quote:
After reading the specs for the crystal and the PIC, I make the
following observation: The crystal is an AT strip cut crystal. The
PIC spec says that a series resistor may be needed for AT strip cut
crystals; the PIC spec has a schematic. Also, make sure the FOSC
configuration bits are correctly chosen.

The configuration bits were the problem. To start things off I decided
to not modify the assembler code and just flash the PIC with the
preassembled Hex on the project website. I use the PicKit 2 programmer
to load the chip and when loading the Hex file the software displayed
a warning that configuration bits are not present in the Hex. I though
that perhaps these were set in the software since I assumed that the
Hex on the project site was complete. Now I know of course, that these
configuration bits can only be set when flashing the chip. If no value
is written into the configuration word the default is FF(hex), which
results in FOSC = 11(bin) -> RC mode for the oscillator. After making
a new Hex file with the configuration bits set (exporting in MPLAB) to
HS mode and flashing that to the chip everything works flawlessly.
Thank you for pointing me in the right direction.

If you dont mind, I have some followup questions, however, since I am
doing this mostly for the learning experience. You pointed out that
the documentation mentions that a series resistor may be needed for an
AT strip cut crystal (something I missed alltogether). What would be
the purpose of this resistor and why is it specific to AT strip cut
crystals? Also, what value should that resistor be? I find it odd that
the documentation states nothign of the value that should be used.

On Jan 29, 3:07 pm, John Fields <jfie...@austininstruments.com> wrote:
Quote:
The way you choose which mode you need is to look at
how the crystal will be driven. If it'll be driven with an
inverting amplifier, like the one in the PIC16F845A, then you go for
parallel resonance. If it'll be driven by a non-inverting
amplifier, then you specify series resonance.

I thought about this and still can't figure out why a non-invertin amp
configuration differs from an inverting one. I'm assuming it has
something to do with what kind of impedance the amp (buffer in this
case?) likes to "see", is that so? But the type of an amp used does
not affect this property, or am I wrong?

Quote:
That oscillator is classic, is called a "Pierce" oscillator, and
Google will give you lots of hits on how it works.

Thanks, now that I know how this configuration is called, it'll be
much easier to find information on it.


Thanks again for all your input. I appreciate the help.
This group looks like its full of knowledgeable people.

-Nick
DJ Delorie
Posted: Mon Jan 29, 2007 6:35 pm
Guest
pacemkr@gmail.com writes:

Quote:
You pointed out that the documentation mentions that a series
resistor may be needed for an AT strip cut crystal (something I
missed alltogether). What would be the purpose of this resistor and
why is it specific to AT strip cut crystals? Also, what value should
that resistor be? I find it odd that the documentation states
nothign of the value that should be used.

I don't know these answers, I just noted that the two specs matched
that way, so I mentioned it.
David L. Jones
Posted: Mon Jan 29, 2007 6:45 pm
Guest
On Jan 30, 4:34 am, pace...@gmail.com wrote:
Quote:
I am building one of thesehttp://plazma.kapsi.fi/diy/lanc_controller/
Its a LANC Controller (ie. remote control) for a Sony camcoder.

The project uses a PIC16F84A chip, which is a programmable
microcontroller.
I am very comfortable working with assembler, but I am not so
profficient with electronics. I'm having a problem with this project.

I've assembled everything on a breadboard (the chip is programmed and
verified), but it doesn't seem to work. I have a striking suspicion
that I bought a wrong crystal oscillator, and I can't find any
information on how to choose the correct device.

Do crystal oscilators come in different flavors when it comes to
waveform shape? Since this oscillator is used as a clock in the
circuit, does that mean that I need one that generates a square wave?

The oscillator I bought and am currently using is this one: http://www.newark.com/jsp/Passives/Crystals/VISHAY+DALE/XT49S-204M/
displayProduct.jsp?sku=18C1488

Also I bought 22pF capacitors instead of the 18pF suggested in the
project. Would that affect anything?
As a related question, I've noticed that the clock signal circuit for
many chips is the same as the one in this project (crystal oscilator
and two caps), how do you know what capacitor values to use? I've read
in several places that it depends on the characteristics of the
specific oscillator, but I could not find any more detail.

Thanks in advance,
Nick.

Make sure you have the oscillator register bits selected correctly.
You need to select the "XT" crystal setting.
This can be set in your programmer software.

Dave Smile
John Fields
Posted: Mon Jan 29, 2007 7:46 pm
Guest
On 29 Jan 2007 13:53:06 -0800, pacemkr@gmail.com wrote:


Quote:
On Jan 29, 3:07 pm, John Fields <jfie...@austininstruments.com> wrote:
The way you choose which mode you need is to look at
how the crystal will be driven. If it'll be driven with an
inverting amplifier, like the one in the PIC16F845A, then you go for
parallel resonance. If it'll be driven by a non-inverting
amplifier, then you specify series resonance.

I thought about this and still can't figure out why a non-invertin amp
configuration differs from an inverting one. I'm assuming it has
something to do with what kind of impedance the amp (buffer in this
case?) likes to "see", is that so? But the type of an amp used does
not affect this property, or am I wrong?

---
Yes. The reason for the inversion is that there's a 180° phase
shift through the crystal when it's operating in parallel resonance
and that, combined with the 180°shift through the amplifier makes
the circuit inherently unstable, causing it to oscillate.
---

Quote:
That oscillator is classic, is called a "Pierce" oscillator, and
Google will give you lots of hits on how it works.

Thanks, now that I know how this configuration is called, it'll be
much easier to find information on it.


Thanks again for all your input. I appreciate the help.
This group looks like its full of knowledgeable people.

-Nick

--
JF
Nick Zalutskiy
Posted: Mon Jan 29, 2007 11:15 pm
Guest
On Jan 29, 5:45 pm, "David L. Jones" <altz...@gmail.com> wrote:
Quote:
You need to select the "XT" crystal setting.
This can be set in your programmer software.

Dave Smile

I was about to select the XT setting, but there is a little note in
the datasheet, that says if you are running at 3.5 MHz or higher its
recommended to use the HS setting. So I did. There are so many nuances
with these chips. =)
Nick Zalutskiy
Posted: Mon Jan 29, 2007 11:21 pm
Guest
On Jan 29, 6:46 pm, John Fields <jfie...@austininstruments.com> wrote:
Quote:
Yes. The reason for the inversion is that there's a 180° phase
shift through the crystal when it's operating in parallel resonance
and that, combined with the 180°shift through the amplifier makes
the circuit inherently unstable, causing it to oscillate.
---
JF

Which is exactly the result you want. Clever. Smile
Thanks for clarifying that.
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Sun Sep 07, 2008 5:43 am