32khz oscillator on 18F26K22 problem


Today 13:26
Forum: Proton Plus Compiler v3
Starter: gdesantis
Views: 0
Replies: 2
Today 11:23
Forum: The Lounge
Starter: Les
Views: 0
Replies: 12
+ Reply to Thread
Results 1 to 5 of 5

Thread: 32khz oscillator on 18F26K22 problem280 days old

  1. #1
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,212
    Thumbs Up
    Received: 73
    Given: 37
    Total Downloaded
    2.84 GB

    0 Not allowed!

    Default 32khz oscillator on 18F26K22 problem

    I have added a 32768Hz crystal to the OSC in and out pins (PORTA6,7) with 12pF to ground each side.
    I can't get it to work, I am looking at the pins with a 'scope. I am missing something but can't see what.


    Device=18F26K22
    Xtal=64

    Config_Start
    FOSC = INTIO67 ;Internal oscillator block, port function on RA6 and RA7
    PLLCFG = On ;Oscillator multiplied by 4
    PRICLKEN = On ;Primary clock is always enabled
    FCMEN = OFF ;Fail-Safe Clock Monitor disabled
    IESO = OFF ;Oscillator Switchover mode disabled
    PWRTEN = OFF ;Power up timer disabled
    BOREN = OFF ;Brown-out Reset disabled in hardware and software
    BORV = 285 ;VBOR set to 2.85 V nominal
    WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS = 1 ;1:1
    CCP2MX = PORTB3 ;CCP2 input/output is multiplexed with RB3
    PBADEN = OFF ;Segments<5:0> pins are configured as digital I/O on Reset
    HFOFST = OFF ;HFINTOSC output and ready status are delayed by the oscillator stable status
    T3CMX = PORTB5 ;T3CKI is on RB5
    P2BMX = PORTC0 ;P2B is on RC0
    MCLRE = EXTMCLR ;MCLR pin enabled, RE3 input pin disabled
    STVREN = On ;Stack full/underflow will cause Reset
    LVP = OFF ;Single-Supply ICSP disabled
    XINST = OFF ;Instruction set extension and Indexed mode disabled (Legacy mode)
    Debug = OFF ;Disabled
    Cp0 = OFF ;Block 0 (000800-001FFFh) not code-protected
    Config_End

    OSCCON = Percent01110000 ;16MHz internal oscillator block
    Nop
    OSCCON2 = Perecnt 10001100 ;pre-scaler to give 64Megs
    Nop
    Set OSCTUNE.6 ;enable PLL so clock now 64MHz

    T3CON = Percent10001100 ;osc on timer 3, no prescale, no sync
    TMR3H = $80 ;set for 1 second (count of 32768)
    TMR3L = $00
    T3CON = Percent10001101 ;enable soc/timer

    While ;loop-stop
    Wend

    Tried different crystals etc, the device works otherwise.
    Any help appreciated.
    Charlie
    Last edited by charliecoultas; 7th March 2018 at 11:37.

  2. #2
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    385
    Thumbs Up
    Received: 71
    Given: 0
    Total Downloaded
    154.34 MB

    0 Not allowed!

    Default Re: 32khz oscillator on 18F26K22 problem

    The secondary osc (SOSC) connections are on RC0 (SOSCO) and RC1 (SOSCI).

    See datasheet sections 12.2 and 12.4

  3. #3
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,212
    Thumbs Up
    Received: 73
    Given: 37
    Total Downloaded
    2.84 GB

    0 Not allowed!

    Default Re: 32khz oscillator on 18F26K22 problem

    Thanks very much TW. Solved!

    Charlie

  4. #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,853
    Thumbs Up
    Received: 163
    Given: 162
    Total Downloaded
    3.24 GB

    0 Not allowed!

    Default Re: 32khz oscillator on 18F26K22 problem

    FOSC = INTIO67 ;Internal oscillator block, port function on RA6 and RA7
    Internal oscillator?

    PRICLKEN = On ;Primary clock is always enabled
    Do you want primary or secondary?
    George

  5. #5
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,212
    Thumbs Up
    Received: 73
    Given: 37
    Total Downloaded
    2.84 GB

    0 Not allowed!

    Default Re: 32khz oscillator on 18F26K22 problem

  6. Secondary, I wanted the oscillator that you can connect a 32768 crystal to, and generate 1 second pulses (using a divide by 32768 on timer 1/3/5).
    I got confused George, mixed up but that's fairly usual nowadays. It's working fine now (but I've had to do a little knife-work on the pcb).

    Charlie

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. SSD1306 OLED driver problem with 64Mhz 18F26K22
    By Dompie in forum WIKI Discussion
    Replies: 2
    Last Post: 14th November 2016, 10:08
  2. Serout problem on 18F26k22
    By amateurtje in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 20th August 2015, 16:01
  3. HSPLL Oscillator Problem on 18F2431
    By wastrix in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 15th July 2009, 00:45
  4. Questions about 32khz crystal
    By rcurl in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 5th December 2005, 14:38

Members who have read this thread since 9th December 2018, 10:16 : 0

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts