EasyManuals Logo
Home>ST>Microcontrollers>STM32G474

ST STM32G474 User Manual

ST STM32G474
2126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #505 background imageLoading...
Page #505 background image
RM0440 Rev 4 505/2126
RM0440 Filter math accelerator (FMAC)
513
18.3.12 Filter design tips
The FMAC architecture imposes some constraints detailed below, on the design of digital
filters.
1. Implementation of direct form 2, or transposed forms, is not efficient. Filters which have
been designed for such forms should be converted to direct form 1.
2. Cascaded filters must either be combined into a single stage, or implemented as
separate filters. In the latter case, multiple sets of filter coefficients can be pre-loaded
into the memory, one set per stage, and only the X2_BASE address changed to select
which set is used. The most efficient method of implementing a multi-stage filter is to
pre-load a large X1 buffer with input samples, run the IIR filter function on it using the
first stage coefficients, and store the output samples back in memory. Then change the
X2_BASE pointer to point to the 2nd stage coefficients, and reload the input buffer with
the output of the first stage (with a gain if required), before running the IIR function
again. The procedure is repeated for all stages. Once the final stage samples have
been transferred back into system memory, the input buffer can be loaded with the next
set of input samples, and a new round of calculations started. Note that the N sample
input buffer of each stage must be pre-loaded first of all with the N-1 last inputs from the
previous round, plus one new sample, in order to keep continuity between each round.
Similarly, the output buffer of each stage must be loaded with the last M samples from
the previous round, for the same reason.
3. The use of direct form 1 for IIR designs can lead to large positive or negative partial
sums in the accumulator, if for example a large step occurs on the input, or some of the
filter coefficients’ absolute values are >1. Since the accumulator is limited to 26 bits, the
biggest value that it can handle without wrapping (changing sign) is 0x1FFFFFF
positive or 0x2000000 negative. This corresponds to 3.99999988 and -4 respectively in
q3.23 fixed point format. Wrapping does not represent a problem provided the
wrapping is “undone” before the end of the accumulation. However this is not always
the case when a filter is starting up and can lead to unexpected results. Consider pre-
loading the output buffer with suitable values to avoid this.
4. The IIR filter has feed-forward (numerator) coefficients [b
0
, b
1
, ..., b
N-1
], and feed-back
(denominator) coefficients [1, a
1
, ..., a
M
]. Many IIR filters require some of the
denominator coefficients to have an absolute value greater than 1 to achieve a steep
roll-off in the frequency response. Given that the coefficients are coded in fixed point
q1.15 format, this is not possible. Nevertheless, by scaling the denominator coefficients
by a factor 2
-R
, such that 2
-R
.[1, a
1
, ..., a
M
] are all less than 1, such filters can be
implemented. However an inverse gain of 2
R
must be applied at the output of the
accumulator to compensate the scaling. This has an adverse effect on the signal-to-
noise ratio.

Table of Contents

Questions and Answers:

ST STM32G474 Specifications

General IconGeneral
BrandST
ModelSTM32G474
CategoryMicrocontrollers
LanguageEnglish

Related product manuals