Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

RTC manipulation

RTC manipulation

2004-09-28 by Leighton Rowe

I noticed that the lpc real time clocks doesn't really have any 
registers available for counting time intervals below 1 sec. Is it 
possible to do this with the CTC register? (pclk = 14.7456MHz) 

If yes, what challenges will I face doing so?

RTC manipulation (ctd.)

2004-10-05 by Leighton Rowe

LPC2114 ; 14.7456 MHz XTAL
PCLK configured to 14.7456 MHz

After using PCLK to initialize the real time clock along with other 
peripherals (UART, Timers), I noticed the RTC time registers (MIN, 
SEC, HOUR, etc.) are going 2 times faster than typical a stopwatch 
(ie. I wait 10seconds and the RTC says 20). 

code....
..........
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 |= RTC_RESET;                         //reset timer
CCR &= ~RTC_RESET;
CCR |= RTC_ENABLE;                        //start timer
...............

After following the documentation as closely as possible, I'm still 
not sure why the RTC's going twice as fast. 

Can anyone clarified this issue?

Re: RTC manipulation (ctd.)

2004-10-05 by Leighton Rowe

Hey guys,

After looking further looking up the usermanual and playing with the 
RTC registers....

> PREINT = (PCLK/32768) - 1;                //integer value
> PREFRAC = PCLK - ((PREINT + 1)* 32768);   //fraction value
       // where PCLK = 14745600 or 14.7456MHz

...this code from my previous post follows the Usr Manual but 
apparently the RTC ended up counting twice the speed of a normal 
clock (or stopwatch). I'm not sure why.

PREINT  = ((2*PCLK)/32768) - 1;                //integer value
PREFRAC =  (2*PCLK) - ((PREINT + 1)* 32768);   //fraction value
       // where PCLK = 14745600 or 14.7456MHz

Now I tried the above code change. To my surprise, the RTC counted 
at the correct speed. But this formula doesn't really follow the Usr 
Manual. So now, I'm not convinced that the prescalar formulas in the 
RTC documentation (LPC2114/19/29 User Manual) are correct.

Can anyone clarify this and/or explain what I'm doing wrong? 

Thanks in advance,
Leighton

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-10-05 by Robert Adsett

At 09:24 PM 10/5/04 +0000, you wrote:
>After looking further looking up the usermanual and playing with the
>RTC registers....
>
> > PREINT = (PCLK/32768) - 1;                //integer value
> > PREFRAC = PCLK - ((PREINT + 1)* 32768);   //fraction value
>        // where PCLK = 14745600 or 14.7456MHz
>
>...this code from my previous post follows the Usr Manual but
>apparently the RTC ended up counting twice the speed of a normal
>clock (or stopwatch). I'm not sure why.
>
>PREINT  = ((2*PCLK)/32768) - 1;                //integer value
>PREFRAC =  (2*PCLK) - ((PREINT + 1)* 32768);   //fraction value
>        // where PCLK = 14745600 or 14.7456MHz

VPBDIV is 1?
And PLL is not enabled?

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-10-05 by Leighton Rowe

> VPBDIV is 1?
> And PLL is not enabled?
>
> Robert

I have PLL enabled (M=4 P=2) with VPBDIV = 0 (1/4 cclk). 

Leighton


		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[Non-text portions of this message have been removed]

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-10-06 by Robert Adsett

At 03:57 PM 10/5/04 -0700, you wrote:

> > VPBDIV is 1?
> > And PLL is not enabled?
> >
> > Robert
>
>I have PLL enabled (M=4 P=2) with VPBDIV = 0 (1/4 cclk).

That would mean MSEL is 3 and PSEL is 1?  Just checking the obvious.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-10-06 by Leighton Rowe

Yes I have PLLCFG = 0x23 (MSEL=3 PSEL =1). You had any luck with configuring rtc's?


Robert Adsett <subscriptions@...> wrote:
At 03:57 PM 10/5/04 -0700, you wrote:

> > VPBDIV is 1?
> > And PLL is not enabled?
> >
> > Robert
>
>I have PLL enabled (M=4 P=2) with VPBDIV = 0 (1/4 cclk).

