Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

Simulink IIR Bandpass filter on DE2

Altera_Forum
Honored Contributor II
1,925 Views

I made a filter with matlab simulink and used one of its tools to create vhdl code out of it. I implemented it on an FPGA and it gives me reasonable output except that the frequencies that it pass are not the frequency I designed it to pass. When testing in matlab, a FFT of the output from the filter gives a single peak at 82Hz, but the filter on the board passes 56Hz as well at 170Hz. Any idea what would cause this? Thanks for the help.

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,075 Views

The question doesn't seem particularly related to Altera FPGA or tools, but did you set the correct clock frequency when creating the filter?

0 Kudos
Altera_Forum
Honored Contributor II
1,075 Views

I'm sorry to have been vague. I am implementing this filter on a Cyclone II DE2. I'm feeding data in from the audio codec. I'm using the ADCLRC clock. Would that be correct or incorrect?

0 Kudos
Altera_Forum
Honored Contributor II
1,075 Views

ADCLRC seems reasoanable as a filter sampling clock. The results seem to indicate, that the actual clock frequency is different from calculated value. 

 

The said 170 Hz looks like a 3rd harmonic, either caused by a distorted signal source, ADC overload or filter truncation errors (You didn't tell about relative amplitudes or the filter word length).
0 Kudos
Altera_Forum
Honored Contributor II
1,075 Views

Would my vhdl code be at all useful? It was created automatically by Matlab Simulink. I attached the .vhd file. I hope that works.

0 Kudos
Altera_Forum
Honored Contributor II
1,075 Views

I wonder, which filter specification is represented by the VHDL code. The coefficients look strange.

0 Kudos
Altera_Forum
Honored Contributor II
1,075 Views

Alright, I'm sorry to dissapear and reappear with such a change in problem but... 

 

I realized part of my problem is that I'm not converting the bitstream out of the codec into parallel quite correctly. Also, I can't quite seem to turn off bypass mode. In fact, I compiled and ran a project provided by altera and it lists that it's not in bypass mode, but it seems to still be bypassing. Does anyone have any insight on this? 

 

I am including the project zipped up as an attachment.
0 Kudos
Reply