3 Replies Latest reply on Oct 23, 2014 10:47 AM by user_14586677

    Using a FIR_Filter off-line

    content.librarian

      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[n]);
                      while (Filter_1_IsInterruptChannelA() == 0) ;
                      ADC_FIR[i] = Filter_1_Read16(Filter_1_CHANNEL_A);
                  }

         

       

         

      But what i've got is a zero-array ADC_FIR[i] = 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

        • 1. Re: Using a FIR_Filter off-line
          content.librarian

          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.

          • 2. Re: Using a FIR_Filter off-line
            content.librarian

            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

            • 3. Re: Using a FIR_Filter off-line
              user_14586677

              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.