Filter Math Accelerator (FMAC)
The Y buffer can also operate as a circular buffer. If the address for the next output value is
the same as that indicated by the read pointer (ie. an unread sample), then the buffer is
flagged as full and execution stalled until the sample is read.
In the case of IIR filters, the Y buffer is used to store the set of M previous output samples,
y[n-M] to y[n-1], used for calculating the next output sample y[n]. Each time a new sample is
added to the set, the least recent sample y[n-M] drops out.
If the number of unread data in the buffer is less than the watermark threshold programmed
in the EMPTY_WM field of the FMAC_YBUFCFG register, the buffer is flagged as empty. As
long as the empty flag is not set, interrupts or DMA requests will be generated, if enabled, to
request reads from the buffer. The watermark allows several data to be transferred under
one interrupt, without danger of underflow. Nevertheless, if an underflow does occur, the
UNFL error flag is set. In this case, the read pointer will not be incremented and the read
operation will return the content of the memory at the read pointer address.
The operation of the Y buffer in circular mode is illustrated in
a 7-tap IIR filter with a watermark set to four.
452/2083
Figure 42. Circular output buffer
y_base
Read pointer
y[n-M-4]
y[n-M-3]
y[n-M-2]
y[n-M-1]
Next sample
RM0440 Rev 1
Available buffer space
These samples not yet read
y[n-M]
y[n-6]
These samples in use
y[n-5]
for calculating y[n]
y[n-4]
y[n-3]
y[n-2]
y[n-1]
y[n]
Available buffer space
Figure
43. This example shows
RM0440
MSv45873V1
Need help?
Do you have a question about the STM32G4 Series and is the answer not in the manual?
Questions and answers