Shop OBEX P1 Docs P2 Docs Learn Events
Crystal Type — Parallax Forums

Crystal Type

hippyhippy Posts: 1,981
edited 2008-04-22 01:29 in Propeller 1
Starting from the position that I know absolutely nothing about crystal technology ... is there any particular type / characteristic of crystal that has to be used with the Propeller ?

Am I correct that just grabbing 'any old crystal' from a parts drawer isn't guaranteed to work ? That seems to have been my experience, but it was a bit hit and miss.

Using ProtoBoard, TV_Text and a separate cog updating a Hub variable count, "working" meaning a readable, incrementing display on screen -

At PLL16x, 'big can' 4.096MHz and 4.435572MHz worked, 3.579545MHz didn't, nor a 100MHz ( no PLL ).

Interestingly I got a 7.3728MHz to work at PLL16x but not well at PLL8x. With PLL8x the display was very shaky, barely readable, at PLL16x as perfect as the default 5MHz. That's the fastest I've had the Prop up to, 118MHz confirmed on relative timing to what I get at 5MHz+PLL16x, but I don't want to re-open the "how fast can a Prop run ?" debate, I'm more intrigued why it would work at 16x but not 8x.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-24 04:38
    It needs to be a parallel resonant fundamental frequency crystal. See page 29 of the manual for a table with the recommended capacitance for the different frequency ranges and oscillator mode settings. Crystals are calibrated for a specific capacitance. They may work with a different capacitance, but will be off frequency from what's marked on the can.

    With the 7.3728 MHz crystal, could you have given the crystal frequency wrong in the _XINFREQ statement? That could explain the "jitters". It's also a funny relationship with the color burst frequency. Sometimes that introduces jitter into the timing of the sync pulses and color burst frequency. The 16x PLL might give the video generation code enough speed to get around it while the 8x PLL would only give a clock around 60MHz.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2008-03-24 04:58
    hippy,
    As Mike says, it needs to be a parallel resonant fundamental frequency crystal.· But it's funny that you mention 7.3728 MHz... I have several of these myself, and have used them without any issues.· You do need·however to set the _XINFREQ statement if you want other timing dependant·applications to work correctly.· One thing though, the 7.3728 MHz is often used because it is Baud friendly allowing you to divide it down nicely for several standard Baud speeds.· That said, it may not·be as friendly with NTSC, PAL, or VGA signal·generation.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • hippyhippy Posts: 1,981
    edited 2008-03-24 05:20
    In layman's terms then, _CLKMODE switches those caps in internally which would normally be added externally on other micros, so a crystal expecting those capacitances has to be used. Page 29 now makes more sense, thanks.

    Re-tested the 7.3728MHz and same results. Guess it must be some bad luck choice of frequency with respect to synching.
  • hippyhippy Posts: 1,981
    edited 2008-03-24 05:34
    @ Beau : As you may be guessing, my drawer of crystals are all mainly pulls from PC M/B's and ISA/PCI cards smile.gif

    Unfortunately, while some are clearly marked, others seemt o use some magic code - Any idea where I can find what "X583K5MT" or "X683M63." etc mean ? No other marking, and Google isn't being particularly helpful.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2008-03-24 05:54
    Are they SAW resonators?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • LeonLeon Posts: 7,620
    edited 2008-03-24 06:00
    Try putting them in a simple oscillator and measuring the frequency with a counter.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2008-03-24 12:12
    Hippy,

    With the URL(below)You may find the Commonly used crystal frequencies list interesting:

    en.wikipedia.org/wiki/Crystal_oscillator

    7.3728 is on the list. It also backs up(not that he needed backing jumpin.gif ) Beau statement.

    i.e:
    7.3728 UART clock (4
  • hippyhippy Posts: 1,981
    edited 2008-03-24 22:12
    Leon said...
    Try putting them in a simple oscillator and measuring the frequency with a counter.

    Easier said than done for us software types with no test equipment, then I remembered the Propeller has its own oscillator, and a PC sending serial is a good source of reasonably accurate timing, so voila ...

    Plug a crystal in, send spaces at 9600 baud and the Propeller works out its own crystal frequency. The 3.xxMHz is working now ( poor contact last time maybe ). I suspect the ones which don't work are the wrong type or over 8MHz.
  • hinvhinv Posts: 1,253
    edited 2008-04-19 01:50
    Is is possible to use a couple of pins on a propeller to accurately ring a 32.768 kHz crystal so you could have 1 cog doing cheap real time clock?

    I wouldn't know even where to start on this one, but it sounds like a cool idea.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-04-19 02:03
    I just hand wired a Hydra clone from the examples in the Hydra book and noticed that some of the color programs were black/white on one TV. It was suggested that the crystal may be a bit off. The one I used was a 10Mhz one from my parts bin. My guess is that it is the wrong style. It's close enough to work but not enough for accurate colors. The crystals aren't expensive so I ordered a few different ones and will swap it when they arrive. Maybe tomorrow.

    With all the talk of crystals does anyone happen to know of a good way to test them besides using the scope?

    Robert
  • hippyhippy Posts: 1,981
    edited 2008-04-19 02:20
    @ hinv : I presume you mean a Prop which is running on its own RCFAST or it makes no sense with an XTAL already connected. It's an interesting idea and solves one problem I've never been able to overcome - how a Prop can determine its actual RCFAST speed - an RC is just too inaccurate.

    It looks to me that some 32kHz XTAL's are more expensive than 5MHz so it might ultimately be a pointless task but I think it's worth doing just for the sheer challenge of venturing into the unknown. Darn, another thing to add to my list if no one else takes up the challenge smile.gif
  • hinvhinv Posts: 1,253
    edited 2008-04-19 02:45
    @hippy: If, for instance you wanted a system that would use a low power sleep mode, and run on rcslow, and yet keep good time, I think it would be doable without too many parts. It may make sense to add a watchdog timer chip like those from ramtron, but maybe not. Just a thaught.
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-04-19 08:45
    maybe you can get one of the counter feedback modes to work with the 32KHz crystal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • bambinobambino Posts: 789
    edited 2008-04-19 18:52
    What do you feed a crystal, if say your hooking it to pins other than XO and XI. DC? Marked Crystal Freq?
  • hippyhippy Posts: 1,981
    edited 2008-04-21 15:35
    The idea of driving a 32kHz crystal by bit-banging has been preying on my mind, and the idea of using the counter-feedback mode as an inverter could indeed be useful there. The commonest circuits I can find using 7HCxx gates are along the lines of -

                   ___
            .-----|___|-----.
            |               |
            |     | _ |     |
            |-----||_||-----|
            |     |   |     |
            |               |
            |      |\       |
            |------| >O-----^--->
            |      |/        
          __|__
          --.--
           _|_
    
    
    



    So that looks simple enough to implement. I did read a comment about bandwidth and the Propeller may be too fast, in which case a bit-banged, in pin -> delay -> out pin inverter would dampen that down but could be a problem with an unknown system clock speed; that would be challenge, varying the throughput delay, if it were required.

    The out pin could be used by another counter to do the actual elapsed time tick counting.

    Anyone interested in taking up the challenge ? I don't have a scope so, while I'd be happy to try it, I'm not going to get far in tweaking R's and C's not being able to see what it's doing.

    Can anyone see any potential problems with the above ideas before starting ? Any guesstimates on R and C value ?

    Post Edited (hippy) : 4/21/2008 3:40:34 PM GMT
  • bambinobambino Posts: 789
    edited 2008-04-21 16:53
    Maybe, My schedule is pretty tight this week, but if I knew what I was doing ahead of time I could probably sneak it in.
    I've got some 32khz pulls in my drawer, and one still has the caps that came with it, but after that I'm lost.
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-04-21 20:26
    Hippy,

    If you are going to use a counter in feedback mode, to drive the crystal why would you need another counter? Just set FREQ to $00200000 and the counter will overflow once a second.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-04-21 20:47
    Thanks Ken .. I'm not familair with using the counters smile.gif

    Anyway it seems to be working, sort of; not getting the expected values back and need to keep my finger on one of the cap legs to kick it into life.

    CON
    
      _CLKMODE      = XTAL1 + PLL16x
      _XINFREQ      = 5_000_000
    
      TV_PIN        = 12
    
      XI_PIN        = 7
      XO_PIN        = 6
    
    OBJ
    
      tv            : "TV_Text"
      
    PUB Main | timeout
    
      tv.Start( TV_PIN )
    
      timeout := CLKFREQ * 10 + CNT
     
      DIRA[noparse][[/noparse] XO_PIN ] := 1
      
      CTRA := %01011 << 26 | XO_PIN <<9 | XI_PIN
      FRQA := 1
    
      repeat while ( timeout - CNT ) > 0
    
        tv.Out( $01 )
        tv.Dec( result := PHSA )
        
      tv.Str( String( " DONE",$0D,$0D ) )
    
      result /= 10
      
      tv.Dec( result )
      tv.Str( String( "Hz ~" ) )
      tv.Dec( ( result + 500 ) / 1_000 )
      tv.Str( String( "kHz ~" ) )
      tv.Dec( ( result + 500_000 ) / 1_000_000 )
      tv.Str( String( "MHz " ) )
    
    
    
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-04-21 20:57
    You may need a bigger cap. Also, you may need to add a resistor between the output and the crystal. If your rise time is too fast, you could be driving the crystal into vibration modes other than the fundamental mode.

    How are your values different than expected?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-04-21 22:04
    22pF (+finger) gave 5kHz, 44pF (+finger) gave 105kHz. Unfortunately that's the extent of my pF cap collection. Put a 100K across the pins and I get system clock speed / 4.

    Basically I'm going to have to put in the hands of someone with the tools to do the job.
  • Mike_GTNMike_GTN Posts: 106
    edited 2008-04-21 23:14
    @Hippy

    Since fingers make such great Capacitors, not sure why nobody has started to sell them yet. I have a set of fingers that range from 1pf upto 10pf, then seem to run out of scope. Shall have to build a Prop based capacitor meter to measure my digits on.

    Don't anyone try this technique at home, especially if poking around near a mains transformer!

    Mike.
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-04-22 01:29
    @Hippy: I think if you put too low a value across the pins the prop won't even see the effects of the crystal. I was suggesting one in series between the prop feedback pin and the crystal. That might keep the output from driving the crystal crazy. Try a 100K between the output pin and the corresponding lead on the crystal. I've never done this before, but I'm going on some snippets that I read this afternoon about crystal oscillators and inverter gates. I also read that the capacitance value should not have a drastic effect on your frequency.

    if I had a 32KHz crystal handy I'd try it myself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.