Page 1 of 1

Program running very slowly from internal SRAM

Posted: Sat Mar 07, 2015 8:48 pm
by diagnosysuk
Hi All

Im new to the A5D31 processor and Im trying to run a program from internal SRAM. I have done the following

1. Set the PLL to 516MHz and PCK to 516MHz (no divisor), MCLK=129MHz (PCLK/4)

2. Boot from flash, copied my program into internal SRAM at 0x300000 and then run it from internal RAM with Stack pointer also pointing to internal RAM

3. Run my program which is basically as follows (a simple program to toggle an I/O pin connected to a scope with a delay between

4. The scope says that the toggle speed is 500us or approx 500ns per increment of the counter.

5. The delay loop is approx 7 instructions (ARM not thumb) as shown by the debugger

void testpeed(void)
{
volatile int i,j;

while(1)
{
PIOE->PIO_SODR=PIO_PER_P25;
for(i=0;i<1000;i++) j=i;
PIOE->PIO_CODR=PIO_PER_P25;
for(i=0;i<1000;i++) j=i;
}
}

My question is having tried everything, e.g. change PLL frequency, PCLK divider etc all of which do as they expect (I have checked the PLL frequency and MCLK frequency by outputting it to a PCK0 output)
why does it take 500ns to perform 7 instructions with a processor clock of 516MHz. A PIC runs a faster!
Any clues would be gratefully received
Richard