This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Execution time improvement using "ramfuncs"



Hi,

I'm using piccolo 2x series 40MHz processor for a solar application. I'm running a PID loop @ 2.5KHz to regulate the output of the converter. The loop has been coded inside a Timer ISR in C. The execution time of the loop measured by using an output port was 12us. The code was being run from flash memory. To increase the performance (or reduce the execution time) I decided to run the loop from 0-waitstate RAM memory. But even after adding the ISR to "ramfuncs" sections I observed zero improvement in the same loop. The time observed was the same 12us. 

My question ,

1) Is this an expected behavior? Will there be no difference (or no noticeable difference) between the execution time of code executed from RAM compared to the same code executed from Flash for a 40MHz processor ?

2) My next project will be on a 60MHz 3x piccolo family. Will I be able to see some performance improvement here?  I'm looking for a real tight performance in my next project.

Any help will be appreciated!!!

Thanks,

Vivek

  • Hi Vivek,

    1. Actually execution from RAM is faster than execution from flash. I don't know why you're getting contradictory results. I've myself tested that!

     2. Yes off-course, cycle time will be reduced when used with 60Mhz based controller. You'll surely experience an improvement in performance.

    Regards,

    Gautam

  • Hello!

    Certainly, time-critical code better to execute from RAM.

    Regards,

    Igor

  • Hi Gautam,

    Thanks for response..

    It would be great if you can elaborate a little bit. Did you use a 40MHz processor for your test? What was the improvement in performance you observed?

    Thanks,

    Vivek

  • Hi,

    I've not used 40Mhz processor in particular but have tested 3 to 4 processor's performance ranging from 5Mhz clock to 150Mhz clock.

    I did experience improvement in performance for incremented clock speeds. I don't know how can I elaborate more, but here is the basic test that I conducted to test processors and their performances:

    Active: Flash 
    System Clock: 80Mhz
    Condition: All peripherals off
    
    
    
    // Initialization
    
    float32 vo1=2430, vo2, vo3;
    Uint16 vo4, v1=2400,v2=2410,v3=2420,v4=2430,v5=2440;
    
    
    //Code to be tested w.r.t. clock cycles taken to execute each of these instructions
    
    vo2 = (vo1/3630);
    vo3 = (vo2 * 3);
    
    vo4 = ((v1 + v2 + v3 + v4 + v5)/5);
    
    
    
    Steps to note down the Observations: CCS5
    1.Compile and Debug the code
    2. Once in debugging mode, by using "Run to Line" go to the first line of the code and turn on the "Clock" from Run Menu in compiler.
    3. Once done, by pressing F5 or by clicking on "Step into" option one can check the cycles consumed by the above individual instructions.

    The above file was used for testing controllers ranging from F28027, F28069, F2808, F28335 etc. at varying clock speeds.

    Regards,

    Gautam

  • Thanks Gautam,

    Will take a look, but I have a feeling that we can see a good improvement in the execution time only if

    1. The clock frequency is high. (about 80MHz or greater).

    2. If the the execution time of the code run from Flash is very high for lower clock speeds (say > 1-2ms). This is just a gut feeling but i will be doing some tests for verification. Will post here if I find some useful results.

    Vivek

  • Sure, Mate. Will wait for the results!

    Regards,

    Gautam

  • Gautam, 

    Can you please share the result? Improvement with 'run from ram' with flash, with the sample code?