• AVR Freaks

Hot!PIC16F1709 and PLL

Author
P Lameijn
Super Member
  • Total Posts : 1975
  • Reward points : 0
  • Joined: 2004/01/22 18:30:23
  • Location: The Netherlands
  • Status: offline
2019/07/22 16:05:14 (permalink)
0

PIC16F1709 and PLL

Is there some issue with the PLL/oscillator in the 1709?
If I use OSCCON = 01111000 I get 16MHz clock on internal oscillator. That's OK.
With OSCCON = 11110000 I should get 8MHz * 4 = 32MHz, but I get 16 MHz???
I can't really explain that...

Regards,
Peter
#1

9 Replies Related Threads

    ric
    Super Member
    • Total Posts : 24566
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:22:44 (permalink)
    +1 (1)
    I assume FOSC in the config words is 0b100
    How is the PLLEN bit in the config word set?
    How exactly are you checking the clock speed?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    P Lameijn
    Super Member
    • Total Posts : 1975
    • Reward points : 0
    • Joined: 2004/01/22 18:30:23
    • Location: The Netherlands
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:26:13 (permalink)
    0
    I assume FOSC in the config words is 0b100

    Correct...
    How exactly are you checking the clock speed?

    I test the CLKOUT pin...

    Regards,
    Peter
    #3
    ric
    Super Member
    • Total Posts : 24566
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:30:10 (permalink)
    +1 (1)
    I agree, something is not right.
    Can you post your entire test program? Remove anything not relevant to the test.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    P Lameijn
    Super Member
    • Total Posts : 1975
    • Reward points : 0
    • Joined: 2004/01/22 18:30:23
    • Location: The Netherlands
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:45:28 (permalink)
    0
    Code is MikroBasic. CONFIG1 = 0x20E4, CONFIG2 = 0x1F03

    program Test
     
    '==================================================================================================
    Sub Procedure Init()
    '==================================================================================================
      TRISA         = %00000000                                                
      OSCCON        = %11110000                                                 '8MHz * 4 intern
    End Sub                                                                     '

    '==================================================================================================
    main:
    '==================================================================================================
      Init()                                                                    'Initialize
      while true
      wend
    end.                                                                        '
    '==================================================================================================
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    post edited by P Lameijn - 2019/07/22 20:11:39

    Regards,
    Peter
    #5
    ric
    Super Member
    • Total Posts : 24566
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:52:23 (permalink)
    +1 (1)
    Beats me, unless MikroBasic is not letting you write to OSCCON.
    Are you able to select other frequencies via OSCCON?

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #6
    P Lameijn
    Super Member
    • Total Posts : 1975
    • Reward points : 0
    • Joined: 2004/01/22 18:30:23
    • Location: The Netherlands
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/22 16:55:38 (permalink)
    0
    Yes,
     
    Mikrobasic is quite reliable. I use it always with pic16/18/24/32 without any trouble.
    I also used the 16F1847 in 8MHz * 4 in the past without problems
     
    If writing to OSCCON would fail, I should get the default 500kHz internal clock, but I don't...
    post edited by P Lameijn - 2019/07/22 17:03:10

    Regards,
    Peter
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 18033
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: PIC16F1709 and PLL 2019/07/22 17:09:35 (permalink)
    0
    Mikrobasic is quite reliable Software.  Have you heard of Bug free Software?
    When weird stuff happens everything is suspect. 




    #8
    P Lameijn
    Super Member
    • Total Posts : 1975
    • Reward points : 0
    • Joined: 2004/01/22 18:30:23
    • Location: The Netherlands
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/23 06:57:45 (permalink)
    0
    I settled for 16MHz at the moment... Smile: Smile
    Strange enough is that OSCCON %11110000 and %011110000 give both 16MHz, while the first should
    give 8MHz * 4
     
    Edit:
    Found cause. If the CONFIG2:PLLEN bit is set (PLL always on), the OSCCON setting %11110000 is not properly executed.
    If you disable the PLL in config, the PLL works fine...
    post edited by P Lameijn - 2019/07/23 07:09:27

    Regards,
    Peter
    #9
    ric
    Super Member
    • Total Posts : 24566
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F1709 and PLL 2019/07/23 13:12:21 (permalink)
    +1 (1)
    P Lameijn
    Found cause. If the CONFIG2:PLLEN bit is set (PLL always on), the OSCCON setting %11110000 is not properly executed.
    If you disable the PLL in config, the PLL works fine...

    I asked you about that bit back in post#2.
    If it's set, the PLL is always on.
    Did you ever try setting OTHER clock speeds as I suggested?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5