Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi,

   

i would like to off-line-filter a sampled array using a FIR-filter, for this i worte a simple code:

   

Filter_1_Start();
    // Enable the interrupt register bit to poll
    // Value 1 for Channel A, Value 2 for Channel B
    Filter_1_INT_CTRL_REG |= (1 << Filter_1_CHANNEL_A);

   

for(n=0; n < N_s; n++)
            {
                Filter_1_Write16(Filter_1_CHANNEL_A, ADC_res);
                while (Filter_1_IsInterruptChannelA() == 0) ;
                ADC_FIR = Filter_1_Read16(Filter_1_CHANNEL_A);
            }

   

 

   

But what i've got is a zero-array ADC_FIR = 0

   

anyone any idea why?

   

 

   

thanks in advance

   

Hosam

   

Ps. i attached the Project, see below

   

the problem is a task in a bigger project, i hoppe, the description is clear enough

0 Likes
3 Replies
Anonymous
Not applicable

I would declare these as volatile as they are used in an interrupt

   

routine -

   

 

   

extern int16 ADC_res[128];
extern int16 ADC_FIR[128];
extern uint16  i;

   

 

   

    

   

          http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword    Volatile

   

 

   

Insofar as output array being 0, one can assume your input signal was

   

in the passband ? You have confirmed input array from SAR looks right ?

   

 

   

Lastly the SAR is set up 800K SPS. That might be a tad too fast

   

to guarentee that your polling gets the sample before its overwritten

   

by the DFB. Maybe a DMA approach might make more sense.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi,

   

thanks Dana fro your hin

   

i checked the ADC_res[128], the values of the SAR are as axpected and the signal IS in the passband(Signal freq. 90 KHz)

   

so it should work but it dosen't

   

i thik it could be the configuration of the filter, but i didn't find it out

   

Regards

   

Hosam

0 Likes
ETRO_SSN583
Esteemed Contributor

Hosam, I am at a loss for error, consider posting a CASE and if

   

you have time post the results back here, I am curious as to what

   

the issue is -

   

 

   

    

   

          

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes