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.

Executing IQmath routines from RAM

Hi all, I'm trying to write an application for a frequency-variable switching power supply using IQmath libraries for first time but I'm not able to speed up the execution time of the routines running them from RAM instead of Flash. I just read many application notes but I don't find anything, and don't have any problem to run other functions from RAM. Anyone have suggestions? Thanks, Raffaele
  • If you step through the code do the addresses correspond to RAM, i.e. are you positive you are executing from RAM?

    What speed is your device operating and how many flash wait states are you using?

    Also, if your code has a lot of "repeat single" instructions and/or has very little branching then flash performance might be close to RAM performance due to the 64-bit fetch.  When a branch occurs you dump the additional instructions that were grabbed by the 64-bit fetch.

     

  • Yes, the code I want, i'm sure is executed from RAM.

    My device (F2808) is running at 20 MHz and using 3 flash wait states and the pipeline is active; don't has many repeat single operations, because I don't need it.

    I tried two IQ values and a multiplication during the main interrupt (timer) each 25 µs but the time needed for this op is around 40 µs.

    Thank you

     

  • If you are running the device at 20MHz, then you can run the Flash with 1-wait state. This will give you an effective 97% performance efficiency, so there won't be much difference between Flash and RAM performance.

    Is 20MHz the CPU frequency or the external crystal frequency? Have you multiplied up the internal frequency with PLL?

    An IQmath multiply operation, for example: Y = _IQmpy(M,X) + B should take about 7 cycles (350nSec @20MHz or 70nSec @ 100MHz).

     

  • Hi XELA,

    the CPU frequency is 20 MHz without internal frequency multiplication;

    effectively, I try to run the following code setting 1 flash wait-state.

      a = _IQ15(0.5);
      b = _IQ15(0.42);

      iqVar = _IQ15mpy(a,b);

    and see that the execution time is around 1 µs, very reasonable.

    The problem is in obtaining iq format from integer value (previously casted) and in int to float conversion that it needs around 8 µs, too much for my app.

    The problem is bypassed without using a dedicated routine instead of any float type or IQmath.

    However, thanks a lot for your help.