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.

[C6713] DSPF_sp_fir_gen causes runtime error

When using the following line of code in my program (on a DSK6713 board), it crashes after a just a few minutes:

DSPF_sp_fir_gen(in, H, &out[LENH-1], LENH, bufferSize+bufferOverlap-LENH+1);

The filter coefficients H and LENH are defined as follows:

#pragma DATA_ALIGN(H,8);  // aligns H to a double-word (8 byte)
const Float H[] = {-0.0634641714188635 , 0.593677714458985 , 0.530933189234723 , -0.0611467322748454};
const Uns LENH = 4;

And the in and out buffers are allocated like this:

in = (Ptr)MEM_calloc(0, (bufferSize+bufferOverlap)*4, 8);
out = (Ptr)MEM_calloc(0, (bufferSize+bufferOverlap)*4, 8);

So in, H, and even out are double-word aligned and also the other requirements for DSPF_sp_fir_gen are fulfilled.

After program crash, when I try to halt the processor, the emulator gives the following error message and I have to restart everything:

Trouble Halting Target CPU:
Error 0x80000020/-1070
Fatal Error during: Execution,
An unknown error prevented the emulator from accessing the processor in a timely fashion.

What am I doing wrong? Any ideas?

Kind regards

Robert

  • Robert, Sorry for the trouble! Let me suggest some quick debug steps:

    - Try disabling interrupts across the DSPF_sp_fir_gen call. You can do it using the HWI_disable/HWI_restore BIOS APIs. If that fixes the issue, it would imply the ASM kernel is not interrupt tolerant

    - Try using the C version of the kernel. If that doesn't show any issue, it would imply a bug in the ASM code.

    If the issue persists even after trying the above two, we will need to look closer at how you are using the API

    Gagan

  • Gagan, Thank you for the suggestions.

    I will try them and report the results here.

    Regarding the C version of the code:
    In my oppinion, there is a little error in the listing on page 4-40 of SPRU657B. The outer loop should run from j=0 to j=nr-1 and the inner loop should run from i=0 to i=nh-1. So nr and nh are interchanged. Otherwise h[ i] in the inner loop will access a location outside h. Is the ASM code also implemented like this?

    So as a third step I will try to call the function with interchanged arguments...

    Robert

  • Disabling the interrupts seems to be the solution!

    Up to now the program has been running for more than 1.5 hours without a problem.

    But doesn't "interrupt-tolerant but not interruptible" mean that the function disables the interrupts by itself? Is it a bug in DSPF_sp_fir_gen?

    Thank you very much for your help!

    Robert

  • Robert, If disabling interrupt across the kernel avoids the issue, I would count this as a bug in the kernel. I'm assuming for now the interrupt disable workaround is acceptable to you. We'll debug the code and update to fix the issue.

    Gagan

  • Even latest library files from TI site, have this issue. Please correct it in ASM or give a mention of this in the user guide.

    Surprisingly, this issue is not there with other library functions such as FFT.

    Also, please change the C equilant for the functin DSPF_sp_fir_gen (page 4-40) in the user guide. There is an error in that code. nh and nr are interchanged.

  • Yes, 67x DSPLIB has this bug. The latest DSPLIB for 674x has this resolved: http://tiexpressdsp.com/index.php?title=C674x_DSPLIB

    Gagan

  • Please note that the 674x DSPLIB is built for the newer 674x DSP core (i.e. C674x and OMAP-L1x parts).  You can use the new library with older parts only if you rebuild it for the older 671x platform.  To do that:

    1. Open the dsplib674x.pjt project file in CCS
    2. Remove the source files DSPF_sp_fftSPxSP.asm and DSPF_sp_ifftSPxSP.asm from the project (these updated functions can't work with an older core)
    3. Go to the Project->Build Options screen
    4. Select "C671x" in the Target Version drop-down box under the Compiler tab
    5. Rebuild the project

    Rebuilding the new source for an older platform may hurt performance.  Also, the code will not be interruptible (but it's still interrupt tolerant).

  • I have downloaded DSPLIB  (c674x) Release 3.1.0.0.

    In user guide documentation i find remark for DSPF_sp_fftSPXSP function:

    Implementation Notes:

    Interruptibility: The code is interrupt-tolerant but not interruptible. 

    What is it means for me?

    Can i use this routine in the background and simultaneously service interrupts from mcASP for capturing new data, for example?

    Thanks