Announcements
IMPORTANT: Cypress Developer Community currently doesn’t allow sign-in to prepare for the upcoming transition. To learn more, check out our announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

 Hi!

   

The Filter_SampleProject contains an example for the use of the Filter component. This project works properly. But if I try to change the parameters of the filter it doesn't work.

   

For example: I want to design a Band Pass Filter with band 0.7-0.9 kHz .

   

 

   

In the Filter_SampleProject I've changed parameters:

   

 

   

Sample Rate [ksps]: 22

   

Filter Stages: 1

   

Filter Gain: 3 dB

   

Fiter Class: FIR

   

Filter Tipe : Band pass

   

Window: Rectangular

   

Filter taps: 64

   

Centr: 0.8 kHz

   

Bandwith: 0.2 kHz

   

It doesn't work.

   

 

   

If I guess (but I'm not sure!) the problem is with the Filter coherency. In the Filter_SampleProject this paraneter is : Filter_COHER_REG = 0x55;

   

I've read Filter's Datasheet and Registers TRM but there are any information how to calculate Filter_COHER_REG.

   

Could you help me with this problem, please?

   
        
0 Likes
1 Solution
Bob_Marlowe
Expert II

Hi,

   

it is always much easier for us when we can have a look at *all* your settings. Can you please upload the complete project here?

   

To do so:

   

Build -> Clean Project

   

File -> Create Workspace Bundle(minimal)

   

and then upload the generated .Zip-file here, we'll have a look at it.

   

Bob

View solution in original post

0 Likes
28 Replies
Bob_Marlowe
Expert II

Hi,

   

it is always much easier for us when we can have a look at *all* your settings. Can you please upload the complete project here?

   

To do so:

   

Build -> Clean Project

   

File -> Create Workspace Bundle(minimal)

   

and then upload the generated .Zip-file here, we'll have a look at it.

   

Bob

View solution in original post

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

 This is the project file.

0 Likes
Anonymous
Not applicable

Hi zaq,

   

 

   

If you are unable to upload the project, you can mail it to me at dasg@cypress.com

   

 

   

I'll upload the project here on your behalf.

0 Likes
Anonymous
Not applicable

Regarding the Filter Coherency, refer to the DFB_COHER register below

   

 

   

   

 

   

The DFB Staging register coherency key byte should be set to the byte that is written last. As you said that in your case, the register had the value of 0x55, it means that the key byte is med byte. This means that the last byte which is read should be med byte. If that is not the case, then you need to change the settings accordingly.

Bob_Marlowe
Expert II

dasq, will you please upload the project?

   

Bob

0 Likes
Bob_Marlowe
Expert II

Zaq,

   

did you change the ADC to reflect 22ksps ?

   

And when you really get 3db gain, the 8 bit will not be able to hold the result.

   

Bob

Anonymous
Not applicable

 Bob,

   

I think you are right that I need to change the ADC Conversion Rate from 100000 sps to 22000 sps.

   

Unfortunately I can't check this right now(something happened with my  Development Kit ).

   

Thanks, for this idea,

   

zaq.

0 Likes
Anonymous
Not applicable

Hi All,

   

 

   

I am uploading the project on behalf of zaq.

0 Likes
Bob_Marlowe
Expert II

As I already presumed, the ADC-conversion rate was set to 100,000 sps and has to be adjusted to 22,000 sps.

   

Hopefully nothing to worry with your DVK? Still alife?? Not making strange noises???

   

 

   

Hoping for the best

   

Bob

Anonymous
Not applicable

I found this document on my hard disk. I wonder why cypress removes such good documentation. On Page 7 of this doc you can find info about coherency.

Anonymous
Not applicable

You are right Bob, I have must to adjust the ADC-conversion rate to 22,000 sps. Thanks!

   

Thank you, Sherlock Holmes, for great documentation. Now I'm understand the coherency.

0 Likes
Anonymous
Not applicable

Hi,

   

I am trying to implement the filter_sampleProject using CY8CKIT-003 PSoC® 3 FirstTouch™ Starter Kit. The program calls for the CY8CKIT-001. I kept the entire code the same and made connections to P0_0 & P0_2 on the backside of the board at J2. Output is at the same frequency as input, the its amplitude is attenuated even though frequency is well below cut-off. The output does not go down when I raise the frequency above the cut-off value.

   

I would appreciate the forum members feedback. Do I have to have CY8CKIT-001 to do this?

   

Thanks!

0 Likes
Anonymous
Not applicable

Hi Vasu_Drexel,

   

 

   

You can implement the project on CY8CKIT-003 since the PSoC3 device available is same as the one on CY8CKIT-001.

   

Can you please tell more about the filter you are implementing?

   

It will be easier for us to find out the issue if you upload the project here.

0 Likes
Anonymous
Not applicable

Hi dasg,

   

Thanks for your quick reply. Here's the file.

0 Likes
Anonymous
Not applicable

Any takers on my question please?

   

Thanks.

0 Likes
Bob_Marlowe
Expert II

Hi Vasu,

   

I'd like to help you, but I don't see any QUESTION in this thread from you, can you please be a bit more specific?

   

Anyway I'll have a look at your project...

   

Bob

0 Likes
Bob_Marlowe
Expert II

First of all I'd suggest to remove the LCD-module from your schematic since the Kit-3 doesn't have got one. Remove all references in the main.c-file as well.

   

Your filter is set for a gain of >1 which will lead to disturbances when your input-signal is abaout 90% maximum which is about 0.92V.

   

What is the input-frequency you supply to P0_0 and what is the peak-to-peak Voltage here and at P0_2?

   

Bob

0 Likes
Anonymous
Not applicable

Bob,

   

Thanks for your reply. I removed the LCD & any referces to it in the main.c and still have the same problem.

   

I tried inputs at various levels: 0.5 to 1.0 v (peak to peak) with 1 kHz at P0_0. The output at P0_2 measure about 1/10 in amplitude, but same frequency. If I raise the frequency upto 3 kHz, output faithfully follows - both in terms of amplitude (1/10) and frequency (same). If I go below 500-600 Hz, output value starts to diminish faster. Since the cut-off frequency is set for 1 kHz & filter gain set for 0 dB, I was expecting same output below 1 kHz and  diminished output aove 1kHz. Any thoughts on what is wrong?

   

I am appending the zipped file. This has the LCD & references to it removed.

   

Thanks for your help.

   

-Vasu

0 Likes
Anonymous
Not applicable

Hello Vasu,

   

 

   

I have used a WaveDac component in the project to give a sine wave of 1Vpp to ADC input. I got the same 1Vpp in the output of VDAC.

   

 

   

You had set the Filter window to Rectangular. It was giving 0.96dBV in the passband instead of 0V. So the output was getting clipped when I gave 1.024Vpp input. You can use Hamming window which will give about -0.52dBV output in the passband in order to avoid output getting clipped.

   


Regards,

   

Kishore.

0 Likes
Bob_Marlowe
Expert II

Vasu, I cannot open your corrected project due to some renaming or illegal path names. No matter because I've got your old design (with LCD).

   

 

   

The behaveour of the filter as you described is quite as I would expect. Have a look at the plot the filter-wizard gave you.

   

I would suggest to reduce the sample rate to 10sps which will give much better results.

   

Bob

0 Likes
Anonymous
Not applicable

Bob,

   

Thanks for your reply. I am posting my code again. I am having similar problems in illegal path name issue for the file provided by another contributor Kishore who chose to use WaveDAC for input. I changed the sampling rate to 10 ksps as recommended by you (i didn't see "k" in your post and thought it was a type as software warns against 10 sps), but still did not see any change. To make myself clear, following are the steps I am doing:

   
        
  • Connect the PSoC 3 thru USB (9V battery is still atached)
  •     
  • Build and program the board
  •     
  • Disconnect the USB cable; Cycle the power by removing the 9V battery and connecting it back.
  •     
  • Connect sine wave input from generator 500 mV (peak to peak) and 800 kHz frequency (cut-off is 1kHz)  to P0_0. Connect oscilloscope to P0_0 for input & P0_2 for output.
  •     
  • I see the correct waveform at input; Output shows a noisy sine wave with amplitude of 50-100 mV at same frequency. Since my input was lower than cut-off, I was expecting the output to be very close to input in amplitude. As I reduce the frequency, the output voltage drops even further and becomes bare noise at <300 Hz. So when I saw your reply that the results what I see is what you expect, I wasn't sure about that. Can you please elaborate?
  •     
  • If I increase the frequency above 1 kHz to even 3 to 4 kHz level, output does not drop though this is a low pass filter. The amplitute in fact rises slightly, but it is still less than 1/5th of input.
  •     
  • I tried filter gains of 0, 3, -3 dB and window to Rectangular or Hamming. Result was almost the same.
  •    
   

Apparently I am doing something wrong. Any thoughts??  I have not changed any settings on the PSoC 3 starter kit.

   

Thanks!

   

Note: To add to my woes, the board is now not being recognized by the PC though the USB is connected. I can't get to program it after I went thru re-programming bunch of times for changing the filter gain. Re-installation of software has not helped. I am still trying to figure out that part.

0 Likes
Anonymous
Not applicable

Hi Kishore,

   

Thanks for your reply. So far I could not use the file you loaded due to some illegal path name errors. I changed the window from Rectangular to Hamming on the original code, but it still did not help. When I did this change, I saw that the gain still remained at 0 dB. I tried changing that to -0.52dB as well with no luck. I have provided information on how I am testing this program. Would appreciate your feedback.

   

-Vasu

0 Likes
KishoreS_96
Employee

Hi,

   

 

   

Please go through this KB article for solving the naming issue - http://www.cypress.com/?id=4&rID=58729.

   

 

   

After renaming your .cywrk file to "Filter_SampleProject.cywrk" and the top folder to "Filter_Sample Project", it should work.

   

 

   

Regards,

   

Kishore.

0 Likes
KishoreS_96
Employee

Hi Vasu,

   

 

   

One small correctio in my last post.

   

 

   

After renaming your .cywrk file to "Filter_SampleProject.cywrk" and the top folder to "Filter_Sample Project.cydsn", it should work.

   

 

   

Regards,

   

Kishore.

0 Likes
Bob_Marlowe
Expert II

Hi Vasu,

   

you wrote

   

"Connect sine wave input from generator 500 mV (peak to peak) and 800 kHz frequency (cut-off is 1kHz)"

   

so you are pretty good BEHIND your cut-off point, except there is another error with the "k"s

   

I could verify in your former project post, that your cut-off was indeed set to 1kHz, but you used 100ksps with 128 taps for the filter which will not match so well. When in filter-wizard, set sample-rate to 100ksps (do not forget to hit return) and then back to 10ksps and watch the diagram showing the differences!

   

There is no need to run your Kit (obviously a FirstTouch) with batt power, it can be powered via your USB-connection.

   

There is much more with the USB: You get the ability to debug your program with breakpoints and watching variables. Since (now) your program is rather small you do not need that yet, but with increasing complexity the need for debugging will rise, so get experienced.

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        Hi Kishore, Thanks for the reply. I got the file. Bob, Thanks for your inputs as well. You're right, 800 kHz was a typo. It should have been 800 Hz. I decided not pursue with the PSoC 3 first touch as it just wouldn't work. Now I am on the CY8CKIT-001 kit and been able to see filter results. The response plot on the wizard looks great when you switch to 10 ksps, but in reality the results are not as good, even with 50 ksps. 75-80 appear to be better so far. I am working on High pass and the output waveforms are all distorted. Any clues from forum members on band pass/reject/high pass? I will be trying out band pass based on the previous discussions. Thanks!   
0 Likes
Bob_Marlowe
Expert II

With this configuration you'll run into problems with a band- or highpass filter: They will remove any DC parts thus delivering as the result of the filter a SIGNED value. Unfortunately you cannot feed that into a DAC directly because its input is an UNSIGNED value. You'll see distortiond over and over!

   

Solution? I do not know if it is possible to buffer the filter-results in memory and on an end-of-DMA run over them adding a constant (128) and then starting the DMA to the DAC. Suppose you'll need double buffering at least.

   

 

   

Bob

0 Likes