- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I use FIR compiler v8.1 to generate a band pass filter 50hz Configuration : - Input Data unsigned width : 8 bits - I use a coef file generated by Matlab - coefficients scaling : Auto ... Bit Width : 8 --- Quote Start --- -0.03758602 -0.04600525 -0.05416903 -0.05998012 -0.05842221 -0.04470215 -0.01824851 0.01576782 0.04887938 0.07399496 0.08870862 0.09481480 0.09481480 0.08870862 0.07399496 0.04887938 0.01576782 -0.01824851 -0.04470215 -0.05842221 -0.05998012 -0.05416903 -0.04600525 -0.03758602 --- Quote End --- and I try to undestand why i have a signed data out ( see image ) fir data in/out (http://img190.imageshack.us/img190/9161/firbp.jpg)Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your coefficients are signed but your input is declared unsigned. I believe this will cause trouble. You can declare your input as signed adding the sign bit = '0' always and see.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
one more issue.
You should expect that your output will revert back to signed. The reason is your filter doesn't pass dc. if your input is unsigned it implies dc offset which is filtered off.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't use signed data in because it's provided from unsigned FIR LP.
Sorry but I don't understand the relation with DC... In this case, what should i do- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In that case your input is always treated as positive only i.e. there is dc offset in it (dc equals the mean of the signal). You can remove this by subtraction but better leave it and your bandpass filter will remove the mean. Hence your output will be signed and tending to around zero. There is nothing wrong in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok... Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now with signed filter i have this ( image (http://img200.imageshack.us/img200/1601/firbp2.png) )
Why the output signal is discontinuous ?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mean your output gets stuck for many samples on same value before it moves to next...
Can you post your input data and output data values and I will get output data through matlab- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your output doesn't look right.
your input swings between 0 and 243, yet your output is of +160,000 order with repeated close values.It doesn't look you have done any bit truncations. Go to matlab and type: h = < your above coefficients>; x = <your input vector>; now apply filter: y = filter(h,1,x); you should check your results against this as reference I got an initial y values of +80 followed by +4- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the same thing and i don't know how to resolve the problem!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you post your FIR Compiler's generated .vhd/.v or a screen shot of the filter setting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have always the same problem with the bandpass filter output signal
I changed coef more than 20 times.... some one can help me please to design a good bandpass 50hz filter with the fir compiler sample rate 1000hz cutoff freq1 : ~ 20 hz cutoff freq2 : ~ 60 hz or 70 hz number of coef < 30 data in : unsigned width : 8 bits you can use signed input with 9 bits ( sign ='0')- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hayder,
your coefficients(posted at start of this thread) are ok. I checked them in Matlab and your filter does cutoff at .02 and .07 of sampling frequency (passband is 20/1000 to 70/1000). Your problem is not the design of coefficients(that is done). It is in the implementation. You need to check whats going wrong in your FIR compiler settings.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In particular make sure that your input data is at 1000Hz, so is your filter and its output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kaz,
this is my config (http://img36.imageshack.us/img36/3730/firconfig.jpg) with coefficients posted at start of this thread may be the problem come from coefficients scaling....- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't use fir compiler, so hopefully somebody else may help better.
It looks ok to me. Though you can choose other structures e.g multipliers(instead of distributed arithmetic, at least for testing), your coefficient width need not be that high(if you wish you may go lower with little or no effect on filter response). Your output resolution need not be different from that of input. Again make sure your sampling rate is indeed 1000Hz.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Kaz for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm also not using the FIR compiler, but your results look meaningful. Apparently the test signal as well as the output are sampled with the tenfold of the filter sampling rate, most likely because the test case is for the fully serial FIR compiler option, that uses 10 clocks for a sample. The waveform, you previously posted (and asked, why it's discontinous) shows a 50 Hz sine sampled at 1000 Hz, as requested.
The output scaling comes from selecting "Full resolution" for the output numbering system. Full resolution means something like nInputBits + nCoeffBits + log2(nCoeff), in this case it's 20 Bit, as the Megawizard shows for your design. So everything seems to be in normal operation. To my opinion, the filter performance is rather bad, particularly the high frequency attenuation. But it's an obvious result of providing too few coefficients for a fs/fc ratio of 20. There may reasons to use a FIR filter, but I would prefer IIR in this case.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you
yes it's an obligation to use FIR :(
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page