EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

difference in execution time(Keil, LPC2129)

Started by ayman ghaly May 6, 2006
Hi all

I measured the execution time of the code shown below using break points in the keil simulator and it was approximately 500 micro seconds.
But when I measured the execution time of the same code from the Philips ARM board LPC2129 it was about 3000 micro seconds.
Do you have any idea about the cause of this difference?

Note that I used the following adjustments before running the code:
Target: Philips LPC2129
Oscillator frequency: 12 MHz
CCLK= 48MHz
PCLK= CCLK/2
Cc: No optimization for the code

Code:


unsigned int i,j;
for (i=0;i<5;i++)
{
for (j=0;j<286;j++);
}

Thanks for your help.
Ayman

---------------------------------
Get amazing travel prices for air and hotel in one click on Yahoo! FareChase







An Engineer's Guide to the LPC2100 Series

How many wait states did you have on your real physical memory and how
many wait states did you tell your simulator to simulate?

-- Dave

--- In l..., ayman ghaly wrote:
>
> Hi all
>
> I measured the execution time of the code shown below using
break points in the keil simulator and it was approximately 500 micro
seconds.
> But when I measured the execution time of the same code from the
Philips ARM board LPC2129 it was about 3000 micro seconds.
> Do you have any idea about the cause of this difference?
>
> Note that I used the following adjustments before running the code:
> Target: Philips LPC2129
> Oscillator frequency: 12 MHz
> CCLK= 48MHz
> PCLK= CCLK/2
> Cc: No optimization for the code
>
> Code:
>
>
> unsigned int i,j;
> for (i=0;i<5;i++)
> {
> for (j=0;j<286;j++);
> }
>
> Thanks for your help.
> Ayman
>
>
>
> ---------------------------------
> Get amazing travel prices for air and hotel in one click on Yahoo!
FareChase
>
>
>





Thanks Dav for your concern.
I download the program to the internal flash of the ARM board, so I don't use external memory. I didn't find anything related to the number of wait states in the manual of the LPC2129 regarding to this.
Ayman


derbaier wrote:

How many wait states did you have on your real physical memory and how
many wait states did you tell your simulator to simulate?

-- Dave

--- In l..., ayman ghaly wrote:
>
> Hi all
>
> I measured the execution time of the code shown below using
break points in the keil simulator and it was approximately 500 micro
seconds.
> But when I measured the execution time of the same code from the
Philips ARM board LPC2129 it was about 3000 micro seconds.
> Do you have any idea about the cause of this difference?
>
> Note that I used the following adjustments before running the code:
> Target: Philips LPC2129
> Oscillator frequency: 12 MHz
> CCLK= 48MHz
> PCLK= CCLK/2
> Cc: No optimization for the code
>
> Code:
>
>
> unsigned int i,j;
> for (i=0;i<5;i++)
> {
> for (j=0;j<286;j++);
> }
>
> Thanks for your help.
> Ayman
>
>
>
> ---------------------------------
> Get amazing travel prices for air and hotel in one click on Yahoo!
FareChase
>
>
>

SPONSORED LINKS
Microcontrollers Microprocessor Intel microprocessors

---------------------------------

You can look up the functions of the MAMCR(0xE01FC000) and
MAMTIM(0xE01FC004) registers in the User Manual to see how wait states
are configured, but the RESET state is to have the MAM disabled. I can
not tell from reading the register descriptions if all 6 wait states
are enabled if MAMCR is all zeros, OR if there are no wait states
enabled if MAMCR is disabled. I have always cofigured access times
according to clock speed like the manual suggests, so I can't come up
with an answer from personal experience. The safe default is to come
out of RESET with the maximum number of wait states enabled, but I can
not find that statement in the manual, so it is only a guess that
probably you are running with 6 wait states ( 7 clocks access). Since
you are successfully running the clock at 48MHz, you either have a
VERY fast part, or your are running with some wait states, since 20MHz
is the maximum for single clock access to the internal FLASH according
to the MAM usage notes.
--Dave
-- In l..., ayman ghaly wrote:
>
> Thanks Dav for your concern.
> I download the program to the internal flash of the ARM board, so
I don't use external memory. I didn't find anything related to the
number of wait states in the manual of the LPC2129 regarding to this.
> Ayman
>
>
> derbaier wrote:
>
> How many wait states did you have on your real physical memory and how
> many wait states did you tell your simulator to simulate?
>
> -- Dave
>
> --- In l..., ayman ghaly wrote:
> >
> > Hi all
> >
> > I measured the execution time of the code shown below using
> break points in the keil simulator and it was approximately 500 micro
> seconds.
> > But when I measured the execution time of the same code from the
> Philips ARM board LPC2129 it was about 3000 micro seconds.
> > Do you have any idea about the cause of this difference?
> >
> > Note that I used the following adjustments before running the code:
> > Target: Philips LPC2129
> > Oscillator frequency: 12 MHz
> > CCLK= 48MHz
> > PCLK= CCLK/2
> > Cc: No optimization for the code
> >
> > Code:
> >
> >
> > unsigned int i,j;
> > for (i=0;i<5;i++)
> > {
> > for (j=0;j<286;j++);
> > }
> >
> > Thanks for your help.
> > Ayman
> >
> >
> >
> > ---------------------------------
> > Get amazing travel prices for air and hotel in one click on Yahoo!
> FareChase
> >
> >
> > SPONSORED LINKS
> Microcontrollers Microprocessor Intel microprocessors
>
> ---------------------------------
>
At 09:45 PM 5/7/2006 +0000, derbaier wrote:
>You can look up the functions of the MAMCR(0xE01FC000) and
>MAMTIM(0xE01FC004) registers in the User Manual to see how wait states
>are configured, but the RESET state is to have the MAM disabled. I can
>not tell from reading the register descriptions if all 6 wait states
>are enabled if MAMCR is all zeros, OR if there are no wait states
>enabled if MAMCR is disabled.

From page 83 of the user manual

MAMTIM provides 7 cycles for memory fetch on reset.

And earlier in the same section when MAMCR is 0 no memory fetches use
latched data, all initiate a fetch cycle.

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
http://www.aeolusdevelopment.com/





--- In l..., Robert Adsett wrote:
>
> At 09:45 PM 5/7/2006 +0000, derbaier wrote:
> >You can look up the functions of the MAMCR(0xE01FC000) and
> >MAMTIM(0xE01FC004) registers in the User Manual to see how wait states
> >are configured, but the RESET state is to have the MAM disabled. I can
> >not tell from reading the register descriptions if all 6 wait states
> >are enabled if MAMCR is all zeros, OR if there are no wait states
> >enabled if MAMCR is disabled.
>
> From page 83 of the user manual
>
> MAMTIM provides 7 cycles for memory fetch on reset.
>
> And earlier in the same section when MAMCR is 0 no memory fetches use
> latched data, all initiate a fetch cycle.
>
> Robert
>
I have not used the 2129 varient for a while, so that probably
explains why that information is not on page 83 of the 3 May 2004
manual that I used. You probably have an actual current manual?
Regardless, your comment made me look a little deeper in my own manual
and I did find some similar info. This statement on page 92 of my
manual explains how it is actually accomplished.

"The MAM actually uses latched data if it is available, but mimics the
timing of a Flash read operation. This saves power while
resulting in the same execution timing. The MAM can truly be turned
off by setting the fetch timing value in MAMTIM to one
clock."

So, to get the simulator times and the actual times to agree, he needs
to enable MAMCR and set MAMTIM for a 1 clock access? And, of course,
run the ARM clock at less than 20MHZ. :-)

Thanks for the setting me straight!
--Dave






The 2024 Embedded Online Conference