Filtering a signal

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Project: ADC => DMA => Filter => DMA => DAC

   

The input is provided as a DTMF waveform signal. The amplitude is in range 0.2 ..2.2 V.

   

The problem is with output signal.  The waveform is rectangular(should be as a sine). It looks like the DAC is in saturation mode.

   

Thanks.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Sounds a bit like DAC is 4.080V but power is set to 3.3V.

   

Or can it be that you get the wrong byte from the filter?

   

 

   

Bob

View solution in original post

0 Likes
7 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Sounds a bit like DAC is 4.080V but power is set to 3.3V.

   

Or can it be that you get the wrong byte from the filter?

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 I've tried DAC's range 4.080V and 1.020V the result is the same.

   


 

   

"Or can it be that you get the wrong byte from the filter?"

   

How can I check it?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Have a look into the datasheet, use the table on pg 21. I'm not experienced with that, but would use the 8-bit entry in the table.

   

Bob

lock attach
Attachments are accessible only for community members.
KishoreS_96
Employee
Employee
5 sign-ins 50 replies posted 25 replies posted

Hi.

   

 

   

From your project file, I understand that you are using Band Pass filter. In that case, we can't use DMA directly to move the output data from Filter's Holding register to DAC's data register.

   

As the ADC is operating between 0-Vdda, its output will have a DC component @ Vdda/2. In the Band pass filter, this DC component will be removed. So the output will be in signed format. But DAC accepts only unsigned numbers. So you need to add an offset of 128 (2^8/2 + 1 for 8 bit DAC) manually before passing the filter output to DAC.

   

You can add this offset in an ISR connected to the Interrupt pin of Filter component.

   

Note: The same method of adding offset is applicable to HPF as well because HPF also removes the DC component.

   

I've herewith attached a sample project for HPF where I'm explaining how to add the offset manually to the output of Filter. Look at this. This should help you.

   

 

   

Regards,

   

Kishore.

Anonymous
Not applicable

 Hi,kiku!

   

   

You are absolutely right!!! Filter and DMA are working correctly only in "Low Pass Mode". For Band Pass and High pass we need to use "interrupt request".

   

I've used your example in my project and now my Band Pass Filter works properly.

   

 

   

And  I have one question more: Could I transfer signal from one ADC to Filter's Channel_A and Filter's Channel_B simultaneously with ISR? (I don't want to use two ADC. Iis it possible?)

   

Thanks.

   

zaq

0 Likes
KishoreS_96
Employee
Employee
5 sign-ins 50 replies posted 25 replies posted

Hi Zaq,

   

 

   

Yes it is possible. Use the below code:

   

 

   

CY_ISR(adc_ISR)
{

   

    int8 adcResult;

   

    adcResult = ADC_SAR_GetResult8();

   

    Filter_Write8(Filter_CHANNEL_A, adcResult);

   

    Filter_Write8(Filter_CHANNEL_B, adcResult);
}

   

 

   

Regards,

   

Kishore.

Anonymous
Not applicable
0 Likes