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.

dma interrupt is delayed

Other Parts Discussed in Thread: SYSBIOS, MATHLIB

Hello,

I am using code composer V5.2, sysbios 6.33 on c6748 target

My dsp acquire samples via EDMA, and interrupt every 256 samples

All is working well, but if I use function sqrt_v from FastMath, dma interrupt is delayed and this causes loss of samples ...

This is very strange to me ...

Code that influence dma interrupt is :

float pSigIn[102401];

float pSigOut[102401];

void test_sqrtsp_v(void) {

int n = 102401;

for (int i = 0; i < 102401; i++)

    pSigIn[i] = 2.0;

sqrtsp_v(pSigIn, pSigOut, n);

}

Does anyone have an explanation for that ?

thank you

  • Hi Didier,

    Thanks for your post.

    There might be several reasons for the slow execution of C67x fastmath library function and there are suggestions, you can try as below:

    1. I shall suggest you to enable profile clock option in CCS to optimize the code for faster execution of fastmath library functions.

    2. Check for any memory related stalls or other instruction related stalls? Check for also the number of clock cycle counts it consumes for the single instruction sqrtsp_v and validate with any benchmarked execution speef if any available?

    3. There may be additional optimizations you can do with #pragmas and compiler switches, you can use all local variables / stack variables / internal memory, too

    4. If you need to improve your performance, SYS/BIOS has built-in benchmarking support to help you profile your system to see where the most processing time is being used. With this information, you can figure out which portion of the application needs to be improved. Perhaps C code optimization or compiler optimization is needed to get the high-CPU-usage functions to run faster; perhaps the task or swi architecture needs to be combined in some way to minimize context switching

    5. In order to achieve minimum execution time I think that you will also need to use direct interrupt control rather than using SYS/BIOS,  please refer the below thread to use interrupt without SysBIOS

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/163492.aspx

    6. Also, check your linker command file to ensure all code sections are mapped to use L1 P and L1D memory instead of using cache.

    In addition to the above suggestions, you should also check for dependancies in the MATHLIB release notes (~\mathlib_c674x_3_0_1_1\packages\ti\mathlib\mathlib_3_0_1_1_release_notes.html) & tools versions to successfully function

    • XDC Tools version 3.20.05.76
    • CCSV4

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

     

     

  • Hello

    Thank you for your answer, but there may be a misunderstanding

    I did not complain about execution time of sqrtsp_v

    I use a hardware interrupt on EVENT number 8. This interrupt occurs every 5 ms to acquire samples in memory.

    In another task, with very low priority, I do some computation.

    If I use sqrtsp_v (in this low priority task), I see that during execution of sqrtsp_v, interrupt from DMA (EVENT 8) is disturbed : sometime, I measure 8 ms between 2 interrupts ...

    If I use a loop with 101401 calls to sqrtsp, interrupt from dma is not disturbed.

    Execution time of sqrtsp_v is about 20 ms

    Execution time of 101401 calls to sqrtsp is about 40 ms

    But I do not understand why interrupt is disturbed by sqrtsp_v, it should not ...

  • Hello,

    Finally, I increased dma buffer to increase time between dma interrupts

    If interrupts period is more than 20 ms, interrupt is not delayed and I have no samples loss

    Maybe my application has too many system calls that masks interrupts ? I have not other explanation for that.

    Thank you

  • Didier,

    From a quick look at the sqrtsp_v function, it appears to be implemented as a tight for-loop of calls to sqrtsp_i, which probably means _i for inlined. It is not obvious why this would be masking interrupts for the entire call to sqrtsp_v. But that is the most likely reason for the interrupt being delayed so much.

    Since using the _v function is when the problem occurs, it does seem most likely that it is the place where interrupts are disabled. You could try reducing the count value until you find a value that does not cause a problem, then compare the expected and measured time to run that reduced sqrtsp_v with the time between EDMA interrupts.

    My recommendation would be to divide the call to sqrtsp_v into a for-loop of 10 (for example) calls to sqrtsp_v handling only 1/10th of the full vector length. My suspicion is that interrupts will be re-enabled between calls to sqrtsp_v, so they should only be masked for 2ms instead of 20ms. The execution time should be pretty close to 20ms, still.

    Regards,
    RandyP

  • Hello,

    Yes, delayed interrupt disappears if size of calculation is reduced.

    But maybe I have another explanation for my troubles : my application has many maiboxes, and after further analysis, it seems that during some calculations (sqrtsp_v for example), many messages are buffered.

    At the end of calculation, many messages can be unbuffered quickly, and this causes many system calls. Delayed interrupt seems to appear during that.

    I read somewhere (but I don't remember where) that interrupts can be masked during mailboxes calls, but depending on some sysbios parameter, is that right ?

    I would like to be more precise, I am sorry for that ...

    Regards,

  • Didier,

    If your question is now specific to BIOS, then you may want to post the question onto the BIOS forum for the best support. They might be able to help from "read somwhere" than I can.

    Once you get your answer there, please post that answer or a link to that thread on this thread so we will know it is closed.

    Regards,
    RandyP