Hi everybody:
I write test code of 10000 accumulation code like below section, but the implement latency has big differency with theoretical value, the test condition is listed:
CA5 run in 400MHz, and platform clock 133MHz;
and run this code section in bareboard and MQX project, test result is listed:
| code run conditions | time(us) | Header 3 | Header 4 | Header 5 |
|---|
| run code in bareboard in SRAM | 6000 | | | |
| run code in MQX in SRAM | 4500 | | | |
| run code in MQX in DDR | 400 | | | |
| | | | |
you could see, the latency run code in RAM is huge than in DDR, but the difference between bareboard & MQX is not big, the MQX perform better for it enable L1 & L2 cache.
since the OCRAM clock is drive from system clock, I check this clock from CKO1, the clock is fine,
and I adjust this clock to other value by BUS_CLK_DIV, the result changed accordingly.
So I want to ask why the performance is bad, I checked AN4947, from the AN, the latency in SRAM is normal. Besides platform clock, any other factor will affect it?
I attached the test code also, including bardboard and MQX, I don't adjust other project code.
/* Make sure the clock to the LPTMR is enabled */
CCM->CCGR2 |= CCM_CCGR2_CG0(1);
/* Reset LPTMR settings */
LPTMR0->CSR=0;
/* Set the compare value to the number of ms to delay */
LPTMR0->CMR = 0xffff;//set max value
/* Set up LPTMR to use 32kHz LPO with no prescaler as its clock source */
LPTMR0->PSR |= LPTMR_PSR_PCS(0x3) | LPTMR_PSR_PBYP_MASK;//use 32K as clock source
/* Start the timer */
LPTMR0->CSR |= LPTMR_CSR_TEN_MASK;
while(1)
{
printf("GPIO Example!%d,%d\n",diff1,diff2);
diff1=j2-j1;
diff2=j3-j2;
//Turn on LED's by driving 0 (active low)
//Toggle PTB1
GPIO0->PTOR|=PIN(23);
LPTMR0->CNR = 0;//must first write to the CNR with any value
j1 = LPTMR0->CNR*1000/128;
// tick1 = getticks();
//Delay
for(i=0;i<10000;i++);
//time_delay_ms(1000);
// tick2 = getticks();
// difftick=tick2-tick1;
LPTMR0->CNR = 0;//must first write to the CNR with any value
j2 = LPTMR0->CNR*1000/128;
//Turn off LED's by driving 1
//Toggle PTB1
GPIO0->PTOR|=PIN(23);
//Delay
for(i=0;i<10000;i++);
//time_delay_ms(1000);
LPTMR0->CNR = 0;//must first write to the CNR with any value
j3 = LPTMR0->CNR*1000/128;
}
Original Attachment has been moved to: gpio.c.zip
Original Attachment has been moved to: hello.c.zip