Thanks for your results
What lpc are you using by the way? Is your RTC counting at the right
speed when VPBDIV=0? Try comparing the RTC timers against a normal
clock if u can.
I tried your code on my 12 MHz board (M=5), and this is what I get.
VPBDIV = 0 so VPB = 15MHz (cclk/4)
PREINT = 0x000001c8;
PREFRAC = 0x000061c0;
RTC runs OK, but it's going twice as fast.
....
VPBDIV = 1 then VPB = 60MHz (cclk)
PREINT = 0x00000726;
PREFRAC = 0x00000700;
RTC runs OK. Speed is normal.
....
VPBDIV = 2 then VPB = 30MHz (cclk/2)
PREINT = 0x00000392;
PREFRAC = 0x00004380;
RTC runs OK. Speed is normal.
For now, It's still unsolved over here.
Thanks,
Leighton
I've included pieces of my code just for reference.
************************************
#define XTAL_FREQ 12000000
//#define XTAL_FREQ 14745600
#define MULTIPLIER 5
//#define MULTIPLIER 4
#define CCLK (XTAL_FREQ * MULTIPLIER) // system clock
system clock (cclk)
#define PCLK (CCLK / 2)
//#define PCLK CCLK
//#define PCLK (CCLK / 4)
if(PCLK == CCLK)
{
VPBDIV = 1;
}
else if(PCLK == CCLK/2)
{
VPBDIV = 2;
}
else if(PCLK == CCLK/4)
{
VPBDIV = 0;
}
CCR = AMR = CIIR = ILR = 0; //clear all RTC Misc registers
SEC = MIN = HOUR = 0; //clear timer registers being used
//Setup Prescalar Values
PREINT = (PCLK/32768) - 1; //integer value
PREFRAC =PCLK - ((PREINT + 1)* 32768); //fraction value
CCR |= 2; //reset timer
CCR &= ~2;
CCR |= 1; //start timer
--- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...>
wrote:
>
>
> ok, got home and have tried on my dev board...
> Using a 12Mhz crystal, I configured the VPBDiv=0
>
> As a result modified the Fac and Int settings to:
> PREINT = 0x000001c8;//Set RTC prescaler for
12.000Mhz Xtal,
> VBP=15Mhz
> PREFRAC = 0x000061c0;
>
> using the calculations from databook.
>
> I also then had to change my UART settings to match, sicne the
PCLK
> was now 1/4.....
> Anyway: ALL WORKS OK. RTC functions normally.
>
> Can you check what values you used for the Prefac/int when you
> adjusted the VPBDiv?
>
> Or, since you have it working maybe issue is closed?
>
> anyway, thought i would report my findings!
>
> rgds
> pete
>
>
> So I am confused that you say you had problem with the
>
> --- In lpc2000@yahoogroups.com, "bty639886" <peter.brown@b...>
wrote:
> >
> > when i get home i will check this out on my systsem.
> >
> > I do however have a 12Mhz clock rather than the 14.xx that u are
> > using. So my preints and facs will be different.
> > Im suspecting the problem could well be with your prefac being 0
> > given the divider settings...
> >
> > anyway, i will check it out and re-post for future reference.
> >
> > glad you got it working !
> > rgds
> > pete
> >
> >
> > --- In lpc2000@yahoogroups.com, "Leighton Rowe"
> <leightonsrowe@y...>
> > wrote:
> > >
> > > > 3. have you tried running with vpbdiv set to 1 (ie resulting
> in
> > > > 60mhz opertion (ish).. i am using that for my system without
> any
> > > > problem...
> > >
> > > Good news!
> > >
> > > After setting VPBDIV = 1 (pclk =cclk) and setting PREINT and
> > PREFRAC
> > > (based on the user manual), the RTC counted correctly. Thanks
> > Pete.
> > > The RTC also worked for VPBDIV = 2 (pclk = cclk/2).
> > >
> > > But interestingly, the RTC still counted twice as fast after
> using
> > > VPBDIV = 0. I repeated everything on 2 different lpcs (lpc2114
> > > @14.7456MHz & lpc2129 @12MHz). You can even try it out on your
> > own;
> > > I wouldn't be surprised you'll get the same results. and got
the
> > > same results.
> > >
> > > So RTC's OK only when vpbdiv = 1 (pclk=cclk) or 2 (pclk =
> cclk/2).
> > > Otherwise RTC's doubles in speed when vpbdiv = 0 (cclk/4). I
> hope
> > > Philips has an explanation for this one...I have no clue why.
> > >
> > > For now, I can live with using a different vpbdiv setting to
> make
> > > everything work.
> > >
> > > Thanks againMessage
Re: RTC manipulation (ctd.)
2004-10-07 by Leighton Rowe
Attachments
- No local attachments were found for this message.