Hello,
I am working with a TMS570LS20216ASPGE USB stick developpement board, CCS5 and compiler v4.9.0.
I am having problems with execution speed, my software seams to run slower than expected. I attached a simple example program that illustrates the problem.
In my main I call the following function:
void DoMainLoop( void )
{
volatile unsigned long i = 0;
while( 1 )
{
gioSetBit( gioPORTA, 0, 1 );
i++;
48 times i++;
i++;
gioSetBit( gioPORTA, 0, 0 );
i--;
48 times i--;
i--;
}
}
In my example I toggle GIO0 to 1, execute 50 times i++, toggle GIO0 to 0, execute 50 times i-- and start again.
Because of the volatile, I++ and i-- are not optimized and translate in assembly to LDR, ADD and STR for each i++ and i--.
This makes 50*3 = 150 instructions and my CPU runs at 140MHz so I would expect GIO0 to toggle every 1us (150/140e6) or less.
In fact with my oscilloscope it toggles every 3.5us (you can try it with the example program). I tried a lot of stuff like changing wait states, setting optimization level, running the code from RAM and nothing changes the timing significantly.
Can anyone tell me if this is normal and how to raise the execution speed.
I expected this DSP to execute code around 4 times faster.