View Full Version : P1c18f26k20-internal clock set up fail -64mhz
MINHLE
- 25th July 2014, 23:18
HI,
I TRY to set up to run the osc internal @64Mhz, but fail.
conf_1H: FOSC_INTIO67 (or FOSC_INTIO7) ;OTHER config's of 1H are off
OSCCON = $70 (16MHZ selected)
OSCTUNE = $40 (enable PLL)
the output @portb.6 fail (no power)-and data out from other pins runs fast
OSCTUNE =$40 {omitted)
data out from portb runs well, but slow and low power @ output
i also try to set OSCTUNE TO $CF, maximum frequency and PLL enable, but portb.6 still lost power
so what wrong?
any help i do appriciate
tks in ad.
richard
- 26th July 2014, 02:03
try osccon.1 =1
failing that post your code and tell us what version of pbp you are using
EarlyBird2
- 26th July 2014, 08:19
This could help.
7406
OSCCON 6:4 need setting for 16 MHZ which is $70, which is what you have.
OSCTUNE 6 needs setting to connect internal oscillator to 4xPLL $40, which you have.
Looking at the Internal Oscillator Block OSCCON 1:0 have an effect and from the datasheet.
bit 1-0 SCS<1:0>: System Clock Select bits
1x = Internal oscillator block
01 = Secondary (Timer1) oscillator
00 = Primary clock (determined by CONFIG1H[FOSC<3:0>]).
which tells me, if I understand correctly, that OSCCON 1 needs setting. Which is what Richard said.
Which now makes OSCCON $72.
Last there is config1H for HSPLL and HFINTOSC/PLL
_FOSC_HSPLL_1H EQU H'F6' ; HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
_FOSC_INTIO67_1H EQU H'F8' ; Internal oscillator block, port function on RA6 and RA7
_FOSC_INTIO7_1H EQU H'F9' ; Internal oscillator block, CLKOUT function on RA6, port function on RA7
which I leave to you or others to explain, I use boot loader and never used configs.
MINHLE
- 26th July 2014, 10:31
THANSKS alot for your help.
yes, i try
OSCCON = $72,
OSCTUNE = $40
the problem still persises.
portb.6 lost power. but it runs faster
-------------------------------------------------------------------------------
here is the conf.
__CONFIG _CONFIG1H, _FOSC_INTIO7_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H' __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
OSCCON = $72,
OSCTUNE = $40
-----------------------------------------------------------------------------
portb = 0
latb = 0
trisb = 0
----------------------------------------------------
about the SCS it is automatic set to 00- becasue in the CONFI_1h --- FOSC_INRIO67- (IT IS determined by primary osc in the 1H line)
here is the explaination in the data sheet
------------------------------------------============
2.9.1 SYSTEM CLOCK SELECT
(SCS<1:0>) BITS
The System Clock Select (SCS<1:0>) bits of the
OSCCON register select the system clock source that
is used for the CPU and peripherals.
• When SCS<1:0> = 00, the system clock source is
determined by configuration of the FOSC<2:0>
bits in the CONFIG1H Configuration register.
• When SCS<1:0> = 10, the system clock source is
chosen by the internal oscillator frequency
selected by the INTSRC bit of the OSCTUNE
register and the IRCF<2:0> bits of the OSCCON
register.
• When SCS<1:0> = 01, the system clock source is
the 32.768 kHz secondary oscillator shared with
Timer1.
After a Reset, the SCS<1:0> bits of the OSCCON
register are always cleared.
-----------------------------------------------------------
the version, of pbp. it is 2.6c
i read the post of: http://www.microchip.com/forums/m730158.aspx-
also mentioned the same issue- but the PLLCFG is not recognized in the PBP
thanks for your concern,
regards
richard
- 26th July 2014, 10:43
try a __CONFIG _CONFIG4L, _DEBUG_OFF in your configs
as henrik wrote yesterday in a similar post the config option's syntax can be found in the pic18f26k20.inc file in your relevant version mpasm directory
richard
- 26th July 2014, 10:55
interestingly there is a PLLCFG = ON in the pbp3 device reference config options
look like a _PLLCFG_ON_1H is what you need
MINHLE
- 26th July 2014, 15:49
HELLO,
thanks for your guide,
YES i try & _DEBUG_OFF_4L
OSCCON = $72 (OR $70)
OSCTUNE = $40
PROBLEM PERSIS (slow)
i will see the inc directory of mpas
is it effected by the hc595?
i found that its max freq. is 25MHz
however, i test the 595 runs well @40mhz
thanks a gain for your contribution
regards
EarlyBird2
- 27th July 2014, 10:11
i read the post of: http://www.microchip.com/forums/m730158.aspx
Very interesting thanks.
Yes one of the settings that worked in the above link is.
__CONFIG _CONFIG1H, _FOSC_INTIO67_1H
OSCCON = $70
OSCTUNE = $40
Is that not what you started with?
MINHLE
- 27th July 2014, 11:35
Y]hello,
yes the above is work.
..
osccon = $70 or (60)
osctune = $40
for single leds
i move to drive 595 then there r problem- lost power or low speed @ out put
now i try to clean the pbp to see waht happen'
thenak for your help.
regards
MINHLE
- 28th July 2014, 22:09
HI ALL,
the pic run well @ 4mhz ,HSPLL; 8, 10mhz ... problem (HSPLL).
the conf. remains unchanged
__CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
where is the problem?
thanks all for your help
regards
richard
- 29th July 2014, 03:42
minhle
quite a lot here seems to be lost in the translation somehow
the output @portb.6 fail (no power)-and data out from other pins runs fast
what does this mean ?
the conf. remains unchanged
__CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
have you now changed to using an external xtal ?
i move to drive 595 then there r problem- lost power or low speed @ out put
what is a 595 ? do you mean a 74hc595 ?
if so a "595" can clock in data @100mhz which will be at least 10x greater than a bit banged routine could achieve even at 64mhz clock
can I suggest you just try to "blink a led" on say portb.6 and see if it blinks at the correct rate , if not then post your complete code for further evaluation
EarlyBird2
- 29th July 2014, 08:05
the conf. remains unchanged
__CONFIG _CONFIG1H, _FOSC_HSPLL_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
where is the problem?
thanks all for your help
regards
The conf. has changed from #4
here is the conf.
__CONFIG _CONFIG1H, _FOSC_INTIO7_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H' __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
also you said
yes the above is work.
..
osccon = $70 or (60)
osctune = $40
for single leds
i move to drive 595 then there r problem- lost power or low speed @ out put
If it works for single leds then it works and all of your code needs checking. So please post your code so we can help.
MINHLE
- 29th July 2014, 09:06
HI,
thanks for your help.
i suspect st wrong,
i test the whole port b. it runs well (8 leds) - FOSC_INTIO67 (16x4mhz)
However, when attaching portb to the 74hc595 - then 1 of the port pin lost power.
just last week, the system run well @40mhz. (external osc).
now problem is data to send out is not right
i will spend 1 more time to check, and will send the program to you
regards
richard
- 29th July 2014, 10:03
when attaching portb to the 74hc595 - then 1 of the port pin lost power.
I'm not really sure what this means , its rather ambiguous
perhaps a schematic diagram (or a photo) of your setup would be in order
MINHLE
- 2nd August 2014, 10:56
HI,,
thANKS A LOT RICHARD,
I MOVE TO USE 18F4620, THE PREVIOUS CONF. IS FINE (internal osc*4 = 32 mhz)
the program runs well @40mhz (external osc) then there are problems
i.e. data output randomly- (due to dirty breadboard)
line appears on the screen (same cause above).
i will going back to see the 18f26k20.next week.
thanks again
regards
Demon
- 3rd August 2014, 00:11
As requested by others, post your complete code and a schematic of your circuit.
Have you disabled analog features on any pins you use as digital?
Robert
MINHLE
- 7th August 2014, 02:19
HI ALL
THANKS for all
the program actually runs well, but the pause time is not correct and the current supply is not adequate ( due to dirty breadboar...)
at high frequency, some of the port pins is measured = 0, (when the port drives other ic) look like there is no power at all.
the set up is right:
_FOSC_INTIO67_1H
OSCTUNE = $40
OSCCON = $70
the PBADEN = OFF, so the portb is digital I/O
thanks a gain for all
regards
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.