That would mean MSEL is 3 and PSEL is 1?  Just checking the obvious.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III


Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/lpc2000/
  
   To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[Non-text portions of this message have been removed]

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-10-06 by Robert Adsett

At 09:54 AM 10/6/04 -0700, you wrote:
>Yes I have PLLCFG = 0x23 (MSEL=3 PSEL =1). You had any luck with 
>configuring rtc's?

Actually I haven't worked with them at all (for the kind of stuff I 
normally do they strike me as a solution looking for a problem, I'd have 
rather have had a few more timers [even w/o associated output pins]) but 
since you didn't seem to be getting any response I thought I might act as a 
bit of a sounding board.

I seem to be reading the documentation the same as you so the next check 
was to check that pclk was what you thought it was (it does seem to be).  I 
don't see where your factor of two is coming from either but I'll mull it 
over a bit more.

Robert


" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: RTC manipulation (ctd.)

2004-10-06 by Pete

ok, just been reading your threads....

for what its worth, and please pardon me if this isnt the solution 
or you have already considered this... but:


given your crystal, and the pll & vpbdiv settings I calculated the 
following:

YOUR PreInt=0x1C1  and YOUR PreFac = 0.

Now there is some mention in the databook that preint must be >1, 
and there is somemention about prefac containing a 0 however i didnt 
really understand what it was on about.... but, im just wondering if 
there is some issue if prefac is 0...

other questions, which are 'basic' but lets ask and get them out the 
way:

1. are you configuring the vpbdiv and pll FIRST and then configuring 
the RTC?
2. are you enabling the RTC AFTER you have intiialised the fac and 
int?
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...

well, hope this helps. if not then i hope u get it sorted soon!

kind regards
pete

--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
> At 09:54 AM 10/6/04 -0700, you wrote:
> >Yes I have PLLCFG = 0x23 (MSEL=3 PSEL =1). You had any luck with 
> >configuring rtc's?
> 
> Actually I haven't worked with them at all (for the kind of stuff 
I 
> normally do they strike me as a solution looking for a problem, 
I'd have 
> rather have had a few more timers [even w/o associated output 
pins]) but 
> since you didn't seem to be getting any response I thought I might 
act as a 
> bit of a sounding board.
> 
> I seem to be reading the documentation the same as you so the next 
check 
> was to check that pclk was what you thought it was (it does seem 
to be).  I 
> don't see where your factor of two is coming from either but I'll 
mull it 
> over a bit more.
> 
> Robert
> 
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,
> be they legal, genetic, or physical.  If you don't believe me, try 
to
Show quoted textHide quoted text
> chew a radio signal. "
> 
>                          Kelvin Throop, III

Re: RTC manipulation (ctd.)

2004-10-06 by Leighton Rowe

Hey Pete, 

Thanks for the reply. In reference to your questions:

> 1. are you configuring the vpbdiv and pll FIRST and then 
configuring 
> the RTC?
Yes I config'ed PLL first, but I skipped the vpbdiv config. I'm 
aware vpbdiv is 0 by default, so I have the uart/timer/rtc 
configured based on (pclk = 1/4 cclk).

> 2. are you enabling the RTC AFTER you have intiialised the fac and 
> int?
Yes. And after trying the values u've calculated (PreInt=0x1C1, 
PreFac=0), the RTC was strangely going twice as fast. (see my 1st & 
2nd first post)
 
> 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...

Nope...but it's definitely worth a try. I would assume RTC (once 
config'ed) should count correctly regardless of vpbdiv. I'll let u 
know tomorrow how it goes. If u can, try running the RTC with VPBDIV 
= 0 and see what happens. 

Thanks a mil,
Leighton

--- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...> 
wrote:
> 
> 
> ok, just been reading your threads....
> 
> for what its worth, and please pardon me if this isnt the solution 
> or you have already considered this... but:
> 
> 
> given your crystal, and the pll & vpbdiv settings I calculated the 
> following:
> 
> YOUR PreInt=0x1C1  and YOUR PreFac = 0.
> 
> Now there is some mention in the databook that preint must be >1, 
> and there is somemention about prefac containing a 0 however i 
didnt 
> really understand what it was on about.... but, im just wondering 
if 
> there is some issue if prefac is 0...
> 
> other questions, which are 'basic' but lets ask and get them out 
the 
> way:
> 
> 1. are you configuring the vpbdiv and pll FIRST and then 
configuring 
> the RTC?
> 2. are you enabling the RTC AFTER you have intiialised the fac and 
> int?
> 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...
> 
> well, hope this helps. if not then i hope u get it sorted soon!
> 
> kind regards
> pete
> 
> --- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
> wrote:
> > At 09:54 AM 10/6/04 -0700, you wrote:
> > >Yes I have PLLCFG = 0x23 (MSEL=3 PSEL =1). You had any luck 
with 
> > >configuring rtc's?
> > 
> > Actually I haven't worked with them at all (for the kind of 
stuff 
> I 
> > normally do they strike me as a solution looking for a problem, 
> I'd have 
> > rather have had a few more timers [even w/o associated output 
> pins]) but 
> > since you didn't seem to be getting any response I thought I 
might 
> act as a 
> > bit of a sounding board.
> > 
> > I seem to be reading the documentation the same as you so the 
next 
> check 
> > was to check that pclk was what you thought it was (it does seem 
> to be).  I 
> > don't see where your factor of two is coming from either but 
I'll 
> mull it 
> > over a bit more.
> > 
> > Robert
> > 
> > 
> > " 'Freedom' has no meaning of itself.  There are always 
> restrictions,
> > be they legal, genetic, or physical.  If you don't believe me, 
try 
Show quoted textHide quoted text
> to
> > chew a radio signal. "
> > 
> >                          Kelvin Throop, III

Re: RTC manipulation (ctd.)

2004-10-07 by Leighton Rowe

> 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 again

Re: RTC manipulation (ctd.)

2004-10-07 by Leighton Rowe

> 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. 

...sorry bout the typos. I'm saying that you should end up with the 
same problem when running the RTC with vpbdiv=0.

Re: RTC manipulation (ctd.)

2004-10-07 by bty639886

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; 
Show quoted textHide quoted text
> 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 again

Re: RTC manipulation (ctd.)

2004-10-07 by Pete

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 
Show quoted textHide quoted text
> > everything work. 
> > 
> > Thanks again

Re: RTC manipulation (ctd.)

2004-10-07 by Leighton Rowe

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 
Show quoted textHide quoted text
> > > 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 again

Re: RTC manipulation (ctd.)

2004-10-07 by Pete

Hi Leighton,

Im using the MCB2100 development board from Keil for the time being. 
Our main control unit is in development as we speak...

anyway, the MCB is stuffed with the LPC2129, crystal of 12Mhz.

I have tested my system using YOUR CODE that you pasted below, and I 
agree with my previous answers...the clock WORKS OK at all VPBDiv 
settings....

i print the time to terminal (38400baud) and monitor the time for 
several minutes and it certainly does not run fast (or fast enough 
to visually see anyway!)...

so i am very confused why you see this problem....

so i guess i cannot help any further.... but hope the above helps a 
little....

daft question - are u sure that your PLL is enabled and running?

let me know if you find the solution,
rgds
pete



--- In lpc2000@yahoogroups.com, "Leighton Rowe" <leightonsrowe@y...> 
wrote:
> 
> 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. 
Show quoted textHide quoted text
> > > > 
> > > > For now, I can live with using a different vpbdiv setting to 
> > make 
> > > > everything work. 
> > > > 
> > > > Thanks again

Re: RTC manipulation (ctd.)

2004-10-08 by Leighton Rowe

Yep,

PLLSTAT says that the PLL's enabled, connected & locked.

I'm running the code on a mcb2100 as well (12MHz crystal). I made a 
mistake about the processor on the mcb2100 though...it's actually a 
2124 that replaced the original 2129 (it got toasted :-/). 
My other board is the 2114 with a 14.7456MHz xtal.

So, I'd imagine the code will work ok on all 2129's, as you've 
shown. There might be an issue with 2114/24's I'm using. I'm trying 
to verify that with Philips...or anyone here that has them.

best regards,
Leighton

--- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...> 
wrote:
> 
> 
> Hi Leighton,
> 
> Im using the MCB2100 development board from Keil for the time 
being. 
> Our main control unit is in development as we speak...
> 
> anyway, the MCB is stuffed with the LPC2129, crystal of 12Mhz.
> 
> I have tested my system using YOUR CODE that you pasted below, and 
I 
> agree with my previous answers...the clock WORKS OK at all VPBDiv 
> settings....
> 
> i print the time to terminal (38400baud) and monitor the time for 
> several minutes and it certainly does not run fast (or fast enough 
> to visually see anyway!)...
> 
> so i am very confused why you see this problem....
> 
> so i guess i cannot help any further.... but hope the above helps 
a 
> little....
> 
> daft question - are u sure that your PLL is enabled and running?
> 
> let me know if you find the solution,
> rgds
> pete
> 
> 
> 
> --- In lpc2000@yahoogroups.com, "Leighton Rowe" 
<leightonsrowe@y...> 
> wrote:
> > 
> > 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 
Show quoted textHide quoted text
> > > make 
> > > > > everything work. 
> > > > > 
> > > > > Thanks again

Re: RTC manipulation (ctd.)

2004-12-23 by lp2000c

Did you ever resolve this issue, or confirm that there is a bug?

--- In lpc2000@yahoogroups.com, "Leighton Rowe" <leightonsrowe@y...> 
wrote:
> 
> Yep,
> 
> PLLSTAT says that the PLL's enabled, connected & locked.
> 
> I'm running the code on a mcb2100 as well (12MHz crystal). I made a 
> mistake about the processor on the mcb2100 though...it's actually a 
> 2124 that replaced the original 2129 (it got toasted :-/). 
> My other board is the 2114 with a 14.7456MHz xtal.
> 
> So, I'd imagine the code will work ok on all 2129's, as you've 
> shown. There might be an issue with 2114/24's I'm using. I'm trying 
> to verify that with Philips...or anyone here that has them.
> 
> best regards,
> Leighton
> 
> --- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...> 
> wrote:
> > 
> > 
> > Hi Leighton,
> > 
> > Im using the MCB2100 development board from Keil for the time 
> being. 
> > Our main control unit is in development as we speak...
> > 
> > anyway, the MCB is stuffed with the LPC2129, crystal of 12Mhz.
> > 
> > I have tested my system using YOUR CODE that you pasted below, 
and 
> I 
> > agree with my previous answers...the clock WORKS OK at all VPBDiv 
> > settings....
> > 
> > i print the time to terminal (38400baud) and monitor the time for 
> > several minutes and it certainly does not run fast (or fast 
enough 
> > to visually see anyway!)...
> > 
> > so i am very confused why you see this problem....
> > 
> > so i guess i cannot help any further.... but hope the above helps 
> a 
> > little....
> > 
> > daft question - are u sure that your PLL is enabled and running?
> > 
> > let me know if you find the solution,
> > rgds
> > pete
> > 
> > 
> > 
> > --- In lpc2000@yahoogroups.com, "Leighton Rowe" 
> <leightonsrowe@y...> 
> > wrote:
> > > 
> > > 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). 
Show quoted textHide quoted text
> 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 again

Re: [lpc2000] Re: RTC manipulation (ctd.)

2004-12-24 by Leighton Rowe

Have u experienced this problem too? I decided to rest the matter since nobody else could reproduce the problem or find the bug in my code (if any).

lp2000c <lp2000c@...> wrote:

Did you ever resolve this issue, or confirm that there is a bug?

--- In lpc2000@yahoogroups.com, "Leighton Rowe" <leightonsrowe@y...> 
wrote:
> 
> Yep,
> 
> PLLSTAT says that the PLL's enabled, connected & locked.
> 
> I'm running the code on a mcb2100 as well (12MHz crystal). I made a 
> mistake about the processor on the mcb2100 though...it's actually a 
> 2124 that replaced the original 2129 (it got toasted :-/). 
> My other board is the 2114 with a 14.7456MHz xtal.
> 
> So, I'd imagine the code will work ok on all 2129's, as you've 
> shown. There might be an issue with 2114/24's I'm using. I'm trying 
> to verify that with Philips...or anyone here that has them.
> 
> best regards,
> Leighton
> 
> --- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...> 
> wrote:
> > 
> > 
> > Hi Leighton,
> > 
> > Im using the MCB2100 development board from Keil for the time 
> being. 
> > Our main control unit is in development as we speak...
> > 
> > anyway, the MCB is stuffed with the LPC2129, crystal of 12Mhz.
> > 
> > I have tested my system using YOUR CODE that you pasted below, 
and 
> I 
> > agree with my previous answers...the clock WORKS OK at all VPBDiv 
> > settings....
> > 
> > i print the time to terminal (38400baud) and monitor the time for 
> > several minutes and it certainly does not run fast (or fast 
enough 
> > to visually see anyway!)...
> > 
> > so i am very confused why you see this problem....
> > 
> > so i guess i cannot help any further.... but hope the above helps 
> a 
> > little....
> > 
> > daft question - are u sure that your PLL is enabled and running?
> > 
> > let me know if you find the solution,
> > rgds
> > pete
> > 
> > 
> > 
> > --- In lpc2000@yahoogroups.com, "Leighton Rowe" 
> <leightonsrowe@y...> 
> > wrote:
> > > 
> > > 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 again




Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/lpc2000/
  
   To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


		
