Page 1 of 2 12 LastLast
Results 1 to 12 of 24

Thread: 32Khz crystal problem!

  1. #1
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0

    32Khz crystal problem!

    Anyone have problems of getting a Tim1 32khz Ext. Osc working?
    I am having a frustrating time with getting the oscillator to run, on both a 62F628 and a 16F870.
    I am using a popular Epson 32.768khz xtal.
    I have gone from 12pf to 25pf for the caps, before I look for another Xtal, is there anything in particular I may have overlooked?
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  2. #2
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    2,387
    Downloads
    0
    Uploads
    0
    Config settings?

    Pop in a garden variety 4MHz xtal and see if it runs. That at least will confim config and T1CON settings.

    Some of those 32kHz xtals are a little fussy as they are meant for micropower use, especially the tiny cylindrical type (watch xtals). I have had some results using a series resistor with the xtal I think about 1k but this is some years ago now.


  3. #3
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by RomanLini View Post
    Config settings?

    Pop in a garden variety 4MHz xtal and see if it runs. That at least will confim config and T1CON settings.

    Some of those 32kHz xtals are a little fussy as they are meant for micropower use, especially the tiny cylindrical type (watch xtals). I have had some results using a series resistor with the xtal I think about 1k but this is some years ago now.
    Do any of the config settings apply to the T1OSO/T1OSI ?
    I have ordered a different xtal and a range of caps, so hopefully I will have more luck.
    I am using a pre-tested code from a tutorial as a test.
    The only common thing so far is the xtal?? If all else fails I will try the 1k.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  4. #4
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    355
    Downloads
    0
    Uploads
    0
    Al,

    I don't have datasheets handy for the PICs you tried, but there are probably two different config bits that need to be set for the xtal to work properly.

    In other PIC chips, the T1CON (timer 1 control register) has to have the T1OSCEN bit set (to enable the external oscillator) and the TMR1CS bit set ( to select the external clock).
    Diplomacy is the art of saying "Nice doggie" until you can find a rock. - Will Rogers


  • #5
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0
    I have set the T1CON register in the program, it is the config or configuration word that I was questioning, in the 16F628 it is register 14-1 or the __config instruction set at programming time.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  • #6
    Registered Iron-Man's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    181
    Downloads
    0
    Uploads
    0

    PIC16F870

    Al, the PIC16F870 can be operated in 4 different oscillator modes. Please see the data sheet here; http://melabs.picbasic.com/devicedata/30569a.pdf
    For the 32Khz xtal, you need 33pf caps. Please see pages 91 and 92.

    Also make sure that you have the proper mode set;

    • LP Low Power Crystal
    • XT Crystal/Resonator
    • HS High Speed Crystal/Resonator
    • RC Resistor/Capacitor

    Hope this helps,

    Iron-Man


  • #7
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Iron-Man View Post
    Al, the PIC16F870 can be operated in 4 different oscillator modes. Please see the data sheet here; http://melabs.picbasic.com/devicedata/30569a.pdf
    For the 32Khz xtal, you need 33pf caps. Please see pages 91 and 92.
    Also make sure that you have the proper mode set;

    • LP Low Power Crystal
    • XT Crystal/Resonator
    • HS High Speed Crystal/Resonator
    • RC Resistor/Capacitor

    Hope this helps,

    Iron-Man
    But this appears to refer to the FOSCI/FOSCI, main system clock?
    This is running OK as the program runs, it is the TI0SO/TIOSI, TIM1 clock, which appears to be LP type by default.
    I get no 'scope signal at the 32khz xtal pins, I am testing with the x10 scope lead as is recommended.
    As far as I have been able to tell in the documentation, the 16 bit configuration register does not apply to the TIM1 oscillator?
    I will try more tests today, including the 33pf.
    Thanks.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  • #8
    Registered Iron-Man's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    181
    Downloads
    0
    Uploads
    0
    Al, I have searched for the, TI0SO/TIOSI, TIM1 clock and cannot find it listed any where in the data sheet for the 16F870. What data sheet are you working from. Can you post a picture of the board?

    Iron-Man


  • #9
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    2,387
    Downloads
    0
    Uploads
    0
    You didn't try the resistor like I suggested?

    Re the configs, some of the later PICs have config bits that affect pin operation for the external TMR1 osc. I didn't check the 16F870 datasheet but since it's an earlier PIC there's probably no config needed.


  • #10
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by RomanLini View Post
    You didn't try the resistor like I suggested?
    I am going to see if I can get back to it tonight or tomorrow.
    I even have a 7404 external xtal clock to mock up if all else fails.

    Quote Originally Posted by Iron-Man View Post
    Al, I have searched for the, TI0SO/TIOSI, TIM1 clock and cannot find it listed any where in the data sheet for the 16F870.
    Page 53 of the manual link you posted, pins 11 &12 of the 28 pin version, I really need it to work for the 16F628/A, I only mocked up the 870, as I had a proven Electronic Design that was close to what I was trying to do, and I wanted to see if the results were the same, which they were.
    The F628 is practically the same set up for the 32.768khz clock xtal.
    From what I have read so far, these watch xtal's are finicky to get started.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  • #11
    Registered
    Join Date
    Jul 2004
    Location
    USA
    Posts
    124
    Downloads
    0
    Uploads
    0
    Al_The_Man,
    Could you clarify exactly what you're trying to do? I need clarification on something. Also, I haven't used the 16 series in years, but am very familiar with the 18 series. Just took a look at the 16F628 data sheet though.
    But this appears to refer to the FOSCI/FOSCI, main system clock?
    This is running OK as the program runs, it is the TI0SO/TIOSI, TIM1 clock, which appears to be LP type by default.
    Are you trying to run the microprocessor using 2 clocks (ie. 4MHz high speed for computations and 32KHz for low speed/sleep) or just 1 low speed clock (ie. main system clock is 32KHz for everything)? If the program is running, it is getting a FOSC from somewhere.
    As far as I have been able to tell in the documentation, the 16 bit configuration register does not apply to the TIM1 oscillator?
    I would agree with this, getting the 32Khz crystal working with timer1 should just be a matter of configuring the T1CON register correctly. In order to do this, it appears you have to set the following:
    T1CON.0 -> 1 Timer1 enabled
    T1CON.1 -> 1 external clock from in RB6/T1OSO
    T1CON.2 -> 1 Do not synch external clock input. (if you are using this for sleep then you need to make sure that this is not synchronized)
    T1CON.3-> 1 Oscillator enabled
    T1CON.4-5 -> configure prescale value (1:1 -> 1:8)
    T1CON.6,7 -> unimplemented- doesnt' matter.

    Note that the datasheet suggests 15pF, but acknowledge that these values may need to be changed.

    I may be (VERY possibly) remembering this incorrectly, but on some of the older chips (16F877?) I think putting a scope probe, even on 10X directly on the oscillator (this was the main external highest speed crystal oscillator, 20MHZ) caused it to not oscillate. Don't know what the inputs/outputs are like on the 628 when it's set up for T1osc mode. It may be worth the 15 minutes to hook up an HC04 or equivalent as a buffer so you can see it on the scope, or at least confirm that you can't see it on the scope...

    Hope this helps.

    -Matt


  • #12
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,939
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by mcarvey View Post
    Al_The_Man,
    Could you clarify exactly what you're trying to do? I need clarification on something. Also, I haven't used the 16 series in years, but am very familiar with the 18 series. Just took a look at the 16F628 data sheet though.
    Basically I picked the bones out of this article and want to use the basic functions from it, it is a very simple application so it is frustrating when it doesn't pan out, I just adapted it for my app. using the 16F628.
    I need the precise 1 second clock, basically, to measure a low freq pulse.
    System clock and Tim1 clk, the only difference is I am using the internal system clock to run the main code, the article uses an external xtal system clock also.
    http://electronicdesign.com/article/...ncies8513.aspx
    I have the code which is no longer available since E.D. moved their site.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. Need Help!- Optical Crystal
      By adrianhdezch in forum General Laser Engraving & Cutting Machine Discussion
      Replies: 5
      Last Post: 09-02-2010, 02:26 AM
    2. Replies: 5
      Last Post: 08-04-2010, 06:33 PM
    3. Supply mini 2D/3D crystal laser subsurface engraving machine
      By 3dlasermachine in forum Product and Manufacturer Announcements
      Replies: 1
      Last Post: 09-07-2009, 11:15 PM
    4. Build Thread- laser cutting crystal
      By Jiepu-Crystal in forum General Laser Engraving & Cutting Machine Discussion
      Replies: 0
      Last Post: 08-07-2009, 01:35 AM
    5. Build Thread- laser crystal
      By Jiepu-Crystal in forum General Laser Engraving & Cutting Machine Discussion
      Replies: 0
      Last Post: 08-06-2009, 10:50 PM

    Tags for this Thread

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.