RM0440 Rev 4 491/2126
RM0440 Filter math accelerator (FMAC)
513
Note: If the flow of samples is controlled by a timer or other peripheral such as an ADC, the buffer
regularly goes empty, since the filter processes each new sample faster than the source can
provide it. This is an essential feature of filter operation.
If the number of free spaces in the buffer is less than the watermark threshold programmed
in the FULL_WM bitfield of the FMAC_X1BUFCFG register, the buffer is flagged as full. As
long as the full flag is not set, interrupts are generated, if enabled, to request more data for
the buffer. The watermark allows several data to be transferred under one interrupt, without
danger of overflow. Nevertheless, if an overflow does occur, the OVFL error flag is set and
the write data is ignored. The write pointer is not incremented in the event of an overflow.
The operation of the X1 buffer during a filtering operation is illustrated in Figure 44. This
example shows an 8-tap FIR filter with a watermark set to four.
Figure 44. Circular input buffer operation
18.3.4 Output buffer
The Y (output) buffer is used to store the output of an accumulation. Each new output value
is stored in the buffer until it is read by the processor or DMA controller. Each time a read
access is made to the read data register, the read data is fetched from the address indicated
by the read pointer. This pointer is incremented after each read, and wraps back to the base
address when it reaches the end of the allocated Y buffer space.
x[n]
x[n+1]
Write pointer
x[n-1]
x[n-2]
x[n-3]
x[n-4]
x[n-5]
x[n-6]
x[n-7]
x[n]
x[n-1]
x[n-2]
x[n-3]
x[n-4]
x[n-5]
x[n-6]
x[n-7]
x[n]
x[n+1]
x[n-1]
x[n-2]
x[n-3]
x[n-4]
x[n-5]
x[n-6]
x[n-7]
x[n+2]
Write pointer
Write pointer
Filter using eight
samples x[n-7] to x[n]
Filter finishes current output
sample and starts using
next sample in buffer
freeing up a space, since
oldest sample is no longer
needed.
No new samples available,
so buffer empty flag is set.
x[n+3]
x[n+4]
Four new samples written
into buffer. Write pointer is
incremented by 4. If write
pointer reaches the end of
the buffer space it wraps to
the beginning. Number of
free spaces left in buffer is
less than watermark, so
buffer full flag is set.
x[n]
x[n-1]
x[n-2]
x[n-3]
x[n-4]
x[n-5]
x[n-6]
x[n-7]
Write pointer
Buffer empty flag is reset,
so filter continues with
next sample
x[n+1]
x[n+2]
x[n+3]
MSv45871V1