---------------------------------
Do you Yahoo!?
 All your favorites on one personal page � Try My Yahoo!

[Non-text portions of this message have been removed]

Re: RTC manipulation (ctd.)

2004-12-27 by lp2000c

I have not tried it.

--- In lpc2000@yahoogroups.com, Leighton Rowe <leightonsrowe@y...> 
wrote:
> Have u experienced this problem too? I decided to rest the matter 
since nobody else could reproduce the problem or find the bug in my 
code (if any).
> 
> lp2000c <lp2000c@e...> wrote:
> 
> Did you ever resolve this issue, or confirm that there is a bug?
> 
> --- In lpc2000@yahoogroups.com, "Leighton Rowe" 
<leightonsrowe@y...> 
> wrote:
> > 
> > Yep,
> > 
> > PLLSTAT says that the PLL's enabled, connected & locked.
> > 
> > I'm running the code on a mcb2100 as well (12MHz crystal). I made 
a 
> > mistake about the processor on the mcb2100 though...it's actually 
a 
> > 2124 that replaced the original 2129 (it got toasted :-/). 
> > My other board is the 2114 with a 14.7456MHz xtal.
> > 
> > So, I'd imagine the code will work ok on all 2129's, as you've 
> > shown. There might be an issue with 2114/24's I'm using. I'm 
trying 
> > to verify that with Philips...or anyone here that has them.
> > 
> > best regards,
> > Leighton
> > 
> > --- In lpc2000@yahoogroups.com, "Pete" <peterbrown_abroad@y...> 
> > wrote:
> > > 
> > > 
> > > Hi Leighton,
> > > 
> > > Im using the MCB2100 development board from Keil for the time 
> > being. 
> > > Our main control unit is in development as we speak...
> > > 
> > > anyway, the MCB is stuffed with the LPC2129, crystal of 12Mhz.
> > > 
> > > I have tested my system using YOUR CODE that you pasted below, 
> and 
> > I 
> > > agree with my previous answers...the clock WORKS OK at all 
VPBDiv 
> > > settings....
> > > 
> > > i print the time to terminal (38400baud) and monitor the time 
for 
> > > several minutes and it certainly does not run fast (or fast 
> enough 
> > > to visually see anyway!)...
> > > 
> > > so i am very confused why you see this problem....
> > > 
> > > so i guess i cannot help any further.... but hope the above 
helps 
> > a 
> > > little....
> > > 
> > > daft question - are u sure that your PLL is enabled and running?
> > > 
> > > let me know if you find the solution,
> > > rgds
> > > pete
> > > 
> > > 
> > > 
> > > --- In lpc2000@yahoogroups.com, "Leighton Rowe" 
> > <leightonsrowe@y...> 
> > > wrote:
> > > > 
> > > > 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 again
> 
> 
> 
> 
> Yahoo! Groups SponsorADVERTISEMENT
> 
> 
> ---------------------------------
> Yahoo! Groups Links
> 
>    To visit your group on the web, go to:
> http://groups.yahoo.com/group/lpc2000/
>   
>    To unsubscribe from this group, send an email to:
> lpc2000-unsubscribe@yahoogroups.com
>   
>    Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service. 
Show quoted textHide quoted text
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
>  All your favorites on one personal page – Try My Yahoo!
> 
> [Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.