Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

New Contributor II

Any time before there was a question on the forum: Can I change  the filter constants in runtime ?
My answer is: Yes you can.


Here is a code snippet that complains, how it works.


void LoadFilter (uint8 fltr)// fltr is the pointer to the dedicated parameter block


{ // Put DFB RAM on the bus :


    Filter_RAM_DIR_REG = Filter_RAM_DIR_BUS;


if (fltr == 1)


        cymemcpy(Filter_DB_RAM,Filter100_data_b, Filter_DB_RAM_SIZE);


else if (fltr == 2)


        cymemcpy(Filter_DB_RAM,Filter200_data_b, Filter_DB_RAM_SIZE);


else if (fltr == 3)


        cymemcpy(Filter_DB_RAM,Filter400_data_b, Filter_DB_RAM_SIZE);


else if (fltr == 4)


        cymemcpy(Filter_DB_RAM,FilterTP2800_data_b, Filter_DB_RAM_SIZE);


// Take DFB RAM off the bus :


Filter_RAM_DIR_REG = Filter_RAM_DIR_DFB;






The Filter_data you can compute with the embedded filter wizard. After setting your parameters 


in the Filter Block, build the application an then read out the file Filter:Ram_Data.c :


const uint8 CYCODE Filter_data_b[] = 




    0x14, 0xD0, 0x01, 0x00, 0x28, 0xA0, 0x03, 0x00,...


And if you want to change the filter structure ( FIR --> IIR) you have to exchange in the same way the following matrix:


const uint8 CYCODE Filter_control[] = 




    0x20, 0x13, 0x00, 0x25, 0x61, 0x17, 0x80, 0x26,....


Don't know why all filter coefficients are located in Filter_data_b, even when you use filter stage A... 


Good luck!

3 Replies
Honored Contributor II

 Thank you for information. Can you post sample project  also?



New Contributor II

Only a "big" program is available here, that includes the focused lines. 


Please note: compiles with PSoC Creator 2.2, because I used a CY8CKit-014 with CY5588AXI.060-ES1.


Interesting for the problem are:


main.c      line 723 ...


filters.c     complete


main.h      line 13 ...




Have fun!

Esteemed Contributor

On location of coefficients, from tech support -








1. "Why, when doing a chan a and chan b filter, 64 taps each, does all the filter data show up in Filter_data_b[], none in Filter_data_a[] ?"




The DFB has 2 data RAMs. One of the 2 RAM blocks is used to store the filter co-efficients of both the channels. And the other RAM block is used to store the intermediate data or the incoming samples.


That is the reason why both the channels' co-efficients are stored in the data RAM B.




2. "Why are the arrays, both, defined as 32 coefficients ? Is that due to symmetry of response, so you only need 1/2 the coefficients ?"








3. For the BiQuad also, the data RAM B will hold the co-efficients.




Regards, Dana.