- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can Change Filter Co-eff During Run Time in PSOC5 LP Filter Block? any Examples
Solved! Go to Solution.
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please checkout one way to do it. A function can be written for the purpose.
NOTE: Using this function requires the filter component to be set up with the same type of filter (biquad or FIR) and number of taps/order as the coefficients being loaded here. */ void Filter_LoadCoefficients(uint8 *pFiltCoeffs, uint16 wSize, uint16 wOffset) { /* This is the externally defined null array we will use to clear out the sample data in RAM */ extern const uint8 CYCODE Filter_data_a[]; /* Power on DFB before initializing the RAMs */ Filter_PM_ACT_CFG_REG |= Filter_PM_ACT_MSK; /* Turn off Run Bit */ Filter_CR_REG &= ~Filter_RUN_MASK; /* Enable the DFB RAMS */ Filter_RAM_EN_REG = Filter_RAM_DIR_BUS; /* Put DFB RAM on the bus */ Filter_RAM_DIR_REG = Filter_RAM_DIR_BUS; /* DAta RAMs */ /* Clear out the RAM which contains the sample values from the previously operating filter */ memcpy(Filter_DA_RAM, Filter_data_a, Filter_DA_RAM_SIZE); /* This one copies wSize bytes of filter coefficients at the specified offset in the data B RAM */ memcpy(Filter_DB_RAM+wOffset, pFiltCoeffs, wSize); /* Take DFB RAM off the bus */ Filter_RAM_DIR_REG = Filter_RAM_DIR_DFB; /* Set up interrupt and DMA events */ // Filter_SetInterruptMode(Filter_INIT_INTERRUPT_MODE); // Filter_SetDMAMode(Filter_INIT_DMA_MODE); /* Clear any pending interrupts */ /* Bits [2..0] of this register are readonly. */ Filter_SR_REG = 0xf8; }
Best Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please checkout one way to do it. A function can be written for the purpose.
NOTE: Using this function requires the filter component to be set up with the same type of filter (biquad or FIR) and number of taps/order as the coefficients being loaded here. */ void Filter_LoadCoefficients(uint8 *pFiltCoeffs, uint16 wSize, uint16 wOffset) { /* This is the externally defined null array we will use to clear out the sample data in RAM */ extern const uint8 CYCODE Filter_data_a[]; /* Power on DFB before initializing the RAMs */ Filter_PM_ACT_CFG_REG |= Filter_PM_ACT_MSK; /* Turn off Run Bit */ Filter_CR_REG &= ~Filter_RUN_MASK; /* Enable the DFB RAMS */ Filter_RAM_EN_REG = Filter_RAM_DIR_BUS; /* Put DFB RAM on the bus */ Filter_RAM_DIR_REG = Filter_RAM_DIR_BUS; /* DAta RAMs */ /* Clear out the RAM which contains the sample values from the previously operating filter */ memcpy(Filter_DA_RAM, Filter_data_a, Filter_DA_RAM_SIZE); /* This one copies wSize bytes of filter coefficients at the specified offset in the data B RAM */ memcpy(Filter_DB_RAM+wOffset, pFiltCoeffs, wSize); /* Take DFB RAM off the bus */ Filter_RAM_DIR_REG = Filter_RAM_DIR_DFB; /* Set up interrupt and DMA events */ // Filter_SetInterruptMode(Filter_INIT_INTERRUPT_MODE); // Filter_SetDMAMode(Filter_INIT_DMA_MODE); /* Clear any pending interrupts */ /* Bits [2..0] of this register are readonly. */ Filter_SR_REG = 0xf8; }
Best Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My Co-eff are as follows
Final coefficients for Biquad filter :
Coefficients are in the order A0, A1, A2, B1 and B2
0.24254298210144
-0.485085725784302
0.24254298210144
-1.93959474563599
0.941091299057007
0.966162204742432
-1.93232417106628
0.966162204742432
-1.93157911300659
0.933069467544556
0.963419437408447
-1.92683911323547
0.963419437408447
-1.92609620094299
0.927582025527954
0.962027311325073
-1.92405486106873
0.962027311325073
-1.92331290245056
0.92479681968689
0.975322961807251
-1.9506459236145
0.975322961807251
-1.94989371299744
0.951398134231567
0.981450796127319
-1.96290183067322
0.981450796127319
-1.96214485168457
0.963658571243286
0.988350868225098
-1.97670149803162
0.988350868225098
-1.97593927383423
0.977463722229004
1.99156522750854
-3.98313045501709
1.99156522750854
-1.99079728126526
How can i use that one? what is Offset Value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
seku,
Are you talking about the Digital Filter Block (DFB) or the analog Low-pass filters (LPF)?
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im just glad to see that someone is using the DFB...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i Need Both example with Dynamic Loading or changing Filter Co-eff