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.

C674x dsplib v1.2 DSPF_sp_fircirc wrong result

Hello,

I'm using DSPF_sp_fircirc function for a simple low-pass filtering. Function parameters are set as follows:

x: Pointer to circular input array with 2048 elements with no zero padding.

h: Pointer to coefficient array with 32 elements given in reverse order and double word aligned

y: Pointer to output array with 2048 element.

index : Index of starting value for input array set to 0.

csize: Exponent of circular input array size is set to 10 because input array contains 2^{10+1}=2048 elements.

nh: The number of elements in coefficient array is set to 32, an even number and greater than 4.

ny: Number of elements in output array is set  to 2048 that is divisible by 4 and greater than 0.

 

Waveforms observed after executing the function are the next ones (first: input, second: output)

Clearly, output signal does not match with expected filtered signal. What's wrong with this implementation?

Thanks in advance,

Gaston

  • It seems that wiki documentation is not correct when define csize as number of elements insted number of bytes.

    Could anyone confirm this?

    regards,

    gaston

  • Gaston,

    You're correct; there's an error in the documentation and demo application for DSPF_sp_fircirc.  The parameter csize should be set such that 2^(csize + 1) is the size in bytes of the circular input buffer.  This means that the input buffer will have 2^(csize + 1) / 4 or 2^(csize - 1)elements.  With this in mind, csize should be set to 12 for a circular input buffer with 2048 elements.

    In the demo app for this kernel, the circular input buffer is defined as:

    float ptr_x[1 << (NC + 1)];

    Where NC is the value used for csize.  This definition should be changed to look like this:

    float ptr_x[1 << (NC - 1)];

    There are a few other places in DSPF_sp_fircirc_d.c where this change must be made.  (Note that the circular input buffer should still be aligned to 1 << (NC + 1).)

    I'll make a note of this in the online documentation, and we'll update the demo app in the next release of the DSPLIB.  Thanks for bringing this to our attention.