PDA

View Full Version : CAn't get PLL to work on 18LF4620



BrianT
- 9th November 2010, 05:30
I cannot get the PLL to turn on. I can set the INTRC oscillator to 4 MHz or 8 MHz but I cannot get the 4x PLL to activate. I have scoured the forum but found nothing directly relevant.
MCS+ 3.0.0.5 PBP 2.60L MPASM v5.37

I want to get an internal RC clock of 16 or 32MHz so then I can push the DEBUG speed up.



'************ Config Register setup for USB programmer *************
' OSC = INTIO2, FSCM = En, IESO = En, PwrupTmr = En, BrownOut = Dis
' BOR Volts = 2, WDT = Off, WDTPS = 1:512, CCP2 mux = RB3,
' PortB reset = Digital, LPT1Osc = Low, MCLR = Reset, LVP = Disabled
' Enhanced CPU = Dis, All memory = Not Protected
'************************************************* ******************
DEFINE OSC 4 'IntOsc <= 32MHz @ 3.7V OK. See page 325.
DEFINE DEBUG_REG PORTB 'Debug output pin port
DEFINE DEBUG_BIT 6 'Debug output pin bit (= PGC)
DEFINE DEBUG_BAUD 28800 'Debug baud rate
DEFINE DEBUG_MODE 0 'Debug mode: 0 = True, 1 = Inverted
'DEFINE DEBUG_PACING 50 'Debug character pacing in us


' OSCCON = %01101111 ' Select 4 MHz
OSCCON = $62 ' also selects 4 MHz
' OSCCON = %01111111 ' Select 8 MHz
' OSCTUNE = %01000000 'PLL ON, at centre frequency
OSCTUNE.6 = 1 ' PLL ON
' OSCTUNE = %00000000 'PLL OFF, at centre frequency


Any help gratefully received.
BrianT

flipper_md
- 9th November 2010, 05:49
I dunno OSCTUNE, but modifying the .INC file usually work for me

You have 2 choices for PPL, but I think if you use 4mhz it would be "normal" speed.

here is my config for a 18F2550, using 20Mhz xtal, so this has to be high speed mode(HS)

; __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
; __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H

mackrackit
- 9th November 2010, 06:15
Give this a shot

@ __CONFIG _CONFIG1H, _OSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L

DEFINE OSC 32

OSCCON = %01110000
OSCTUNE = %01000000

BrianT
- 9th November 2010, 07:29
Thanks Dave,
I pasted your lines of code into my program but now I get a slew of
"ERROR Overwriting previous address contents" messages. Not sure how to handle this.

Cheers
BrianT

mackrackit
- 9th November 2010, 07:45
When setting the configs in code space you need to modify the *.inc file for the chip in the PBP directory. Comment out the configs there. Or just modify the *.inc with the new configs.
http://www.picbasic.co.uk/forum/content.php?r=157-Presetting-Configuration-Fuses-(PIC-Defines)-into-your-Program

BrianT
- 9th November 2010, 22:47
Thanks Dave but changing the .inc file is more pain than gain.

This little project has three 18F4620. One uses IntIO2 at 4 MHz which is where I want to activate the PLL, another uses HS with a crystal at 20 MHz and the third uses XT with a crystal at 4 MHz. It is easier to just change the Config fuses on the MeLabs USB serial programmer.

Cheers
Brian

mackrackit
- 9th November 2010, 23:05
Thanks Dave but changing the .inc file is more pain than gain.
That is why I comment the *.inc and set the fuses in code space.

But did you get it working like you want?