Figure 48. Filtering Example 2 - ST STM32G4 Series Reference Manual

Advanced arm-based 32-bit mcus
Hide thumbs Also See for STM32G4 Series:
Table of Contents

Advertisement

Filter Math Accelerator (FMAC)
filter length is small and the processor relatively slow, in this example. So increasing the Y
buffer size would not help.
FMAC_PARAM
Software register
register write:
FUNC = 8 (FIR Filter)
access
P = 6
START = 1
START
X1_BASE
X1_BASE + 0x1
X1_BASE + 0x2
X1 buffer
X1_BUF_SIZE = 6
X1_BASE + 0x3
X1_BASE + 0x4
X1_BASE + 0x5
X1_FULL
Interrupt
Not enough samples in input buffer
MAC activity
Y_BASE
Y buffer
Y_BUF_SIZE = 2
Y_BASE + 0x1
Y_EMPTY
The example in
the filter has six taps (P=6). The X1 buffer size is six and the Y buffer size is two. The
FULL_WM and EMPTY_WM fields are both set to 0. Prior to starting the filter, the X1 buffer
has been pre-loaded with four samples, x[0:3] as in
enough samples in the input buffer, the X1FULL flag is not set, so the interrupt is asserted
straight away, to request new data. The FMAC is stalled.
The processor writes two new samples, x[4] and x[5], to the FMAC_WDATA register, which
are transferred to the empty locations in the X1 buffer. As soon as there are six unused
samples in the X1 buffer, the X1_FULL flag goes active (since the buffer size is six), causing
the interrupt to go inactive. The FMAC starts calculating the first output sample, y[0]. Since
this requires all six input samples, there are no free spaces in the X1 buffer and so the
X1_FULL flag remains active. Only when the FMAC finishes calculating y[0] and writes it
into the Y buffer, can x[0] be discarded, freeing up a space in the X1 buffer, and de-asserting
X1_FULL. At the same time, the Y_EMPTY flag goes inactive. Both these flag states cause
the interrupt to be asserted, requesting the processor to write a new input sample, first of all,
and then read the output sample just calculated. The FMAC remains stalled until a new
input sample is written.
In this example, the processor has to wait for the FMAC to finish calculating the current
output sample, before it can write a new input sample, and therefore the X1 buffer regularly
goes empty, stalling the FMAC. This can be avoided by allowing some extra space in the
input buffer.
464/2083

Figure 48. Filtering example 2

FMAC_WDATA
register write:
WDATA = x[4]
FMAC_WDATA
register write:
WDATA = x[5]
x[0]
x[1]
XX
XX
No more space in X1 buffer
Stalled
Calculate y[0] using x[0:5]
XX
XX
Figure 48
illustrates the beginning of the same filter operation, but this time
RM0440 Rev 1
FMAC_RDATA
register read:
RDATA = y[0]
FMAC_WDATA
FMAC_WDATA
register write:
register write:
WDATA = x[6]
WDATA = x[7]
Spare
Spare
x[2]
x[3]
x[4]
x[5]
Stalled
Calculate y[1] using x[1:6]
Stalled
y[0]
Figure
46. Because there are not
RM0440
FMAC_RDATA
register read:
RDATA = y[1]
FMAC_WDATA
register write:
WDATA = x[8]
x[6]
x[7]
Spare
x[8]
Calculate y[2] using x[2:7]
Stalled
Calculate
Spare
y[2]
y[1]
Spare
MSv47130V1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32G4 Series and is the answer not in the manual?

Table of Contents

Save PDF