46. Audio digital filter (ADF)

46.1 Introduction

The audio digital filter (ADF) is a high-performance module dedicated to the connection of external sigma-delta (ΣΔ) modulators. It is mainly targeted for the following applications:

The ADF features one digital serial interface (SITF0) and one digital filter (DFLT0) with flexible digital processing options in order to offer up to 24-bit final resolution.

The ADF serial interface supports several standards allowing the connection of various ΣΔ modulator sensors:

The ADF converts an input data stream into clean decimated digital data words. This conversion is done thanks to low-pass digital filters and decimation blocks. In addition, it is possible to insert a high-pass filter.

The conversion speed and resolution are adjustable according to configurable parameters for digital processing: filter bypass, filter order, decimation ratio. The maximum output data resolution is up to 24 bits. There are two conversion modes: single conversion and continuous modes. The data can be automatically stored in a system RAM buffer through DMA, thus reducing the software overhead.

A sound activity detector (SAD) is available for the detection of sounds or voice signals. The SAD is connected at the output of the DFLT0. Several parameters can be programmed in order to adjust properly the SAD to the sound environment. The SAD strongly reduces the power consumption by preventing the storage of samples into the system memory, as long as the observed signal does not match the programmed criteria.

The digital processing is performed using only the kernel clock. The ADF requests the bus interface clock (AHB clock) only when data must be transferred or when a specific event requests the attention of the system processor.

46.2 ADF main features

46.3 ADF implementation

Table 411. ADF features (1)

Mode or featureADF1
Number of filters (DFLTx) and serial interfaces (SITFx)1
ADF_CKI0 connected to pins-
Sound activity detection (SAD)X
RXFIFO depth (number of 24-bit words)4
Number of trigger inputs1
ADC connected to ADCITF1-
ADC connected to ADCITF2-
Motor dedicated features (SCD, OLD, OEC, INT, snapshot, break)-
Main path with CIC4, CIC5X
Main path with CIC1,2, 3 or FastSinc-
RSFLT, HPF, SAT, SCALE, DLY, Discard functionsX
Global interrupts ADF_FLT[0:0] (adf_flt_it[0:0])X
Receive interrupts ADF_RX[0:0] (adf_rx_it[0:0])-
Event interrupts ADF_EVT[0:0] (adf_evt_it[0:0])-
Autonomous in Stop 0, Stop 1 and Stop 2 modesX
All DMA channels connectedX

1. ‘X’ = supported, ‘-’ = not supported.

46.4 ADF functional description

46.4.1 ADF block diagram

Figure 382. ADF block diagram

Block diagram of the ADF (Audio Digital Filter) showing internal components and external interfaces.

The diagram illustrates the internal architecture of the ADF. It is divided into two main clock domains: the AHB clock domain (shaded grey) and the adf_ker_ck clock domain (shaded light grey). The AHB domain contains the REGIF, which interfaces with the AHB bus and external signals: adf_sad_det, adf_fl0_it, adf_fl0_dma, adf_hclk, adf_trgi, adf_trgo, adf_bus_ckreq, adf_ker_ck, and adf_ker_ckreq. The adf_ker_ck domain contains the ADCITF 1/2 (ADC interface), Sound activity detector (SAD), RX FIFO0, Digital filter processing (DFLT0), TRIG0, TRIG_CK, BSMX, and SITF0 (serial interface). The ADCITF 1/2 receives data from the ADC and feeds into the RX FIFO0. The RX FIFO0 is connected to the REGIF and the Digital filter processing block. The Sound activity detector (SAD) is also connected to the RX FIFO0 and provides an output to the REGIF. The Digital filter processing block (DFLT0) receives data from the RX FIFO0 and provides output bs_fl0 to the BSMX. TRIG0 and TRIG_CK are connected to the Digital filter processing block. The BSMX (multiplexer) selects between bs0_r and bs0_f signals and provides output to the SITF0. The SITF0 is connected to the external ADF_SDIO pin. The CKGEN and control block manages the clocking and control signals, including ADF_CCK0 and ADF_CCK1. A note (1) refers to the ADF implementation section to check if the SAD is available and if the ADCITF is available, and which ADCs are connected. The diagram is labeled MSv63650V2.

Block diagram of the ADF (Audio Digital Filter) showing internal components and external interfaces.

46.4.2 ADF pins and internal signals

Table 412. ADF external pins

Pin namePin typeRemarks
ADF_SDIOInputData signal from external sensors
ADF_CCKy (y = 0,1)Input/outputClock outputs for external sensor, or common clock input from external sensors

Table 413. ADF internal signals

Signal nameSignal typeRemarks
adf_trgiInputTrigger inputs to control the acquisition (see Table 414: ADF trigger connections for details)
adf_trgoOutputTrigger output for synchronizing with other MDF instances
adf_fl0_dmaInput/outputDMA request/acknowledge signals for the ADF processing chain
adf_fl0_itOutputGlobal interrupt signals
Table 413. ADF internal signals (continued)
Signal nameSignal typeRemarks
adf_bus_ckreqOutputBus interface clock request output
adf_ker_ckreqOutputKernel clock request output
adf_ker_ckInputKernel clock input
adf_hclkInputAHB bus interface clock input
adf_sad_detOutputSAD sound detection: 1 means that detecting sound
adf_adcitf1_dat[15:0]InputADCITF1 data input
adf_adcitf2_dat[15:0]InputADCITF2 data input
Table 414. ADF trigger connections
Trigger nameDirectionTrigger source/destination
adf_trgi0InputFrom exti2_exti[1]

46.4.3 Serial input interface (SITF)

The SITF0 input interface allows the connection of the external sensor to the digital filter via the bitstream matrix (BSMX). The SITF0 can be configured in the following modes:

The data from the serial interface is routed to the filter in order to perform the PDM to PCM conversion and the sound activity detection.

The serial interface is enabled by setting the SITFEN bit to 1. Once the interface is enabled, it receives serial data from the external ΣΔ modulator.

Note: Before enabling the serial interface, the user must insure that the adf_proc_ck is already enabled (see Section 46.4.5: Clock generator (CKGEN) for details).

The SITF0 is controlled via the ADF serial interface control register 0 (ADF_SITF0CR).

As shown in the Figure 383, ADF_CCK0 or ADF_CCK1 can be selected as clock source, in order to sample the incoming bitstream:

See Table 415 for additional information.

Figure 383. SITF overview

Block diagram of the SITF0 overview within the ADF. The diagram shows the ADF block containing the SITF0 block. The SITF0 block includes a Serial RX block, a SCKSRC multiplexer (selecting between 1 and 0), and a SITFMOD block. The Serial RX block outputs bs0_r and bs0_f to the BSMX matrix. The SCKSRC block outputs to the SITFMOD block. The SITFMOD block outputs to the ADF_CCK0 and ADF_CCK1 pins. The ADF_CCK0 and ADF_CCK1 pins are connected to the CKGEN block via AND gates. The CKGEN block outputs adf_proc_ck to the SITF0 block and adf_ker_ck to the ADF block. The ADF block also contains the ADF_SDIO block, which is connected to the SITF0 block. The ADF block is divided into two clock domains: the adf_ker_ck clock domain (shaded gray) and the adf_proc_ck clock domain (unshaded). The ADF_CCK0 and ADF_CCK1 pins are labeled (1) and (2) respectively, indicating SITF0 in SPI mode and SITF0 in LF_MASTER SPI mode.

Legend:

MSv63651V1

Block diagram of the SITF0 overview within the ADF. The diagram shows the ADF block containing the SITF0 block. The SITF0 block includes a Serial RX block, a SCKSRC multiplexer (selecting between 1 and 0), and a SITFMOD block. The Serial RX block outputs bs0_r and bs0_f to the BSMX matrix. The SCKSRC block outputs to the SITFMOD block. The SITFMOD block outputs to the ADF_CCK0 and ADF_CCK1 pins. The ADF_CCK0 and ADF_CCK1 pins are connected to the CKGEN block via AND gates. The CKGEN block outputs adf_proc_ck to the SITF0 block and adf_ker_ck to the ADF block. The ADF block also contains the ADF_SDIO block, which is connected to the SITF0 block. The ADF block is divided into two clock domains: the adf_ker_ck clock domain (shaded gray) and the adf_proc_ck clock domain (unshaded). The ADF_CCK0 and ADF_CCK1 pins are labeled (1) and (2) respectively, indicating SITF0 in SPI mode and SITF0 in LF_MASTER SPI mode.

LF_MASTER and normal SPI modes

The LF_MASTER SPI mode is a special mode allowing the use of an adf_proc_ck clock frequency, only two times bigger than the sensor clock. This mode is dedicated to low-power use-cases, using low-speed sensors.

In LF_MASTER SPI mode, the ADF must provide the bitstream clock to the external sensors via ADF_CCK0 and ADF_CCK1 pins. The ADF receives the bitstream data via the serial data input ADF_SDIO.

For the SITF0, the application must select the same clock than the one provided to the external sensor (ADF_CCK0 or ADF_CCK1), in order to guarantee optimal timing performances. This selection is done via SCKSRC[1:0].

The normal SPI interface is a more flexible interface than the LF_MASTER SPI, but the adf_proc_ck frequency must be at least four times higher than the sensor clock.

The application can select ADF_CCK0 or ADF_CCK1 clock for the capture of the data received via the ADF_SDIO pin.

The ADF can generate a clock to the sensors via ADF_CCK0 or ADF_CCK1 if needed.

For all SPI modes, the serial data is captured using the rising and the falling edge of the selected clock. The SITF0 always provides the following bitstreams:

According to the sensors connected, one of the two bitstreams may not be available.

The application can select the wanted stream via the BSMX matrix.

Figure 384. SPI timing example

Figure 384. SPI timing example. This diagram illustrates the timing relationship between the ADF_CCK0 or ADF_CCK1 clock signal, the ADF_SDI0 data stream, and the bs0_ck, bs0_r, and bs0_f signals. The ADF_CCK0 or ADF_CCK1 signal is a square wave. The ADF_SDI0 signal shows a sequence of data frames: L0, R0, L1, R1, L2, R2, L3, R3. The bs0_ck signal is a square wave that is synchronized with the ADF_CCK0 or ADF_CCK1 signal. The bs0_r signal is a rectangular pulse that is high during the L0, L1, L2, and L3 frames. The bs0_f signal is a rectangular pulse that is high during the R0, R1, R2, and R3 frames. A sampling point is indicated by a red arrow pointing to the falling edge of the ADF_CCK0 or ADF_CCK1 signal. The period between the falling edges of the ADF_CCK0 or ADF_CCK1 signal is labeled F_BS. The diagram is labeled MSv63670V1.
Figure 384. SPI timing example. This diagram illustrates the timing relationship between the ADF_CCK0 or ADF_CCK1 clock signal, the ADF_SDI0 data stream, and the bs0_ck, bs0_r, and bs0_f signals. The ADF_CCK0 or ADF_CCK1 signal is a square wave. The ADF_SDI0 signal shows a sequence of data frames: L0, R0, L1, R1, L2, R2, L3, R3. The bs0_ck signal is a square wave that is synchronized with the ADF_CCK0 or ADF_CCK1 signal. The bs0_r signal is a rectangular pulse that is high during the L0, L1, L2, and L3 frames. The bs0_f signal is a rectangular pulse that is high during the R0, R1, R2, and R3 frames. A sampling point is indicated by a red arrow pointing to the falling edge of the ADF_CCK0 or ADF_CCK1 signal. The period between the falling edges of the ADF_CCK0 or ADF_CCK1 signal is labeled F_BS. The diagram is labeled MSv63670V1.

To properly synchronize/receive the data stream, the adf_proc_ck frequency must be adjusted according to the constraints listed in Table 416.

Clock absence detection

A no-clock-transition period may be detected when the serial interface works in normal SPI mode. This feature can be used to detect a clock failure in the SPI link.

The application can program a timeout value via the STH[4:0] bitfield of the SITF0. If the ADF does not detect clock transitions for a duration of \(STH[4:0] \times T_{adf\_proc\_ck}\), then the CKABF flag is set.

An interrupt can be generated if CKABIE is set to 1. The STH[4:0] bitfield is in the ADF serial interface control register 0 (ADF_SITF0CR).

When the serial interface is enabled, the CKABF flag remains to 1 until a first clock transition is detected.

To avoid spurious clock absence detection, the following sequence must be respected:

  1. 1. Configure the serial interface in normal SPI mode and enable it.
  2. 2. Clear the CKABF flag by writing CKABF bit to 1.
    If no clock transition is detected on the serial interface, the hardware immediately sets the CKABF flag to 1.
  3. 3. Read the CKABF flag:
    • – If CKABF= 1, go back to step 2.
    • – If CKABF= 0, a clock has been detected. The CKABIE bit can be set to 1 if the application wants an interrupt on detection of a clock absence.

Note: The clock absence detection feature is not available in the LF_MASTER SPI mode.

Manchester mode

In Manchester coded format, the ADF receives data stream from the external sensor via the ADF_SDI0 pin only.

The ADF_CCK0 and ADF_CCK1 pins are not needed in this mode.

Decoded data and clock signals are recovered from serial stream after Manchester decoding. They are available on bs0_r. There are two possible settings of Manchester codings:

Figure 385. Manchester timing example (SITFMOD = 11)

Timing diagram for Manchester decoding showing Data transferred, ADF_SDI0, adf_proc_ck, STH[4:0] = 5, MCNT, bs0_ck, bs0_r, CKABF, and Clear of the CKABF. The diagram illustrates the relationship between the Manchester-coded input signal and the recovered data and clock signals. A legend explains the color coding for signal absence and transition lengths based on the STH counter value.

The diagram shows the following signals over time:

Legend:

MSv63652V1

Timing diagram for Manchester decoding showing Data transferred, ADF_SDI0, adf_proc_ck, STH[4:0] = 5, MCNT, bs0_ck, bs0_r, CKABF, and Clear of the CKABF. The diagram illustrates the relationship between the Manchester-coded input signal and the recovered data and clock signals. A legend explains the color coding for signal absence and transition lengths based on the STH counter value.

To decode the incoming Manchester stream, the user must program STH[4:0] in the ADF serial interface control register 0 (ADF_SITF0CR). The STH[4:0] bitfield is used by the SITF0 to estimate the Manchester symbol length and to detect a clock absence. An internal counter (MCNT) is restarted every time a transition is detected in the ADF_SDI0 input. It is used to detect short transitions, long transitions or clock absence. A long transition indicates that the data value changed. Figure 385 shows a case where the OVR is around height and STH[4:0] = 5.

The estimated Manchester symbol rate (\(T_{SYMB}\)) must respect the following formula:

\[(STH + 1) \times T_{adf\_proc\_ck} < T_{SYMB} < (2 \times STH \times T_{adf\_proc\_ck})\]

It is recommended to compute STH as follows:

\[STH[4:0] = \text{round}\left(\frac{(2 \times OVR) - 1}{3}\right)\]

where OVR represents the ratio between the adf_proc_ck frequency and the expected Manchester symbol frequency. OVR must be higher than five, and the adf_proc_ck clock must be adjusted according to the constraints listed in Table 416.

The clock absence flag CKABF is set to 1 when no transition is detected during more than \(2 \times STH[4:0] \times T_{adf\_proc\_ck}\), or when the SITF0 is not yet synchronized to the incoming Manchester stream. In addition, an interrupt can be generated if the bit CKABIE is set to 1.

When the serial interface is enabled, the ADF must first be synchronized to the incoming Manchester stream. The synchronization ends when a data transition from 0 to 1 or from 1 to 0 (pink circle in the Figure 385) is detected.

The end of the synchronization phase can be checked by following the software sequence:

  1. 1. Clear the CKABF flag in the ADF DFLT0 interrupt status register 0 (ADF_DFLT0ISR) by writing CKABF bit to 1. If the serial interface is not yet synchronized the hardware immediately set the CKABF flag to 1.
  2. 2. Read the CKABF flag:
    • – If CKABF= 1, go back to step 1.
    • – If CKABF = 0, the Manchester interface is synchronized and provides valid data.

Programming example

In the following example, the ADF kernel clock frequency (\(F_{adf\_ker\_ck}\)) is 100 MHz and the received Manchester stream is at about 6 MHz (\(F_{SYMB}\)):

  1. 1. Provide a valid adf_proc_ck to the SITF0.
    The adf_proc_ck frequency must be at least six times higher than the Manchester symbol frequency (means at least 36 MHz).
    PROCDIV is programmed to 1 to perform a division by two of the kernel clock. In that case, \(F_{adf\_proc\_ck} = 50\) MHz (8.33 times higher than the Manchester symbol frequency).
  2. 2. Compute STH.
    OVR is given by: \(OVR = F_{adf\_proc\_ck} / F_{SYMB} = 50 \text{ MHz} / 6 \text{ MHz} = 8.33\).

\[\text{Then } STH[4:0] = \text{round}\left(\frac{(2 \times 8.33) - 1}{3}\right) = 5\]

The minimum allowed frequency for the Manchester stream is then:

\[1 / (2 \times STH \times T_{adf\_proc\_ck}) = 1 / (10 \times 20 \text{ ns}) = 5 \text{ MHz}\]

The maximum allowed frequency for the Manchester stream is then:

\[1 / ((STH+1) \times T_{adf\_proc\_ck}) = 1 / (6 \times 20 \text{ ns}) = 8.33 \text{ MHz}\]

46.4.4 ADC slave interface (ADCITF)

The ADCs are not always connected to the ADF. Refer to Section 46.3 to check the situation for this product.

The ADF allows the connection of up to two ADCs to the filter path. For the filter, the DATSRC[1:0] bitfield in the ADF digital filter configuration register 0 (ADF_DFLT0CICR) allows the application to select data from the ADCs.


Warning: The ADF does not support receiving interleaved data from one of the ADCITF input.


46.4.5 Clock generator (CKGEN)

The RCC (reset and clock controller) provides the following clocks to the ADF:

These clocks are not supposed to be phase locked, so all signals crossing those clock domains are re-synchronized.

The clock generator (CKGEN) is responsible of the generation of the processing clock, and the clock provided to the ADF_CCK0 and ADF_CCK1 pins. All those clocks are generated from the adf_ker_ck.

The processing clock (adf_proc_ck) is used to run all the signal processing and to re-sample the incoming serial or parallel stream.

To adapt the kernel clock frequency provided by the RCC, the following dividers are available:

PROCDIV[6:0] and CCKDIV[3:0] must be programmed when no clock is provided to the dividers (CKGDEN = 0).

The adf_proc_ck generation is controlled by CKGDEN.

In addition, the CKGMOD bit allows the application to define the way to trigger the CCKDIV divider:

All the bits and fields controlling the CKGEN are in the ADF clock generator control register (ADF_CKGCR).

Figure 386. CKGEN overview

Block diagram of the CKGEN overview within the ADF. The diagram shows the internal logic for clock generation. Inputs include adf_ker_ck and cck_trg (from TRIG_CK). The cck_trg signal is ANDed with CKGDEN to produce a trigger for a +1 to 128 divider (PROCDIV[6:0]). The output of this divider is ANDed with CKGMOD to select between two paths (0 or 1) leading to a +1 to 16 divider (CCKDIV[3:0]). The output of CCKDIV[3:0] is ANDed with CCK0DIR and CCK0EN to produce ADF_CCK0, and with CCK1DIR and CCK1EN to produce ADF_CCK1. The adf_proc_ck signal is also shown, which is connected to TRIG0/TRIG_CK, Digital processing (DFLT0, SAD), and Interfaces (ADCITF[2:1], SITF0).
Block diagram of the CKGEN overview within the ADF. The diagram shows the internal logic for clock generation. Inputs include adf_ker_ck and cck_trg (from TRIG_CK). The cck_trg signal is ANDed with CKGDEN to produce a trigger for a +1 to 128 divider (PROCDIV[6:0]). The output of this divider is ANDed with CKGMOD to select between two paths (0 or 1) leading to a +1 to 16 divider (CCKDIV[3:0]). The output of CCKDIV[3:0] is ANDed with CCK0DIR and CCK0EN to produce ADF_CCK0, and with CCK1DIR and CCK1EN to produce ADF_CCK1. The adf_proc_ck signal is also shown, which is connected to TRIG0/TRIG_CK, Digital processing (DFLT0, SAD), and Interfaces (ADCITF[2:1], SITF0).

The trigger logic for CKGEN is handled by the block TRG_CK. As shown in Figure 391, the CCKDIV divider can be triggered on the rising or falling edge of an external trigger source. When the proper trigger condition occurs, the cck_trg signal goes to high, allowing the CCKDIV divider to start. The TRG_CK logic is reset when CKGDEN is set to 0.

This feature can be helpful to synchronize the ADF_CCKy (y = 0,1) clock of several ADF instances, or to synchronize the clock generation to a timer event.

The application can control the activation of the ADF_CCK0 or ADF_CCK1 pin thanks to CCK0EN/CCK1EN and CCK0DIR/CCK1DIR bits:

Table 415. Control of the common clock generation(1)
CCKyENCCKyDIRDescription
00The ADF_CCKy pin is in input. An external clock can be connected to the ADF_CCKy pin and used by the SITF0 in order to decode the serial stream
01The ADF_CCKy pin is in output. No clock is generated. The ADF_CCKy pin is driven low.
11The ADF_CCKy pin is in output. A clock is generated on the ADF_CCKy pin. The SITF0 can use this pin as clock source in order to decode the serial stream

1. The configuration with CCKyEN = 1 and CCKyDIR = 0 is not shown must be avoided (no interest).

Note: The adf_proc_ck must be enabled (by CKGDEN = 1) before enabling other blocks (such as SITF0 or DFLT0).

CKGEN activation sequence example

  1. 1. Set CKGDEN to 0.
  2. 2. Wait for CKGACTIVE = 0. If CKGDEN was previously enabled, this phase can take two periods of adf_hclk, and two periods of adf_proc_ck.
  3. 3. Program PROCDIV[6:0], CKGMOD, CCKDIV[3:0], TRGSRC[3:0], TRGSENS, CCK1EN and CCK0EN.
  4. 4. Set CKGDEN to 1.

When needed, at any moment, CCK[1:0]EN bitfield value can be changed without disabling the clock generator.

Clock frequency constraints

Table 416 shows the frequency constraints to receive and process properly the samples.

Note: The reshape filter (RSFLT) needs up to 24 cycles of adf_proc_ck clock to process one sample.

Table 416. Clock constraints with respect to the incoming stream(1)

SITF0 modeADF clock constraints
With RSFLT disabledWith RSFLT enabled
LF_MASTER SPI\(F_{ADF\_CCKy}\) max frequency limited to 5 MHz
\(F_{adf\_proc\_ck} > 2 \times F_{ADF\_CCKy}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
\(F_{adf\_proc\_ck} > 24 \times F_{ADF\_CCKy} / (MCICD+1)\)
and
\(F_{adf\_proc\_ck} > 2 \times F_{ADF\_CCKy}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
MASTER SPI
SLAVE SPI
\(F_{ADF\_CKx}\) max frequency limited to 25 MHz
\(F_{adf\_proc\_ck} > 4 \times F_{ADF\_CCKy}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
\(F_{adf\_proc\_ck} > 24 \times F_{ADF\_CCKy} / (MCICD+1)\)
and
\(F_{adf\_proc\_ck} > 4 \times F_{ADF\_CCKy}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
Manchester\(F_{SYMB}\) max frequency limited to 20 MHz
\(F_{adf\_proc\_ck} > 6 \times F_{SYMB}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
\(F_{adf\_proc\_ck} > 24 \times F_{ADF\_CCKy} / (MCICD+1)\)
and
\(F_{adf\_proc\_ck} > 6 \times F_{SYMB}\)
and
\(F_{adf\_hclk} \geq F_{adf\_proc\_ck}\)
  1. 1. \(F_{ADF\_CCKy}\) represents the frequency of clock received via ADF_CCKy, or generated via ADF_CCKy. \(F_{SYMB}\) represents the frequency of the received symbol rate for Manchester mode.

46.4.6 Bitstream matrix (BSMX)

The BSMX receives the bitstreams from the serial interface SITF0 and provides the selected stream to the digital filter DFLT0.

As shown in Figure 382, the SITF0 provides two bitstreams (bs0_r and bs0_f) to the BSMX.

The application to select the wanted stream via the ADF bitstream matrix control register 0 (ADF_BSMX0CR). This selection is intended to be static.

Figure 387. BSMX overview

Figure 387. BSMX overview block diagram showing ADF sub-blocks including ADCITF[2,1], DFLT0, BSMX, and SITF0 with signal interconnections.

The block diagram shows the internal BSMX interconnection within ADF:

Diagram code: MSv63654V1

Figure 387. BSMX overview block diagram showing ADF sub-blocks including ADCITF[2,1], DFLT0, BSMX, and SITF0 with signal interconnections.

BSMX programming sequence example

The BSSEL[4:0] bitfield cannot be changed if the DFLT0 is enabled. The following steps are needed to change the value of BSMX:

  1. 1. Set DFLTEN of DFLT0 to 0.
  2. 2. Wait for BSMXACTIVE = 0.
  3. 3. Program BSSEL[4:0].
  4. 4. Set DFLTEN of DFLT0 to 1.

46.4.7 Digital filter processing (DFLT)

The digital filter processing includes the following sub-blocks:

Figure 388 shows the filter path configuration according to CICMOD[2:0]. Several configuration bits are available to configure the digital filter to the application needs.

Figure 388. DFLT overview

Block diagram of the DFLT0 audio digital filter. The diagram shows three frequency domains: F_PCM, F_RS, and F_BS. The F_PCM domain includes an RX FIFO, a multiplexer (0/1), and a Discard logic block. The F_RS domain includes HPFC, RSFLT, SAT, and SCALE blocks. The F_BS domain includes MCIC4, MCIC5, DLY, and SBR blocks. Control signals like HPFBYP, RSFLTBYP, and DATSRC are shown. Data flows from RX FIFO through the domains to the final output. The entire block is labeled ADF and DFLT0. The clock domain is adf_proc_ck.
Block diagram of the DFLT0 audio digital filter. The diagram shows three frequency domains: F_PCM, F_RS, and F_BS. The F_PCM domain includes an RX FIFO, a multiplexer (0/1), and a Discard logic block. The F_RS domain includes HPFC, RSFLT, SAT, and SCALE blocks. The F_BS domain includes MCIC4, MCIC5, DLY, and SBR blocks. Control signals like HPFBYP, RSFLTBYP, and DATSRC are shown. Data flows from RX FIFO through the domains to the final output. The entire block is labeled ADF and DFLT0. The clock domain is adf_proc_ck.

Symbol remap and source selection

The symbol remap (SBR) converts the bitstream selected by the BSMX into data usable by the filter path. More especially:

The signal source of the digital filter can be selected via DATSRC[1:0] between the two following:

Programmable micro-delay control (DLY)

The digital filter has a delay line that allows the timing adjustment of each stream with the resolution of the bitstream clock.

This feature is particularly helpful in the case of microphone beam forming applications where delays smaller than the final sampling rate must be applied to the incoming stream. This feature can be used when the ADF is synchronized with another MDF instance (if present in the product) for a beam forming application for example.

The delay is performed by discarding a given number of samples from the selected input stream, before samples enter into the CIC filter. This data discarding is done by skipping a given number of data strobe, preventing the CIC filter to take into account those data.

When the wanted amount of data strobe has been skipped, the next incoming samples are strobed normally.

Table 389 shows an example on how to apply dynamically small delay to an incoming stream. For simplification, the CIC filter performs a decimation by height in this example. CIC1 represents the CIC included in the ADF and CIC0 represents a filter from another MDF instance (if present in the product).

Figure 389. Programmable delay

Timing diagram showing CIC0 and CIC1 inputs, data strobesc, decimation counters, and outputs. It illustrates a programmable delay where CIC1 skips three samples (b10, b11, b12) compared to CIC0. Annotations indicate that these samples are ignored and that sample delivery is delayed.

The diagram illustrates the timing relationship between CIC0 and CIC1 inputs, data strobesc, decimation counters, and outputs. It shows a scenario where CIC1 skips three samples (b10, b11, b12) compared to CIC0. The decimation counters for both CIC0 and CIC1 are shown, with CIC1's counter freezing at 0 during the skipped samples. The outputs for CIC0 and CIC1 are shown, with annotations indicating that b10, b11, and b12 are ignored and that sample delivery is delayed.

Timing diagram showing CIC0 and CIC1 inputs, data strobesc, decimation counters, and outputs. It illustrates a programmable delay where CIC1 skips three samples (b10, b11, b12) compared to CIC0. Annotations indicate that these samples are ignored and that sample delivery is delayed.

The CIC of the ADF (CIC1) receives a command in order to skip three incoming samples. So the input samples named b10, b11 and b12 are not processed by CIC1. As a consequence, the output sample N+1 generated by CIC0 is built from input samples a[23:16] while the sample N+1 of CIC1 is built from input samples b[26:19].

Finally, the non-skipped data stream looks delayed by three bitstream periods.

Note: When the input data strobesc are skipped, the decimation counter remains frozen. As a consequence, the samples delivered by the CIC1 are a bit delayed.

The following steps are needed to program the amount of bitstream clock periods to be skipped:

  1. 1. Wait for SKPBF equal to 0.
  2. 2. Write SKPDLY[6:0] to the wanted number of bitstream clock periods to be skipped. The SKPBF flag goes immediately to 1, indicating that the delay value entered into SKPDLY[6:0] is under process.
    • – If the DFLT0 is not yet enabled (DFLTEN = 0), then the DLY logic waits for DFLTEN = 1. When the application sets DFLTEN to 1, the DLY logic starts to skip the amount of wanted data strobesc.
    • – If the DFLT0 is already enabled (DFLTEN = 1), then the DLY logic immediately starts to skip the amount of wanted data strobesc.

When the ADF skipped the amount of wanted data strobesc, then SKPBF goes back to 0.

  1. 3. If the application needs to skip more data strobesc, then the operation must be restarted from step 1.

The effect of the delay performed with this mechanism is cumulative as long as the ADF is enabled. If the application performs a D1 delay followed by a D2 delay, then all other active filters are delayed by D1 + D2.

Note: If SKPDLY[6:0] is written when SKPBF = 1, the write operation is ignored.

Cascaded-integrator-comb (CIC) filter

The CIC digital filters are an efficient implementation of low-pass filters, often used for decimation and interpolation. The CIC frequency response is equal to a SincN function, this is why they are often called Sinc filters.

The \(\text{Sinc}^N\) digital filter embedded into the ADF can be configurable in Sinc⁴ or Sinc⁵, according to CICMOD:

The filters have the following transfer function:

\[H(z) = \left( \frac{1 - z^{-D}}{1 - z^{-1}} \right)^N\]

where N can be 4 or 5, and D is the decimation ratio. D is equal to MCICD+1.

Figure 390. CIC4 and CIC5 frequency response with decimation ratio = 32 or 16

Figure 390: CIC4 and CIC5 frequency response with decimation ratio = 32 or 16. The figure consists of two plots. The top plot shows the frequency response from 0 to 5 x 10^5 Hz, with the y-axis representing Normalized Magnitude (dB) from 0 to -160. It displays four curves: CIC5, DEC32 (solid black), CIC4, DEC32 (solid red), CIC5, DEC16 (dashed black), and CIC4, DEC16 (dashed red). The bottom plot shows the frequency response from 0 to 10000 Hz, with the y-axis representing Normalized Magnitude (dB) from 0 to -8. It displays the same four curves. The legend in both plots identifies the curves: CIC5, DEC32 (solid black), CIC4, DEC32 (solid red), CIC5, DEC16 (dashed black), and CIC4, DEC16 (dashed red).
Figure 390: CIC4 and CIC5 frequency response with decimation ratio = 32 or 16. The figure consists of two plots. The top plot shows the frequency response from 0 to 5 x 10^5 Hz, with the y-axis representing Normalized Magnitude (dB) from 0 to -160. It displays four curves: CIC5, DEC32 (solid black), CIC4, DEC32 (solid red), CIC5, DEC16 (dashed black), and CIC4, DEC16 (dashed red). The bottom plot shows the frequency response from 0 to 10000 Hz, with the y-axis representing Normalized Magnitude (dB) from 0 to -8. It displays the same four curves. The legend in both plots identifies the curves: CIC5, DEC32 (solid black), CIC4, DEC32 (solid red), CIC5, DEC16 (dashed black), and CIC4, DEC16 (dashed red).

CIC output data size

The size of samples delivered by the CIC (\(DS_{CIC}\)), depends on the following parameters:

The CIC order and decimation ratio must be programmed in order to insure that the data size does not exceed the 26-bit CIC capability.

The following formula gives the output data size (\(DS_{CIC}\)) according to the parameters above.

\[DS_{CIC} = \left( \frac{N \times \text{Ln}(D)}{\text{Ln}(2)} \right) + DS_{IN}\]

and the CIC gain is given by this formula:

\[G_{CIC} = (D)^N\]

The decimation ratio can be adjusted from 2 to 512 for the CIC filter.

Table 417 gives some data output size in bits for some decimation values, when the data source is a full-scale signal coming from the serial interface or from a 12-bit ADC.

Note: \(DS_{IN} = 1\) bit for a serial bitstream, but can be up to 16 bits when coming from the ADCITF.

Table 417. Data size according to CIC order and CIC decimation values

DecimationData size (bits) when \(DS_{IN} = 1\) bit
(data from SITF0)
Data size (bits) when \(DS_{IN} = 12\) bits
(data from ADCITF)
Sinc4Sinc5Sinc4Sinc5
49112022
8131624-
10151826-
121619--
161721--
201923--
242024--
322126--
4824---
6425---
7626---

Note: For a full-scale input signal, the decimation ratio must not exceed 76 for a Sinc4 and 32 for a Sinc5.

The LSB parts of the data provided by the CIC is not necessarily significant: it depends on the sensor performances and the ability of the CIC to reject the out-of-band noise.

The sample size at CIC output can be adjusted thanks to the SCALE block.

Scaling (SCALE) and saturation (SAT)

The SCALE block allows the application to adjust the amplitude of the signal provided by the CIC, by steps of 3 dB (±0.5 dB).

The signal amplitude can be decreased by up to 8 bits (- 48.2 dB), and can be increased by up to 12 bits (+ 72.2 dB).

The gain is adjusted by the SCALE[5:0] bitfield in the ADF digital filter configuration register 0 (ADF_DFLT0CICR).

SCALE[5:0] can be changed even if the DFLT0 is enabled. During the gain transition, the signal provided by the filter is disturbed.

Due to internal resynchronization, there is a delay of some cycles of adf_proc_ck clock between the moment where the application writes the new gain, and the moment where the gain is effectively applied to the samples. If the application attempts to write a new gain value while the previous one is not yet applied, this new gain value is ignored. Reading back SCALE[5:0] informs the application on the current gain value.

Table 418 shows the possible gain values.

Table 418. Possible gain values

SCALE[5:0]Gain (dB)SCALE[5:0]Gain (dB)SCALE[5:0]Gain (dB)SCALE[5:0]Gain (dB)
0x20- 48.20x2B- 14.50x06+ 18.10x11+ 51.7
0x21- 44.60x2C- 12.00x07+ 21.60x12+ 54.2
0x22- 42.10x2D- 8.50x08+ 24.10x13+ 57.7
0x23- 38.60x2E- 6.00x09+ 27.60x14+ 60.2
0x24- 36.10x2F- 2.50x0A+ 30.10x15+ 63.7
0x25- 32.60x000.00x0B+ 33.60x16+ 66.2
0x26- 30.10x01+ 3.50x0C+ 36.10x17+ 69.7
0x27- 26.60x02+ 6.00x0D+ 39.60x18+ 72.2
0x28- 24.10x03+ 9.50x0E+ 42.1--
0x29- 20.60x04+ 12.00x0F+ 45.7--
0x2A- 18.10x05+ 15.60x10+ 48.2--

The SAT blocks avoid having a wrap-around of the binary code when the code exceeds its maximal or minimal value.

The ADF performs saturation operations at the following levels:

The SATF bit informs the application that a saturation occurred either after the SCALE, inside the RSFLT or after the HPF. In addition, an interrupt can be generated if SATIE is set to 1. As soon as a saturation is detected, the SATF flag is set to 1. It is up to the application to clear this flag in order to be able to detect a new saturation.

Those bits are in the ADF DFLT0 interrupt enable register (ADF_DFLT0IER) and ADF DFLT0 interrupt status register 0 (ADF_DFLT0ISR).

Gain adjustment policy

To get the best ADF performances, it is important to properly adjust the gain value via SCALE[5:0].

A usual way to adjust the gain is to select the SCALE[5:0] value that gives a final signal amplitude as close as possible to the 24-bit full-scale, for the maximum input signal.

A way to select the optimal gain is detailed below:

  1. 1. Check that, for the expected input signal, the data size into the CIC filter does not exceed 26 bits. This can be checked using this formula:

\[\frac{\text{LN}(\text{SIN}_{pp} \cdot D^N)}{\text{LN}(2)} < 26\]

where N represents the CIC order, D the decimation ratio and \(\text{SIN}_{pp}\) the maximum peak-to-peak amplitude of the input signal.

\(\text{SIN}_{pp}\) can take:

Example: a Sinc⁴ can be used with a decimation ratio of 96, if the maximum input signal does not exceed ±0.35. Indeed:

\[\frac{\text{LN}(0.7 \cdot 96^4)}{\text{LN}(2)} \sim 25.82 \text{ bits} < 26 \text{ bits}\]

2. Adjust the SCALE value.

To select the most appropriate SCALE value, the user must check if the RSFLT is used or not. If the RSFLT is used, the data size at SCALE output must not exceed 22 bits, otherwise the data size can be up to 24 bits.

The SCALE value in dB must be selected using this formula:

\[\text{SCALE}_{\text{dB}} < 20 \cdot \log_{10} \left( \frac{2^{\text{NB}}}{\text{SIN}_{\text{pp}} \cdot D^N} \right)\]

where NB is equal to 22 if RSFLT is enabled, or 24 if RSFLT is bypassed. \(\text{SCALE}_{\text{dB}}\) represents the gain value selected by SCALE[5:0].

Example: For a Sinc4 with a decimation ratio of 96 and a \(\text{SIN}_{\text{pp}}\) of 0.7.

\[20 \cdot \log_{10} \left( \frac{2^{24}}{0.7 \cdot 96^4} \right) \sim 11 \text{ dB}\]

\(\text{SCALE}_{\text{dB}}\) value must be lower than - 11 dB, the closest lower value is - 12dB (SCALE[5:0] = 0x2C).

\[20 \cdot \log_{10} \left( \frac{2^{22}}{0.7 \cdot 96^4} \right) \sim 23 \text{ dB}\]

\(\text{SCALE}_{\text{dB}}\) value must be lower than - 23 dB, the closest lower value is - 24.1 dB (SCALE[5:0] = 0x28).

If SCALE[5:0] is set to a higher value, then a saturation may occur. An event flag informs the user if a saturation occurred.

Table 419 proposes gain values for different filter configurations, when the data comes from the SITF0, according to the MCIC order, and the MCIC decimation ratio. This table is not exhaustive and considers a full-scale input signal (see Section 46.7.5: Total ADF gain for details).

Table 419. Recommended maximum gain values versus CIC decimation ratios

CIC decimation ratioGain settings (dB) for configuration SITF + CICx + RSFLT (+ HPF)Gain settings (dB) for configuration SITF + CICx (+ HPF)
CIC5CIC4CIC5CIC4
833.651.745.763.7
1218.139.630.151.7
163.527.615.639.6
20- 6.021.66.033.6
24- 12.015.6027.6
28- 20.69.5- 8.521.6

Table 419. Recommended maximum gain values
versus CIC decimation ratios (continued)

CIC
decimation
ratio
Gain settings (dB) for configuration
SITF + CICx + RSFLT (+ HPF)
Gain settings (dB) for configuration
SITF + CICx (+ HPF)
CIC5CIC4CIC5CIC4
32- 26.63.5- 4.515.6
48-- 8.5-3.5
64-- 20.6-- 8.5

Reshaping filter (RSFLT)

In addition to the CIC, the ADF offers a reshaping IIR filter mainly dedicated to the audio application, but also usable in other applications.

When the RSFLT is used, the sample size at its input must not exceed 22 bits.

The samples at the RSFLT output can be decimated by four or not according to the RSFLTD bit in the ADF reshape filter configuration register 0 (ADF_DFLT0RSFR).

The RSFLT can be bypassed by setting RSFBYP to 1 in the ADF reshape filter configuration register 0 (ADF_DFLT0RSFR).

Table 420 shows which sampling rate must be provided to the RSFLT in order to process the most common audio streams.

The RSFLT cutoff frequency (FC) depends on the sample rates at its input (FRS), and is given by the following formula:

\[\mathrm{F_C} = 0.111 \times \mathrm{F_{RS}}\]

Table 420. Most common microphone settings

Sample rate (kHz) at RSFLT (FRS)Pass band (kHz)D2PCM sampling rate (kHz)
323.5548
647.1416
12814.2432
19221.3448

Table 391 shows the frequency response of the reshape filter.

Figure 391. Reshape filter frequency response normalized (\(F_{RS} / 2 = 1\))

Figure 391: Reshape filter frequency response normalized (F_RS / 2 = 1). The figure consists of two plots. The top plot shows Magnitude (dB) on the y-axis (from -80 to 10) versus Normalized frequency (xπ rad/sample) on the x-axis (from 0 to 0.9). The response is flat at 10 dB until approximately 0.25, then drops sharply to -80 dB at 0.3. There are several ripples between 0.3 and 0.5, and a broad peak around 0.65. The bottom plot is a zoomed-in view of the passband, showing Magnitude (dB) on the y-axis (from 6 to 10.5) versus Normalized frequency (xπ rad/sample) on the x-axis (from 0 to 0.2). The response is relatively flat around 9.3 dB with some minor ripples, and then drops off sharply after 0.2.
Figure 391: Reshape filter frequency response normalized (F_RS / 2 = 1). The figure consists of two plots. The top plot shows Magnitude (dB) on the y-axis (from -80 to 10) versus Normalized frequency (xπ rad/sample) on the x-axis (from 0 to 0.9). The response is flat at 10 dB until approximately 0.25, then drops sharply to -80 dB at 0.3. There are several ripples between 0.3 and 0.5, and a broad peak around 0.65. The bottom plot is a zoomed-in view of the passband, showing Magnitude (dB) on the y-axis (from 6 to 10.5) versus Normalized frequency (xπ rad/sample) on the x-axis (from 0 to 0.2). The response is relatively flat around 9.3 dB with some minor ripples, and then drops off sharply after 0.2.

The RSFLT gain is close to 9.3 dB, so the output data size is a little bit lower than 24 bits for a 22-bit wide input signal.

The RSFLT takes 24 clock cycles of adf_proc_ck clock to process one sample at \(F_{RS}\). When the RSFLT is enabled, the application must insure that the adf_proc_ck is at least 24 times faster \(F_{RS}\).

The RSFLT generates an event (rfovr_evt) and sets the RFOVRF flag, if the RSFLT receives a new samples while the previous one is still under processing.

When RFOVRF is set, the samples provided by the RSFLT are invalid. The application must then stop the data acquisition and provides a faster adf_proc_ck clock to the RSFLT.

High-pass filter (HPF)

The high-pass filter suppresses the low-frequency content from the final output data stream in case of continuous conversion mode. The high-pass filter can be enabled or disabled via HPFBYP in the ADF reshape filter configuration register 0 (ADF_DFLT0RSFR).

The HPF is useful when there is parasitic low-frequency noise (or DC signal) in the input data source that must be removed from the final data.

The HPF is a first order IIR filter and the cut-off frequency can be selected via HPFC[1:0] in the ADF reshape filter configuration register 0 (ADF_DFLT0RSFR), among the following values:

Table 421. HPF 3 dB cut-off frequency examples

HPFC3 dB cut-off frequency for common \(F_{\text{PCM}}\) frequencies (Hz)
\(F_{\text{PCM}} = 8 \text{ kHz}\)\(F_{\text{PCM}} = 16 \text{ kHz}\)\(F_{\text{PCM}} = 48 \text{ kHz}\)
051030
1102060
22040120
376152456

The HPF output is saturated at 24 bits. The SATF flag is set if a sample is saturated.

46.4.8 Digital filter acquisition modes

The ADF offers the following modes to perform a data capture:

Note: To perform a data capture, the filter, the interface providing the data (SITF0 or ADCITF) and the CKGEN must be enabled. If needed, the ADF_CCK0 or ADF_CCK1 must be enabled as well.

The filter can be stopped immediately when DFLTEN is set to 0. This action resets the filter and flushes the RXFIFO. The DFLTACTIVE flag also goes back to 0 when the RXFIFO and the filter is reset.

Table 392 shows a simplified view of the trigger logic available for each filter and for the clock generator.

Figure 392. Trigger logic for DFLT and CKGEN

Figure 392: Trigger logic for DFLT and CKGEN. Block diagram showing ADF module trigger logic containing RESYNC and edge detection block, TRIG0 block with ACQMOD, TRGSENS, TRGSRC multiplexers and ACQ_CTL logic connected to DFLTEN/DFLT0, and TRIG_CK block with TRGSRC, TRGSENS multiplexers connected to CKGEN via cck_trg, operating within the adf_proc_ck clock domain.
Figure 392: Trigger logic for DFLT and CKGEN. Block diagram showing ADF module trigger logic containing RESYNC and edge detection block, TRIG0 block with ACQMOD, TRGSENS, TRGSRC multiplexers and ACQ_CTL logic connected to DFLTEN/DFLT0, and TRIG_CK block with TRGSRC, TRGSENS multiplexers connected to CKGEN via cck_trg, operating within the adf_proc_ck clock domain.

A block common to all TRIG blocks performs the rising and falling edges detection and the re-synchronization of the input trigger to the adf_ker_ck clock domain. This implementation allows the application to use triggers with pulse width smaller than the adf_ker_ck period.

In synchronous modes, the TRIG block offers the possibility to select adf_trgi or TRGO bit as trigger sources. The TRGO bit is in the ADF global control register (ADF_GCR).

The edge sensitivity can also be selected.

Asynchronous continuous acquisition mode

This mode allows the application to start a continuous acquisition by simply writing the DFLTEN bit to 1.

The asynchronous continuous acquisition mode is selected when ACQMOD[2:0] = 0.

The sequence below shows the most important programming steps (assuming that DFLTEN is set to 0):

  1. 1. Configure and enable the clock generator (CKGEN) so that the adf_proc_ck frequency is compatible with the targeted application (see examples in Table 425).
  2. 2. Enable the CKGEN (CKGDEN = 1) and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  3. 3. Program the filter configuration and set the ACQMOD[2:0] to 0.
  4. 4. Set to 1 the SITFEN bit of the serial data interface.
  5. 5. Before setting DFLTEN to 1, wait for DFLTACTIVE = 0: it insures that the previous filter deactivation sequence terminated properly.
  6. 6. When DFLTEN is set to 1, the acquisition sequence starts immediately.

Figure 393 shows a simplified example of the samples generated by the DFLT0.

Figure 393. Asynchronous continuous mode (ACQMOD[2:0] = 0)

Timing diagram for Asynchronous continuous mode (ACQMOD[2:0] = 0). The diagram shows five signals: DFLTEN, DFLT0 output, DFLTRUN, ADFLTACTIVE, and ADF_CCKy. DFLTEN is a high pulse that triggers the acquisition. DFLTRUN is high while the filter is active. ADFLTACTIVE is high during the acquisition. ADF_CCKy is a continuous clock signal. The DFLT0 output shows a sequence of samples: X, ..., X, S1, S2, ..., SN, OFF. A 'Discard (note)' phase is indicated at the beginning of the output, and a 'Dropped!' label is shown at the end of the output sequence.

Note: the discard phase is optional.

MSv63657V1

Timing diagram for Asynchronous continuous mode (ACQMOD[2:0] = 0). The diagram shows five signals: DFLTEN, DFLT0 output, DFLTRUN, ADFLTACTIVE, and ADF_CCKy. DFLTEN is a high pulse that triggers the acquisition. DFLTRUN is high while the filter is active. ADFLTACTIVE is high during the acquisition. ADF_CCKy is a continuous clock signal. The DFLT0 output shows a sequence of samples: X, ..., X, S1, S2, ..., SN, OFF. A 'Discard (note)' phase is indicated at the beginning of the output, and a 'Dropped!' label is shown at the end of the output sequence.

Note: The acquisition can be stopped by setting DFLTEN back to 0. This resets the filter and flushes the RXFIFO, so the samples located into the RXFIFO are lost. The ongoing DMA transfer is properly terminated. DFLTACTIVE goes back to 0 when the filter chain is reset and the RXFIFO flushed.

Asynchronous single-shot acquisition mode

This mode allows the application to start the acquisition of one sample by simply writing the DFLTEN bit to 1.

The asynchronous single-shot acquisition mode is selected when ACQMOD[2:0] = 001.

The sequence below shows the most important programming steps (assuming that DFLTEN is set to 0):

  1. 1. Configure and enable the clock generator (CKGEN), so that the adf_proc_ck frequency is compatible with the targeted application (see examples in Table 425).
  2. 2. Enable the CKGEN (CKGDEN = 1) and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  3. 3. Program the filter configuration, and set the ACQMOD[2:0] to 001.
  4. 4. Set to 1 the SITFEN bit.
  5. 5. Before setting DFLTEN to 1, wait for DFLTACTIVE = 0: it insures that the previous filter deactivation sequence terminated properly.
  6. 6. When DFLTEN is set to 1, the filter provides one data to the RXFIFO and stops the acquisition.

To trigger a new acquisition, the application must:

  1. 1. Check that the previous acquisition is completed, by waiting that DFLTRUN = 0.
  2. 2. Set again DFLTEN to 1.

This sequence can be repeated every time a new data must be converted.

As shown in Figure 393, every time DFLTEN is set to 1, an acquisition sequence is triggered. The first samples provided by the filter can be discarded if needed. At the end of each conversion, the decimation counters and filter taps are reset, and the filter is ready to start a new conversion.

If DFLTEN is set to 0 while an acquisition is ongoing, the ongoing conversion is stopped (in the example, S3 is lost). This situation can be avoided with the following steps:

  1. 1. Wait for DFLTRUN = 0.
  2. 2. Read the sample from the RXFIFO.
  3. 3. Set DFLTEN to 0.

Figure 394. Asynchronous single-shot mode (ACQMOD[2:0] = 001)

Timing diagram for Asynchronous single-shot mode (ACQMOD[2:0] = 001). The diagram shows the relationship between DFLTEN, Writing to DFLTEN, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCK. DFLTEN is a high-level signal that is pulsed low to write new values. Writing to DFLTEN shows three transitions from 1 to 0. DFLT0 output shows three acquisition sequences: S1, S2, and S3. Each sequence starts with a 'Discard (note)' phase containing samples marked 'X'. S1 and S2 are completed, but S3 is truncated and labeled 'Dropped!' because DFLTEN was set to 0 before it finished. DFLTRUN is a pulse that starts when DFLTEN is written to 1 and ends when the acquisition is complete. DFLTACTIVE is a pulse that starts when DFLTEN is written to 1 and ends when DFLTRUN goes low. ADF_CCK is a continuous clock signal. A note at the bottom states 'the discard phase is optional.' and the reference 'MSv63660V1' is in the bottom right corner.
Timing diagram for Asynchronous single-shot mode (ACQMOD[2:0] = 001). The diagram shows the relationship between DFLTEN, Writing to DFLTEN, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCK. DFLTEN is a high-level signal that is pulsed low to write new values. Writing to DFLTEN shows three transitions from 1 to 0. DFLT0 output shows three acquisition sequences: S1, S2, and S3. Each sequence starts with a 'Discard (note)' phase containing samples marked 'X'. S1 and S2 are completed, but S3 is truncated and labeled 'Dropped!' because DFLTEN was set to 0 before it finished. DFLTRUN is a pulse that starts when DFLTEN is written to 1 and ends when the acquisition is complete. DFLTACTIVE is a pulse that starts when DFLTEN is written to 1 and ends when DFLTRUN goes low. ADF_CCK is a continuous clock signal. A note at the bottom states 'the discard phase is optional.' and the reference 'MSv63660V1' is in the bottom right corner.

Note: The acquisition can be stopped by setting DFLTEN back to 0. This resets the filter and flushes the RXFIFO, so the samples located into the RXFIFO are lost. The ongoing DMA transfer is properly terminated. DFLTACTIVE goes back to 0 when the filter chain is reset and the RXFIFO flushed.

Synchronous continuous acquisition mode

This mode allows the application to start a continuous acquisition by using one of the following trigger sources:

The Synchronous continuous acquisition mode is selected when ACQMOD[2:0] = 010.

The sequence below shows the most important programming steps (assuming that DFLTEN is set to 0):

  1. 1. Configure and enable the clock generator (CKGEN), so that the frequency of adf_proc_ck clock is compatible with the targeted application (see examples in Table 425).
  2. 2. Enable the CKGEN (CKGDEN = 1) and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  3. 3. Program the filter configuration and set the ACQMOD[2:0] to 010.
  4. 4. Set to 1 the bit SIFTEN.
  5. 5. Select the proper trigger source and sensitivity.
  6. 6. Before setting DFLTEN to 1, wait for DFLTACTIVE = 0: it insures that the previous filter deactivation sequence terminated properly.
  7. 7. Set DFLTEN to 1.
  8. 8. When the trigger condition is met, the filter starts the acquisition.

The TRGSENS bit allows the selection of the trigger edge (rising or falling). The trigger is ignored if an acquisition is ongoing or if DFLTEN is set to 0.

Figure 395 shows a simplified example where the trigger logic is sensitive to a rising edge trigger (TRGSENS = 0). The first rising edge of the trigger signal is ignored because DFLTEN = 0. Then the next rising edge is taken into account and starts the acquisition. All other rising edges are ignored. The trigger logic is re-initialized when DFLTRUN goes back to 0.

Figure 395. Synchronous continuous mode (ACQMOD[2:0] = 010)

Timing diagram for Synchronous continuous mode (ACQMOD[2:0] = 010). The diagram shows the relationship between DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCKx signals. DFLTEN is a high-level enable signal. adf_trgi is a trigger signal with multiple rising edges. The first rising edge is ignored. The second rising edge starts an acquisition, during which DFLTRUN is high and DFLTACTIVE is high. The DFLT0 output shows a sequence of samples: X, ..., X, S1, S2, ..., SN. The first rising edge of adf_trgi is labeled 'Discard (note)'. The last rising edge of adf_trgi is labeled 'Dropped !'. ADF_CCKx is a continuous clock signal. A note at the bottom states: 'Note: the discard phase is optional.' The diagram is labeled MSv63661V1.
Timing diagram for Synchronous continuous mode (ACQMOD[2:0] = 010). The diagram shows the relationship between DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCKx signals. DFLTEN is a high-level enable signal. adf_trgi is a trigger signal with multiple rising edges. The first rising edge is ignored. The second rising edge starts an acquisition, during which DFLTRUN is high and DFLTACTIVE is high. The DFLT0 output shows a sequence of samples: X, ..., X, S1, S2, ..., SN. The first rising edge of adf_trgi is labeled 'Discard (note)'. The last rising edge of adf_trgi is labeled 'Dropped !'. ADF_CCKx is a continuous clock signal. A note at the bottom states: 'Note: the discard phase is optional.' The diagram is labeled MSv63661V1.

Note: The acquisition can be stopped by setting DFLTEN back to 0. This resets the filter and flushes the RXFIFO, so the samples located into the RXFIFO are lost. The ongoing DMA transfer is properly terminated. DFLTACTIVE goes back to 0 when the filter chain is reset and the RXFIFO flushed.

Synchronous single-shot acquisition mode

This mode allows the application to start a single acquisition by using one of the following trigger sources:

The Synchronous single-shot acquisition mode is selected when ACQMOD[2:0] = 011.

The sequence below shows the most important programming steps (assuming that DFLTEN is set to 0):

  1. 1. Configure and enable the clock generator (CKGEN), so that the frequency of adf_proc_ck clock is compatible with the targeted application (see examples in Table 425).
  2. 2. Enable the CKGEN and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  3. 3. Program the filter configuration, and set the ACQMOD[2:0] to 011.
  4. 4. Set to 1 the SITFEN bit.
  5. 5. Select the proper trigger source and sensitivity.
  6. 6. Before setting DFLTEN to 1, wait for DFLTACTIVE = 0: it insures that the previous filter deactivation sequence terminated properly.
  7. 7. Set DFLTEN to 1.
  8. 8. When the trigger condition is met, the filter starts the acquisition and provides one data to the RXFIFO, then the filter is ready to accept a new trigger.

TRGSENS allows the selection of the trigger edge (rising or falling). The trigger is ignored if an acquisition is ongoing, or if DFLTEN is set to 0.

Figure 396 shows a simplified example where the trigger logic is sensitive to a rising edge trigger (TRGSENS = 0). Every-time a trigger rising edge is detected with DFLTEN = 1, an acquisition sequence is triggered. The first samples provided by the filter can be discarded if needed. At the end of each conversion, the decimation counters and filter taps are reset. DFLTRUN is set to 0 and the filter is ready to start a new conversion.

Figure 396. Synchronous single-shot mode (ACQMOD[2:0] = 011)

Timing diagram for Synchronous single-shot mode (ACQMOD[2:0] = 011). The diagram shows the relationship between DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCKx. DFLTEN is a high-level signal. adf_trgi shows rising edges that trigger acquisitions. DFLT0 output shows sample sequences: a discard phase (X...X) followed by sample S1, and another discard phase followed by sample S2. DFLTRUN is a pulse that starts at each trigger edge and ends after S1. DFLTACTIVE is a pulse that starts at each trigger edge and ends after S2. ADF_CCKx is a continuous clock signal. A note indicates that the discard phase is optional. A label 'Dropped!' points to sample S2, indicating it is lost if DFLTEN is set to 0 during acquisition.

Note: the discard phase is optional.

MSv63662V1

Timing diagram for Synchronous single-shot mode (ACQMOD[2:0] = 011). The diagram shows the relationship between DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, DFLTACTIVE, and ADF_CCKx. DFLTEN is a high-level signal. adf_trgi shows rising edges that trigger acquisitions. DFLT0 output shows sample sequences: a discard phase (X...X) followed by sample S1, and another discard phase followed by sample S2. DFLTRUN is a pulse that starts at each trigger edge and ends after S1. DFLTACTIVE is a pulse that starts at each trigger edge and ends after S2. ADF_CCKx is a continuous clock signal. A note indicates that the discard phase is optional. A label 'Dropped!' points to sample S2, indicating it is lost if DFLTEN is set to 0 during acquisition.

Note: The acquisition can be stopped by setting DFLTEN back to 0. This resets the filter and flushes the RXFIFO, so the samples located into the RXFIFO are lost. The ongoing DMA transfer is properly terminated. DFLTACTIVE goes back to 0 when the filter chain is reset and the RXFIFO flushed.

Figure 395 shows a case where the DFLTEN is set to 0 while an acquisition is ongoing (the sample S2 is lost). This situation can be avoided with the following steps:

  1. 1. Wait for DFLTRUN = 0.
  2. 2. Read the sample from the RXFIFO.
  3. 3. Clear DFLTEN to 0.

Window continuous acquisition mode

This mode allows the application to start or stop a continuous acquisition controlled by consecutive edges of one of the following trigger sources:

The window continuous acquisition mode is selected when ACQMOD[2:0] = 100.

The sequence below shows the most important programming steps (assuming that DFLTEN is set to 0):

  1. 1. Configure and enable the clock generator (CKGEN), so that the frequency of adf_proc_ck clock is compatible with the targeted application (see examples in Table 425).
  2. 2. Enable the CKGEN and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  3. 3. Program the filter settings and set the ACQMOD[2:0] to 100.
  4. 4. Set to 1 the SITFEN bit.
  5. 5. Select the proper trigger source and sensitivity.
  6. 6. Before setting DFLTEN to 1, wait for DFLTACTIVE = 0: it insures that the previous filter deactivation sequence terminated properly.
  7. 7. Set DFLTEN to 1.
  8. 8. If TRGSENS = 0, the acquisition starts on trigger rising edge and stops on trigger falling edge. If TRGSENS = 1, the acquisition starts on trigger falling edge and stops on trigger rising edge.

Note: The acquisition may restart if the trigger condition becomes again active.

Figure 397 shows a simplified example of window continuous acquisition mode, with TRGSENS = 1. Once DFLTEN is set to 1, the ADF waits for a falling edge on the selected trigger input. When the trigger condition is met, DFLTRUN goes to 1 and the acquisition starts. The acquisition stops if the ADF detects a rising edge on the selected trigger input. If DFLTEN is still set to 1, the ADF waits again for a falling edge on the selected trigger input.

Figure 397. Window continuous mode (ACQMOD[2:0] = 100)

Timing diagram for Window continuous mode (ACQMOD[2:0] = 100). The diagram shows five signals: DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, and DFLTACTIVE. DFLTEN is a high-level signal that enables the acquisition. adf_trgi is a trigger signal with multiple falling and rising edges. DFLT0 output shows the data samples: a sequence of 'X' samples, followed by 'S1', 'S2', ..., 'SN', then another sequence of 'X' samples, and finally 'S1', 'S2', ..., 'Sk' before going 'OFF'. A 'Discard (note)' phase is indicated between the first 'X' and 'S1' samples. A 'Dropped!' label is shown after 'SN' and before the second 'X' sequence. DFLTRUN is a pulse that starts on a falling edge of adf_trgi and ends on a rising edge. DFLTACTIVE is a pulse that starts on a falling edge of adf_trgi and ends on a rising edge. ADF_CCKx is a continuous clock signal. A note at the bottom states: 'Note: the discard phase is optional.' The diagram is labeled MSv63663V1.
Timing diagram for Window continuous mode (ACQMOD[2:0] = 100). The diagram shows five signals: DFLTEN, adf_trgi, DFLT0 output, DFLTRUN, and DFLTACTIVE. DFLTEN is a high-level signal that enables the acquisition. adf_trgi is a trigger signal with multiple falling and rising edges. DFLT0 output shows the data samples: a sequence of 'X' samples, followed by 'S1', 'S2', ..., 'SN', then another sequence of 'X' samples, and finally 'S1', 'S2', ..., 'Sk' before going 'OFF'. A 'Discard (note)' phase is indicated between the first 'X' and 'S1' samples. A 'Dropped!' label is shown after 'SN' and before the second 'X' sequence. DFLTRUN is a pulse that starts on a falling edge of adf_trgi and ends on a rising edge. DFLTACTIVE is a pulse that starts on a falling edge of adf_trgi and ends on a rising edge. ADF_CCKx is a continuous clock signal. A note at the bottom states: 'Note: the discard phase is optional.' The diagram is labeled MSv63663V1.

Note: The acquisition can be stopped by setting DFLTEN back to 0. This resets the filter and flushes the RXFIFO, so the samples located into the RXFIFO are lost. The ongoing DMA transfer is properly terminated. DFLTACTIVE goes back to 0 when the filter chain is reset and the RXFIFO flushed.

Starting several filters synchronously

If the ADF is used with MDF instances (if present in the product), it is possible to start simultaneously the acquisition of all the filters. This synchronization capability depends on the way the triggers are connected in the product. Generally, an ADF is able to trigger MDF instances, if its adf_trgo signal is connected as trigger input to those blocks (see Section 46.4.2: ADF pins and internal signals to check trigger capabilities).

In the following programming example, one ADF has its adf_trgo signal connected to some MDFs. To start the acquisition of several filters synchronously, the following sequence must be performed (assuming that DFLTEN bits of the filters are set to 0):

On MDFs receiving the adf_trgo trigger:

  1. 1. Enable the CKGEN (CKGDEN= 1) and, if needed, enable the ADF_CCK0 and ADF_CCK1 clocks.
  2. 2. Set to 1 the SITFEN bit of the requested data interfaces.
  3. 3. For each filter, set the acquisition mode to synchronous (ACQMOD[2:0]= 01x).
  4. 4. For each filter, set TRGSRC[3:0] in order to select the adf_trgo trigger input.
  5. 5. For each filter, set TRGSENS to 0 (rising edge).
  6. 6. For each filter, set DFLTEN to 1.

On the ADF generating the adf_trgo trigger:

  1. 1. Enable the CKGEN (CKGDEN= 1) and, if needed, enable the ADF_CCK[1:0] clocks.
  2. 2. Set to 1 the SITFEN bit of the requested data interfaces.
  3. 3. Set the acquisition mode to synchronous (ACQMOD[2:0]= 01x).
  4. 4. Set TRGSRC[3:0] to 0 (TRGO selected).
  5. 5. Set TRGSENS to 0 (rising edge).
  6. 6. Set DFLTEN to 1.
  7. 7. Read TRGO bit until it is read to 0.
  8. 8. Set TRGO to 1. Then the acquisition sequence for all selected filters starts immediately.

To trigger a new acquisition (in case of single-shot) the application must do the following:

  1. 1. Check that the previous acquisition is completed, by waiting DFLTRUN= 0.
  2. 2. Read TRGO until it is read to 0.
  3. 3. Set again the bit TRGO to 1.

Discarded samples

The ADF offers the possibility to program the amount of samples to be discarded after each restart:

The discard function is controlled via NBDIS[7:0] as follows:

Refer to Figure 392 to Figure 396, and Figure 398.

In the example shown in Figure 398, the discard function is used to drop the first five samples provided by the digital filter (S1 to S5). The first sample transfered to the RXFIFO is S6.

Figure 398. Discard function example

Figure 398: Discard function example. A graph showing 'Output filter' vs 'time'. Samples S1 through S5 are marked with red crosses and labeled 'Dropped'. Samples S6, S7, S8, and S9... are marked with blue circles and labeled 'Provided to RXFIFO'. A period T_PCM is indicated between S5 and S6. The reference ID MSv63621V1 is at the bottom right.
Figure 398: Discard function example. A graph showing 'Output filter' vs 'time'. Samples S1 through S5 are marked with red crosses and labeled 'Dropped'. Samples S6, S7, S8, and S9... are marked with blue circles and labeled 'Provided to RXFIFO'. A period T_PCM is indicated between S5 and S6. The reference ID MSv63621V1 is at the bottom right.

46.4.9 Start-up sequence examples

Figure 399 details a start of acquisition sequence of a digital filter triggered by DFLTEN (ACQMOD[2:0] = 0), with NBDIS[7:0] = 3 (three samples to discard before acquisition).

The DFLT0 is configured for audio application: MCIC, RSFLT and HPF activated.The data interface (SITF0 or ADCITF) is assumed to be already activated.

Note: NBDIS[7:0] is set on purpose to a small value to simplify the drawing.

Figure 399. Start sequence with DFLTEN, in continuous mode, audio configuration

Figure 399: Start sequence with DFLTEN, in continuous mode, audio configuration. A timing diagram showing signals: ADCITF/SITF status (Enabled), ACQMOD (000), DFLTEN (pulsed high), adf_proc_ck (clock), bs0_[r|f]_ck (clock), MCIC dec. counter (0, 1 2 ... N), MCIC_OUT (x, MCIC_S0, ..., MCIC_S23), RSFLT dec. counter (0, 1..., ...4), RSFLT_OUT (x, RSFLT_S0 to RSFLT_S5), HPF_OUT (x, HPF_S0 to HPF_S5), NBDIS_CNTR (x, 3, 2, 1, 0), and Sample stored in RXFIFO (x, HPF_S3, HPF_S4, HPF_S5). Annotations show 'Re-sync of DFLTEN with adf_proc_ck', 'P1', and 'P2'. Reference ID MSv63664V1 is at the bottom right.
Figure 399: Start sequence with DFLTEN, in continuous mode, audio configuration. A timing diagram showing signals: ADCITF/SITF status (Enabled), ACQMOD (000), DFLTEN (pulsed high), adf_proc_ck (clock), bs0_[r|f]_ck (clock), MCIC dec. counter (0, 1 2 ... N), MCIC_OUT (x, MCIC_S0, ..., MCIC_S23), RSFLT dec. counter (0, 1..., ...4), RSFLT_OUT (x, RSFLT_S0 to RSFLT_S5), HPF_OUT (x, HPF_S0 to HPF_S5), NBDIS_CNTR (x, 3, 2, 1, 0), and Sample stored in RXFIFO (x, HPF_S3, HPF_S4, HPF_S5). Annotations show 'Re-sync of DFLTEN with adf_proc_ck', 'P1', and 'P2'. Reference ID MSv63664V1 is at the bottom right.

The DFLTEN bit is re-sampled into the ADF processing clock domain. When DFLTEN is detected high, the filter chain is enabled, and the decimation counter of the MCIC filter is incremented at the rate of the bitstream clock.

When the MCIC decimation counter reached its programmed value N, a sample is available for the RSFLT.

The RSFLT processes all the samples provided by the MCIC, and delivers a sample to the HPF every-time it processes four samples (decimation by 4). The RSFLT needs up to 24 cycles of adf_proc_ck clock before delivering a sample (P1).

The HPF processes all the samples provided by the RSFLT, but the NBDIS function prevents the data writing in the RXFIFO as long as NBDIS_CNTR does not reach 0.

When NBDIS_CNTR reaches 0, the samples provided by the HPF are stored into the RXFIFO.

46.4.10 Sound activity detection (SAD)

The SAD is based on the computation of the ambient noise level (ANLVL) and of the short-term sound level (SDLVL). The SAD offers the following ways to detect a sound:

As shown in Figure 400, the SAD takes the 16 MSB samples from the DFLT0 output.

Figure 400. SAD block diagram

Figure 400. SAD block diagram. The diagram shows the internal structure of the Sound Activity Detection (SAD) block. It receives PCM[23:0] data from DFLT0 and outputs sddet_evt and sdlvl_evt signals. The block includes a Logic unit, an SDLVL computation unit (containing an absolute value block |xn| and a Sound level (SDLVL) computation block), and a Detection unit (containing ANLVL update, Thresholds update, Learning phase ANLVL computation, and SAD trigger logic). Control signals ADF_SADCR.SADEN, ADF_SADCR.DATCAP[1:0], and ADF_SADCR.SADST[1:0] are inputs to the Logic unit. The output of the Logic unit controls a switch between RXFIFO0 and DFLT0 for the PCM[23:0] input. The Detection unit also receives inputs from the SDLVL computation unit and the Logic unit. The output of the Detection unit is sddet_evt. The output of the Detection unit is also sdlvl_evt. The diagram is labeled MSv63623V1.
Figure 400. SAD block diagram. The diagram shows the internal structure of the Sound Activity Detection (SAD) block. It receives PCM[23:0] data from DFLT0 and outputs sddet_evt and sdlvl_evt signals. The block includes a Logic unit, an SDLVL computation unit (containing an absolute value block |xn| and a Sound level (SDLVL) computation block), and a Detection unit (containing ANLVL update, Thresholds update, Learning phase ANLVL computation, and SAD trigger logic). Control signals ADF_SADCR.SADEN, ADF_SADCR.DATCAP[1:0], and ADF_SADCR.SADST[1:0] are inputs to the Logic unit. The output of the Logic unit controls a switch between RXFIFO0 and DFLT0 for the PCM[23:0] input. The Detection unit also receives inputs from the SDLVL computation unit and the Logic unit. The output of the Detection unit is sddet_evt. The output of the Detection unit is also sdlvl_evt. The diagram is labeled MSv63623V1.

The SAD is highly configurable, and the application can adjust several parameters:

SAD detection behavior

The SAD can use the following ways to detect a sound, selected by SADMOD[1:0]:

SAD states

As shown in Figure 400, the SAD works as follows:

  1. 1. When enabled (SADEN = 1), the SAD is first in LEARN state to perform a first estimation of the ambient noise level.
  2. 2. The SAD continuously computes the short-term sound level (SDLVL) using the samples provided by the DFLT0. The amount of samples used to compute the sound level is given by FRSIZE[2:0]. The samples processed by the DFLT0 can be transferred into the memory or not depending on DATCAP[1:0] value.
  3. 3. The initial ambient noise level (ANLVL) is computed using the consecutive sound level values. The application can define how much sound level values are used to perform the computation of this initial ambient noise estimation (LFRNB).
  4. 4. When the initial ambient noise level (ANLVL) is computed, the SAD switches to the MONITOR state.
  5. 5. Every time a new short-term sound level value is available, the SAD updates the ambient noise level and the thresholds according to the selected detection mode.
  6. 6. If the SAD triggers, then the following happens:
    • – The SAD switches to DETECT state.
    • – The sddet_evt event is asserted.
    • – The adf_sad_det signal is set to high.
  7. 7. The hangover function insures that the DETECT state is maintained even if the sound level goes below the threshold level for a time given by HGOVR.

Figure 401. SAD flow diagram

Flowchart of the SAD (Sound Activity Detection) process. It starts with 'SAD enable' leading to 'SADST = LEARN'. Then 'Compute sound level (SDLVL) (using FRSIZE samples)'. A decision 'SADST = LEARN?' branches to 'Compute initial ambient noise level (ANLVL) (using LFRNB, SDLVL)' if Y, or to the mode-specific update blocks if N. The mode-specific blocks are: 'When SADMOD = 1x' (Update ANLVL, Update THRH/THRL, SELSIG = ANLVL), 'When SADMOD = 01' (Update THRH/THRL, SELSIG = SDLVL), and 'When SADMOD = 0' (Update ANLVL, Update THRH/THRL, SELSIG = SDLVL). After these, a decision 'SADST = MONITOR?' leads to 'THR = THRL' (N) or 'THR = THRH' (Y). Then 'SELSIG > THR?' leads to 'HGCNT = 0?' (N) or 'SADST = DETECT' (Y). 'HGCNT = 0?' leads to 'HGCNT = HGCNT - 1' (N) or 'SADST = MONITOR' (Y). Finally, 'ANLVL update' and 'ANLVL update if SADMOD = 1x' lead back to the start. Reference: MSv62687V1.
graph TD
    Start([SAD enable]) --> Learn[SADST = LEARN]
    Learn --> ComputeSDLVL[Compute sound level (SDLVL)
(using FRSIZE samples)] ComputeSDLVL --> LearnCheck{SADST = LEARN?} LearnCheck -- Y --> ComputeANLVL[Compute initial ambient noise level (ANLVL)
(using LFRNB, SDLVL)] LearnCheck -- N --> ModeBlocks ComputeANLVL --> ANLVLCheck{ANLVL available?} ANLVLCheck -- Y --> ModeBlocks ANLVLCheck -- N --> MonitorSet[SADST = MONITOR] MonitorSet --> ModeBlocks subgraph ModeBlocks [Mode Specific Updates] direction LR subgraph WhenSADMOD1x [When SADMOD = 1x] U1[Update ANLVL
(Using SDLVL, ANSLP)] U2[Update THRH, THRL values
(Using ANMIN, HYSTEN, SNTHR)] S1[SELSIG = ANLVL] U1 --> U2 --> S1 end subgraph WhenSADMOD01 [When SADMOD = 01] U3[Update THRH, THRL values
(Using ANMIN, HYSTEN, SNTHR)] S2[SELSIG = SDLVL] U3 --> S2 end subgraph WhenSADMOD0 [When SADMOD = 0] U4[Update ANLVL
(Using SDLVL, ANSLP, ANMIN)] U5[Update THRH, THRL values
(Using ANLVL, HYSTEN, SNTHR)] S3[SELSIG = SDLVL] U4 --> U5 --> S3 end end ModeBlocks --> MonitorCheck{SADST = MONITOR?} MonitorCheck -- N --> THRRL[THR = THRL] MonitorCheck -- Y --> THRH[THR = THRH] THRRL --> ThresholdCheck{SELSIG > THR?} THRH --> ThresholdCheck ThresholdCheck -- N --> HGCNTCheck{HGCNT = 0?} ThresholdCheck -- Y --> Detect[SADST = DETECT] HGCNTCheck -- N --> DecHGCNT[HGCNT = HGCNT - 1] HGCNTCheck -- Y --> MonitorSet2[SADST = MONITOR] DecHGCNT --> ANLVLUpdate[ANLVL update] MonitorSet2 --> ANLVLUpdate Detect --> HGCNTSet[HGCNT = HOVR] HGCNTSet --> ANLVLUpdate2[ANLVL update
if SADMOD = 1x] ANLVLUpdate --> Start ANLVLUpdate2 --> Start

MSv62687V1

Flowchart of the SAD (Sound Activity Detection) process. It starts with 'SAD enable' leading to 'SADST = LEARN'. Then 'Compute sound level (SDLVL) (using FRSIZE samples)'. A decision 'SADST = LEARN?' branches to 'Compute initial ambient noise level (ANLVL) (using LFRNB, SDLVL)' if Y, or to the mode-specific update blocks if N. The mode-specific blocks are: 'When SADMOD = 1x' (Update ANLVL, Update THRH/THRL, SELSIG = ANLVL), 'When SADMOD = 01' (Update THRH/THRL, SELSIG = SDLVL), and 'When SADMOD = 0' (Update ANLVL, Update THRH/THRL, SELSIG = SDLVL). After these, a decision 'SADST = MONITOR?' leads to 'THR = THRL' (N) or 'THR = THRH' (Y). Then 'SELSIG > THR?' leads to 'HGCNT = 0?' (N) or 'SADST = DETECT' (Y). 'HGCNT = 0?' leads to 'HGCNT = HGCNT - 1' (N) or 'SADST = MONITOR' (Y). Finally, 'ANLVL update' and 'ANLVL update if SADMOD = 1x' lead back to the start. Reference: MSv62687V1.

Sound level computation (SDLVL)

Once enabled, the SAD computes continuously the sound level value. The sound level represents the average of the absolute value of an amount of PCM samples given by FRSIZE[2:0].

\[SDLVL = \frac{1}{N_{FRSIZE}} \times \sum_{n=1}^{N_{FRSIZE}} |PCM(n)|\]

where \(N_{FRSIZE}\) is the amount of PCM samples given by FRSIZE[2:0].

Ambient noise estimation (ANLVL)

The ambient noise level (ANLVL) is computed when SADMOD[1:0] is 00 or 10.

The ambient noise level is computed differently according to the state of the SAD as detailed below:

Every time the SAD is enabled, a learning phase is initiated in order to estimate a first value of the ambient noise level. During this phase, the SAD cannot trigger.

During the LEARN phase, the ambient noise level is computed as follows:

\[ANLVL = \frac{1}{N_{LFRNB}} \times \sum_{n=1}^{N_{LFRNB}} |SDLVL(n)|\]

where \(N_{LFRNB}\) is the amount of frames given by LFRNB[2:0] bitfield.

When the learning phase is completed, the SAD updates the ambient noise level in the following way:

\[ANLVL\_UP = ANLVL * (1+2^{(ANSLP-12)})\]

\[ANLVL\_DN = ANLVL * (1-2^{(ANSLP-10)})\]

The ANLVL is not updated if the current sound level is higher than the threshold level, except if SADMOD[1:0] = 10.

The slope of the noise estimator can be adjusted to optimize the detection of the wanted signal. This slope is adjusted via ANSLP[2:0] in the ADF SAD configuration register (ADF_SADCFGR).

Table 422 shows the allowed values according to the frame size and the sampling rate of the data observed by the SAD. The recommended values when the SADMOD[1:0] = 0 are the ones into the gray shaded cells.

Table 422. ANSLP values versus FRSIZE and sampling rates

FRSIZEANSLP values for Fs = 8 kHzANSLP values for Fs = 16 kHz
Slow(1)typical(2)Fast(3)Slow(1)typical(2)Fast(3)
0 (8 samples)012-01
1 (16 samples)123012
2 (32 samples)234123
3 (64 samples)345234
4 (128 samples)456345
5 (256 samples)567456
6 (512 samples)67-567
  1. 1. The slow slope is equal to - 8.5 dB/s for the negative slope and + 2.1 dB/s for the positive slope.
  2. 2. The typical slope is equal to - 17.1 dB/s for the negative slope and + 4.2 dB/s for the positive slope.
  3. 3. The fast slope is equal to - 34.2 dB/s for the negative slope and + 8.5 dB/s for the positive slope.

The slopes can also be computed using the following formulas:

\[SLC_{UP} = 20 \times \frac{F_s}{F_{SIZE}} \times \log_{10}(1 + 2^{(ANSLP - 12)})\]

\[SLC_{DN} = 20 \times \frac{F_s}{F_{SIZE}} \times \log_{10}(1 - 2^{(ANSLP - 10)})\]

where FS is the sampling rate of the stream observed by the SAD and FSIZE is the frame size defined by FRSIZE[2:0].

Threshold computation

The way the threshold value is computed depends on SADMOD[1:0]:

\[THR_H = ANLVL \times 10^{\frac{GdB_{SNTHR}}{20}}\]

This threshold value is then compared to the current sound level (SDLVL).

\[THR_H = ANMIN \times 10^{\frac{GdB_{SNTHR}}{20}}\]

This threshold value is then compared to the current sound level (SDLVL).

\[THR_H = ANMIN \times 4\]

This threshold value is then compared to:

\[ANLVL \times 10^{\frac{GdB_{SNTHR}}{20}}\]

The hysteresis mode can be enabled to reduce the spurious transitions between MONITOR and DETECT states. In hysteresis mode (HYSTEN = 1), the following threshold values are used:

Table 423 shows the thresholds values according to SNTHR.

Table 423. Threshold values according SNTHR(1)

SNTHR[3:0]THRHTHRLComments
0LVL + 3.5 dBLVL x 1.5LVL + 3.5 dBLVL x 1.5No hysteresis
1LVL + 6.0 dBLVL x 2LVL + 3.5 dBLVL x 1.5Hysteresis of 2.5 dB
2LVL + 9.5 dBLVL x 3LVL + 6.0 dBLVL x 2Hysteresis of 3.5 dB
3LVL + 12.0 dBLVL x 4LVL + 9.5 dBLVL x 3Hysteresis of 2.5 dB
4LVL + 15.6 dBLVL x 6LVL + 12.0 dBLVL x 4Hysteresis of 3.5 dB
5LVL + 18.1 dBLVL x 8LVL + 15.6 dBLVL x 6Hysteresis of 2.5 dB
6LVL + 21.6 dBLVL x 12LVL + 18.1 dBLVL x 8Hysteresis of 3.5 dB
7LVL + 24.1 dBLVL x 16LVL + 21.6 dBLVL x 12Hysteresis of 2.5 dB
8LVL + 27.6 dBLVL x 24LVL + 24.1dBLVL x 16Hysteresis of 3.5 dB
9LVL + 30.1 dBLVL x 32LVL + 27.6dBLVL x 24Hysteresis of 2.5 dB

1. LVL must be replaced by ANLVL when SADMOD[1:0] = 0 and by ANMIN for other SADMOD[1:0] values.

When the hysteresis function is disabled, the SAD always use THRH.

Note: The hysteresis mode must not be used when SADMOD[1:0] = 1x.

Trigger logic

The signal compared to this threshold depends also on SADMOD[1:0].

The trigger condition is reached when the selected signal (SELSIG) is bigger than the threshold level.

If the trigger condition is met, the following happens:

The SAD remains in DETECT state as long as the trigger condition is met or the hangover down-counter is different from 0.

The sddet_evt event indicates when the SAD enters and/or exits the DETECT state. This event is used to generate an interrupt when a sound is detected or when a sound is no longer detected:

The adf_sad_det signal remains high as long as the SAD is in DETECT state.

The SAD also provides a flag indicating that a new sound level value is available (SDLVLF). The last computed sound level (SDLVL[14:0]) is available in the ADF SAD sound level register (ADF_SADSDLVR), and the last computed ambient noise level (ANLVL[14:0]), in the ADF SAD ambient noise level register (ADF_SADANLVR).

Note: The SAD can work even when the AHB clock is not present. In that case, the SAD does not update SDLVL[14:0] and ANLVL[14:0].

To get the latest valid SDLVL[14:0] and ANLVL[14:0] values, the application must read the ADF_SADSDLVR, and ADF_SADANLVR registers, when the SDLVLF flag goes high. This can be done in the following ways:

Sample transfer to memory

The SAD offers the following options to control the samples transfer from DFLT0 to the system memory:

Note: DATCAP[1:0] is taken into account only when the SADEN = 1. For example, if the SAD configuration is DATCAP[1:0] = 0, SADEN = DFLTEN = 1, and if the application sets now SADEN to 0, the samples provided by the DFLT0 are transferred to the RXFIFO.

Programming recommendations

To make the SAD function working properly, the ADF must be programmed as follows:

  1. 1. Provide the proper kernel clock (adf_ker_ck) to the ADF.
  2. 2. Configure the CKGEN and enable it.
  3. 3. Configure the SITF and enable it (note that microphones have a settling time of several milliseconds).
  4. 4. Configure the DFLT0. A typical setting is the following:
    • – CIC5 with a decimation ratio of 12, 16 or 24
    • – RSFLT with a decimation ratio of 4
    • – HPF with HPFC = 2 or 3
    For a very-low power implementation, the RSFLT can be bypassed.
  5. 5. Set SADEN to 0.
  6. 6. Wait for SADACTIVE = 0. If SADEN was previously enabled, this phase can take two periods of adf_hclk, and two periods of adf_proc_ck.
  7. 7. Configure the SAD as follows:
    • – Set DATCAP[1:0] to 0, if the application does not want to store the samples into the system memory.
    • – Set DATCAP[1:0] to 01, if the application wants to store the samples into the system memory only when the SAD detects a sound.
    • – Set DATCAP[1:0] to 11, if the application wants to store the samples into the system memory continuously.
  8. 8. Configure the DMA (optional).
  9. 9. Enable the SAD.
  10. 10. Enable the DFLT0.

Figure 401 shows a simplified timing diagram when the SAD works with DATCAP[1:0] = 01.

Thanks to the kernel clock (adf_ker_ck), the SAD continuously monitors the audio signal provided by the DFLT0. The threshold is also continuously updated according to the ambient noise level estimation.

memory and the application can clean up the receive buffer for the next detection (see 4 in Figure 401).

Figure 402. SAD timing diagram example

Timing diagram for SAD showing Threshold, Signal provided by DFLT0, SADST (LEARN, MONITOR, DETECT, MONITOR), adf_sad_det, adf_bus_ckreq, adf_hclk, adf_flt0_it, Sample transfer to memory, and adf_ker_ck. It includes markers 1, 2, 3, 4 and a note 'SDDETF flag cleared!'.

The diagram illustrates the timing relationship between various signals during SAD (Short-term Average to Long-term Average) detection. It shows a signal waveform and a threshold line. The SADST state machine progresses through LEARN, MONITOR, DETECT, and back to MONITOR. Key events are marked with circled numbers 1 through 4. adf_sad_det is an active-low signal that goes low at the start of detection (1) and high again at the end (4). adf_bus_ckreq and adf_hclk are active during the detection phase. adf_flt0_it is an interrupt signal that goes high when the SDDETF flag is cleared. Sample transfer to memory occurs during the detection phase, synchronized with adf_ker_ck.

Timing diagram for SAD showing Threshold, Signal provided by DFLT0, SADST (LEARN, MONITOR, DETECT, MONITOR), adf_sad_det, adf_bus_ckreq, adf_hclk, adf_flt0_it, Sample transfer to memory, and adf_ker_ck. It includes markers 1, 2, 3, 4 and a note 'SDDETF flag cleared!'.

46.4.11 Data transfer to memory

Data format

The samples processed by DFLT0 are stored into a RXFIFO. The application can read the samples stored into these FIFOs via the ADF digital filter data register 0 (ADF_DFLT0DR). The samples inside this register are signed and left aligned. The bit 31 always represents the sign.

The ADF provides 24-bit left-aligned data. Performing a 16-bit access to ADF_DFLT0DR allows the application to get the 16 most significant bits. Performing a 32-bit access to ADF_DFLT0DR allows the application to get a 24-bit data size.

Figure 403. ADF_DFLTxDR data format

Diagram showing RXFIFO width and ADF_DFLT0DR data format. It details the bit layout for PCM[23:0] and zero's padding within a 32-bit register.

The diagram shows the data format for the ADF_DFLTxDR register. It starts with a representation of the RXFIFO width, showing multiple samples of width 24 bits (bits 23 to 0) stacked vertically, with a total depth of FIFO_DEPTH. Below this, the 32-bit layout of the ADF_DFLT0DR register is shown. Bits 31 to 7 contain the PCM data (bits 23:0), which is left-aligned. Bits 6 to 0 are filled with zero's. Bit 31 is the sign bit for the PCM data.

Diagram showing RXFIFO width and ADF_DFLT0DR data format. It details the bit layout for PCM[23:0] and zero's padding within a 32-bit register.

Data re-synchronization

The samples stored into the RXFIFO can be transferred into the memory by using either DMA requests or interrupt signaling.

Note: The RXFIFO is located into the adf_ker_ck clock domain, while ADF_DFLT0DR is located into the adf_hclk (AHB) clock domain.

When the AHB clock is available, if ADF_DFLT0DR is empty and if a sample is available into the RXFIFO, this sample is transferred into ADF_DFLT0DR.

The sample transfer from the RXFIFO to ADF_DFLT0DR takes two periods of the AHB clock (adf_hclk) and two periods of the adf_ker_ck clock. The ADF inserts automatically wait-states if the application performs a read operation of ADF_DFLT0DR while the transfer of the new sample from the RXFIFO to ADF_DFLT0DR is not yet completed.

Figure 404. Data re-synchronization

Block diagram of data re-synchronization in the ADF. The diagram shows two clock domains: the AHB clock domain (dark gray) and the adf_ker_ck clock domain (light gray). Within the AHB domain is the ADF_DFLT0DR register. Within the adf_ker_ck domain are the RXFIFO and the Digital filter processing (DFLT0) block. A 'sync' block is positioned between the two domains, with arrows indicating data flow from DFLT0 to RXFIFO, RXFIFO to sync, and sync to ADF_DFLT0DR. The reference ID MSv63666V1 is in the bottom right corner.
Block diagram of data re-synchronization in the ADF. The diagram shows two clock domains: the AHB clock domain (dark gray) and the adf_ker_ck clock domain (light gray). Within the AHB domain is the ADF_DFLT0DR register. Within the adf_ker_ck domain are the RXFIFO and the Digital filter processing (DFLT0) block. A 'sync' block is positioned between the two domains, with arrows indicating data flow from DFLT0 to RXFIFO, RXFIFO to sync, and sync to ADF_DFLT0DR. The reference ID MSv63666V1 is in the bottom right corner.

Data transfer

The content of the RXFIFO can be transferred to the memory either by using a DMA channel or interrupt services.

Both single and burst, DMA transfers are supported by the ADF, but the application has to care about the following points:

Note: The burst mode is not available in all products (see the DMA section to check if the product supports it).

In addition, the application can select the RXFIFO threshold (FTH bit) in order to trigger the data transfer: a data transfer can be triggered as soon as the RXFIFO is not empty, or when the RXFIFO is half-full (containing depth/2 samples).

For the DMA transfer, as soon as one of the RXFIFO reaches the threshold level, the DMA request is asserted in order to ask for data transfer. Successive DMA requests are performed as long as the RXFIFO is not empty.

The DMA mode of the RXFIFO is enabled via the DMAEN bit in ADF_DFLT0DR.

For the interrupt signaling, the following cases must be considered:

met again. In this mode, every time an interrupt occurs, the application is supposed to read FIFO_SIZE/2 data.

RXFIFO overrun

A RXFIFO overrun condition is detected when the RXFIFO is full, and a new sample from the DFLT0 must be written.

In this case, DOVRF is set and the new sample is dropped. When the RXFIFO has at least one location available, the new incoming sample is written into the RXFIFO.

Figure 405 shows an example based on a RXFIFO depth of four words and FTH set to 1, so that FTHF goes to 1 when the RXFIFO is half-full.

The S7 sample is lost due to an overrun: the RXFIFO is full while S7 must be written into the RXFIFO. The S7 write operation is not performed. DOVRF is set to 1 at the moment where the write operation was expected. The overflow event remains to 1 as long as it is not cleared by the application.

In this example, DOVRIE is set to 1 to have an interrupt if an overrun condition is detected.

After the S7 sample, the application manages to read data from the RXFIFO, and the ADF can write the S8 sample and consecutive. Later, the application clears DOVR, allowing the detection of a new overrun situation.

In the adf_hclk line, the gray boxes indicate that the ADF requested the AHB clock.

Figure 405 shows the AHB clock available only when the ADF requests it. In real applications, the AHB clock may also be present if the ADF does not request it.

Figure 405. Example of overflow and transfer to memory

Timing diagram showing RXFIFO overrun and data transfer to memory. The diagram includes signals: adf_ker_ck, Data from DFLT0 (samples S1-S12), Data write into RXFIFO, RXFIFO Level (0-4), RXFIFO Full, FTHF, RXNEF, adf_hclk, read access to RXFIFO, and DOVRF. S7 is marked as lost due to overrun. DOVRF is set to 1 at the overrun and cleared after data is read.

The diagram illustrates the RXFIFO overrun and data transfer to memory. It shows the following signals and events:

Annotations in the diagram include:

Timing diagram showing RXFIFO overrun and data transfer to memory. The diagram includes signals: adf_ker_ck, Data from DFLT0 (samples S1-S12), Data write into RXFIFO, RXFIFO Level (0-4), RXFIFO Full, FTHF, RXNEF, adf_hclk, read access to RXFIFO, and DOVRF. S7 is marked as lost due to overrun. DOVRF is set to 1 at the overrun and cleared after data is read.

46.4.12 Autonomous mode

The ADF can work even if the AHB bus clock is not available (Stop modes). The ADF uses the AHB clock only for the register interface. All the processing part is clocked with the kernel clock.

In Stop mode, the ADF receives a kernel clock if the following conditions are met:

In Stop mode, the ADF receives the AHB clock if the following conditions are met:

46.4.13 Register protection

The ADF embeds some hardware protection to prevent invalid situations.

Table 424 shows the list of write-protected and unprotected fields.

Table 424. Register protection summary

RegistersUnprotected fieldsWrite-protected fieldsWrite-protection condition
ADF global control register (ADF_GCR)TRGO-DFLTACTIVE0 = 1
ADF clock generator control register (ADF_CKGR)CKGDEN
CCK0EN
CCK1EN
PROC DIV[6:0], CCKDIV[3:0],
CKGMOD, TRGSRC[3:0],
TRGSENS, CCK[1:0]DIR
CKGACTIVE = 1
ADF serial interface control register 0 (ADF_SITF0CR)SITFENSTH[4:0], SITFMOD[1:0],
SCKSRC[1:0]
SITFACTIVEx = 1
ADF bitstream matrix control register 0 (ADF_BSMX0CR)-BSSEL[4:0]DFLTACTIVEx = 1
ADF digital filter control register 0 (ADF_DFLT0CR)DFLTENNBDIS[7:0], TRGSRC[3:0],
TRGSENS, FTH, DMAEN,
SNPSFMT, ACQMOD[2:0]
DFLTACTIVEx = 1
ADF digital filter configuration register 0 (ADF_DFLT0CICR)SCALE[5:0]MCICD[8:0], CICMOD[2:0],
DATSRC[1:0]
ADF reshape filter configuration register 0 (ADF_DFLT0RSFR)-All fields
ADF delay control register 0 (ADF_DLY0CR)-SKPDLY[6:0]SKPBF = 1

Table 424. Register protection summary (continued)

RegistersUnprotected fieldsWrite-protected fieldsWrite-protection condition
ADF DFLT0 interrupt enable register (ADF_DFLT0IER)All fields--
ADF DFLT0 interrupt status register 0 (ADF_DFLT0ISR)All fields--
ADF SAD control register (ADF_SADCR)SADENFRSIZE[2:0], DETCFG, SADMOD[1:0], HYSTEN, DATCAP[1:0]SADACTIVE = 1
ADF SAD configuration register (ADF_SADCFGR)-ANMIN[12:0], SNTHR[3:0], HGOVR[3:0], LFRNB[2:0], ANSLP[2:0]SADACTIVE = 1

All the ADF processing is performed in the adf_proc_ck clock domain. For that reason, enabling or disabling an ADF sub-block may take some time due to the re-synchronization between the AHB clock domain and the adf_proc_ck clock domain. XXXACTIVE flags are available to allow the application to check that the synchronization between the two clock domains is completed.

To change a write-protected bitfield, the application must follow this sequence:

  1. 1. Set the enable bit of the sub-block to 0.
  2. 2. Wait for corresponding flag XXXACTIVE = 0.
  3. 3. Modify the wanted fields.
  4. 4. Set the enable bit of the sub-block to 1.

Refer to the description of each sub-block for details.

46.5 ADF low-power modes

Table 425. Effect of low-power modes on ADF

ModeDescription
SleepNo effect. ADF interrupts cause the device to exit the Sleep mode.
Stop(1)The ADF registers content is kept.
Thanks to the kernel clock request feature, if the ADF is clocked by an internal oscillator available in Stop mode, the ADF remains active. The interrupts cause the device to exit Stop mode.
StandbyThe ADF is powered down and must be reinitialized after exiting Standby mode.

46.6 ADF interrupts

To increase the CPU performance, the ADF offers an interrupt line (adf_flt0_it), sensitive to several events.

Note: The status flags are available even if the corresponding interrupt enable flag is not enabled.

The interrupt interface is controlled via the ADF DFLT0 interrupt enable register (ADF_DFLT0IER) and the ADF DFLT0 interrupt status register 0 (ADF_DFLT0ISR).

Figure 406. ADF interrupt interface

Figure 406. ADF interrupt interface

(1) Only present if the SAD is implemented, refer to section ADF implementation for details.

MSv63668V2

Figure 406. ADF interrupt interface

Table 426 shows which interrupt line is affected by which event, and how to clear and activate each interrupt/event.

Table 426. ADF interrupt requests

Interrupt vectorInterrupt eventEvent flagEvent/interrupt clearing methodExit Sleep modeExit Stop modes(1)Exit Standby mode
ADF_FLT0(2)RXFIFO threshold reachedFTHFRead ADF_DFLT0DR until RXFIFO level is lower than the threshold.YesYesNo
RXFIFO overrunDOVRFWrite DOVRF to 1.
RSFLT overrunRFOVRFWrite RFOVRF to 1.
Saturation detectionSATFWrite SATF to 1.
Channel clock absence detectionCKABFWrite CKABF to 1.
SAD: sound detectedSDDETFWrite SDDETF to 1.
SAD: sound level value availableSDLVLFWrite SDLVLF to 1.
  1. 1. Refer to Section 46.3: ADF implementation for details.
  2. 2. ADF_FLT0 vector corresponds to the assertion of adf_flt0_it signal.

46.7 ADF application information

46.7.1 ADF configuration examples for audio capture

Table 427 gives some examples of the ADF settings for the digital microphones, focusing on 16 and 48 kHz output data rate.

Configurations #1 and #2 are for very low-power use-cases and have a reduced signal-to-noise ratio. The user must also insure that the selected digital microphone can work properly at 512 kHz. These configurations can be used for sound detection. The RSFLT is not used to reduce as much as possible the frequency of the kernel clock (adf_ker_ck).

Configurations #3, #4, #9, #10, #11 give signal-to-noise ratios around 115 dB, with an ideal microphone model, with a sinus signal of 997 Hz. Using the RSFLT allows a good control on the in-band ripple, and a good image rejection.

Configurations #7, #8, #10 give signal-to-noise ratio around 120 dB, with an ideal microphone model, using a sinus signal of 997 Hz.

Table 427. Examples of ADF settings for microphone capture

Configurationadf_ker_ck (MHz)PROC DIV + 1CCK DIV + 1CIC order (1)MCICD + 1SCALERSFLT BYPRSFLT DHPFBYP-adf_proc_ck (MHz)Total dec. ratioFRS (kHz)FADF_CCKx (MHz)FPCM (kHz)
#11.024124640x2D (- 8.5 dB)1xx=>1.02464-0.5128
#2125320x2B (- 14.5 dB)32-16
#3125160x01 (+ 3.5 dB)64328
#42.048125160x01 (+ 3.5 dB)002.04864641.02416
#53.07216580x0B (+ 33.6 dB)003.07232320.5128
#6225120x06 (+ 18.1 dB)48640.76816
#7125240x2C (- 12 dB)961.536
#84.096125320x27 (- 26.6 dB)004.096128642.04816
#96.144325160x02 (+ 6.0 dB)002.04864641.02416
#10225240x2C (- 12 dB)3.072961.536
#11125160x01 (+ 3.5 dB)6.144641923.07248
#127.680125200x2E (- 6.0 dB)007.680801923.84048
  1. 1. CICMOD = 100 for CIC order equal to 4. CICMOD = 101 for CIC order equal to 5.

46.7.2 Programming examples

Example 1

This example describes the programming of ADF for the capture of a signal coming from a digital microphone, using only the CIC4, with a decimation of 48, assuming that the kernel clock is 1.536 MHz. Typically, this configuration can be used to detect sound using the SAD.

Table 428. Programming sequence (CIC4)

OperationsComments
Adjust the proper kernel clock frequency via the RCCAssuming that the RCC is programmed to provide a kernel clock (adf_ker_ck) of 1.536 MHz coming from a RC oscillator.
Select the proper ADF kernel clock source via the RCCRefer to the RCC of the product.
Enable the ADF clocks via the RCCRefer to the RCC of the product.
Reset the ADF via the RCCRefer to the RCC of the product.
AFMUX programmingProgram the AFMUX to select ADF_SD0 and ADF_CCK0 functions.
Enable ADF processing clock:
ADF_CKGCR = 0x0001 0023
PROCDIV = 0 (bypass): adf_proc_ck frequency is 1.536 MHz.
CCKDIV = 1 (division by 2): ADF_CCK0 clock frequency is 768 kHz.
The ADF_CCK0 pin is set in output and generates a clock so that the microphone can exit from low-power mode.
Serial interfaces configuration:
ADF_SITF0CR = 0x0000 1F01
SCKSRC = 0 to select ADF_CCK0 as serial clock.
SIFTMOD = 0 to select LF_MASTER SPI mode.
Clock absence feature is not working in this mode.
The serial interface is enabled.
Bitstream matrix configuration:
ADF_BSMX0CR = 0x0000 0000
DFLT0 filter takes the bitstream of SITF0, sampled on rising edge
Filters configuration (CIC):
ADF_DFLT0CICR = 0x0040 2F40
SCALE = 0x04 (12 dB): RSFLT is not enabled. Note that the gain is 8.5 dB, higher than recommended in order to improve signal accuracy for the SAD. Saturation is not an issue in this case, as only the detection of a signal much lower than the full scale is needed.
MCICD = 0x2F (decimation by 48)
CICMOD = 4 to select a Sinc4
DATSCR = 0 to select data coming from BSMX
Filters configuration (RSFLT and HPF):
ADF_DFLT0RSFR = 0x0000 0301
HPFC = 3: cut-off frequency of 16kHz * 0.0095 = 152 Hz
HPFBYP = 0: HPF not bypassed
RSFLTBYP = 1: RSFLT bypassed
Micro delay adjust:
ADF_DLY0CR = 0x0000 0000
Not used in this example
Enable interrupt events:
ADF_DFLT0IER = 0x0000 1000
Enable the interrupt events the application wants to handle.
In this example, SDDETIE is set to 1 to have an interrupt if a sound is detected.
Table 428. Programming sequence (CIC4) (continued)
OperationsComments
SAD setting:
ADF_SADCR = 0x0000 1400
SADMOD = 1: Trigger based on sound level values
FRSIZE = 4: Sound level computed on 128 samples
HYSTEN = 0: No hysteresis
DETCFG = 0: interrupt generated when the SAD enters in DETECT state
DATCAP = 0: samples not transferred to memory
SADEN = 0: SAD not yet enabled
SAD setting:
ADF_SADCFGR = 0x0025 0001
ANMIN = 0x25: Sound threshold of \(37 * 10^{\text{SNTHR}}/20 = 74 \text{ LSB}^{(1)}\)
HGOVR = 0: four frames (4 x 128 = 512 samples)
LFRNB = 0: Learning phase set to two frames. Not useful in this mode.
ANSLP = 0: Not used in this mode
SNTHR = 1: Threshold set to 6 dB (see ANMIN)
Clear status flags:
ADF_DFLT0ISR = 0x0000 0FFF
Clear all the status flags before running the ADF
Enable the SAD:
ADF_SADCR = 0x0000 1401
Wait for SADACTIVE flag = 1
Enable first the SAD, in order to be sure that data transfer to memory are blocked by the SAD.
Enable the filter:
ADF_DFLT0CR = 0x0000 0001
NBDIS = 0: no samples discarded
ACQMOD = 0: Asynchronous continuous acquisition mode
DMAEN = 0: DMA interface not used
DFLTEN = 1: Filter enabled

Example 2

This example describes the programming of ADF for the capture of a signal coming from a digital microphone, using the CIC5, and the RSFLT, with a total decimation of 64.

Table 429. Programming sequence (CIC5)
OperationsComments
Adjust the proper kernel clock frequency via the RCCAssuming that the RCC is programmed to provide a kernel clock (adf_ker_ck) of 6.144 MHz
Select the proper ADF kernel clock source via the RCCRefer to the RCC of the product.
Enable the ADF clocks via the RCCRefer to the RCC of the product.
Reset the ADF via the RCCRefer to the RCC of the product.
AFMUX programmingProgram the AFMUX to select ADF_SD0 and ADF_CCK0 functions.
Enable ADF processing clock:
ADF_CKGCR = 0x0201 0023
PROC DIV = 2 (division by 3): adf_proc_ck frequency is 6.144 MHz.
CCKDIV = 1 (division by 2): ADF_CCK0 clock frequency is 1.024 MHz.
The ADF_CCK0 pin is set in output and generates a clock so that the microphone can exit from low-power mode.

Table 429. Programming sequence (CIC5) (continued)

OperationsComments
Serial interfaces configuration:
ADF_SITF0CR = 0x0000 1F01
SCKSRC = 0 to select ADF_CCK0 as serial clock.
SIFTMOD = 0 to select LF_MASTER SIPI mode.
Clock absence feature is not working in this mode.
The serial interface is enabled.
Bitstream matrix configuration:
ADF_BSMX0CR = 0x0000 0000
DFLT0 filter takes the bitstream of SITF0, sampled on rising edge
Digital filter control:
ADF_DFLT0CR = 0x0000 0006
NBDIS = 0: no samples discarded
ACQMOD = 0: Asynchronous continuous acquisition mode
DMAEN = 1: DMA interface not used
DFLTEN = 0: Filter disabled
FTH = 1: RXFIFO half-full
Filters configuration (CIC):
ADF_DFLT0CICR = 0x0010 0F50
SCALE = 0x01(+3.5 dB): Output limited to 22 bits due to RSFLT.
MCICD = 0xF (decimation by 16)
CICMOD = 5 to select a Sinc5
DATSCR = 0 to select data coming from BSMX
Filters configuration (RSFLT and HPF):
ADF_DFLT0RSFR = 0x0000 0200
HPFC = 2: cut-off frequency of 16 kHz * 0.0025 = 40 Hz
HPFBYP = 0: HPF not bypassed
RSFLTBYP = 0: RSFLT not bypassed
RSFLTD = 0: Decimation by 4
Micro delay adjust:
ADF_DLY0CR = 0x0000 0000
Not used in this example
Enable interrupt events:
ADF_DFLT0IER = x
Enable the interrupt events the application wants to handle.
Clear status flags:
ADF_DFLT0ISR = 0x0000 0FFF
Clear all the status flags before running the ADF
Program the DMA
Enable the DMA
The DMA must be programmed in order to read the data inside the ADF_DLT0DR register every time a DMA request is generated.
Start acquisition:
ADF_DFLT0CR = 0x0000 0007
The ADF starts to filter data.

46.7.3 Connection examples

Figure 406 shows simple connection examples of the ADF to external sensors.

Figure 407. Sensor connection examples

Figure 407. Sensor connection examples: Diagram showing three connection configurations for digital microphones to ADF - Digital microphones (reduced IOs), Digital microphones (optimal power), and Single sensor.
Figure 407. Sensor connection examples: Diagram showing three connection configurations for digital microphones to ADF - Digital microphones (reduced IOs), Digital microphones (optimal power), and Single sensor.

46.7.4 Global frequency response

Figure 407 shows the global frequency response for a 16 kHz audio signal with a digital microphone working at 1.024 MHz. The filter configuration is the following:

Figure 408 shows the theoretical frequency response using a CIC4 and a CIC5.

Figure 408. Global frequency response

Figure 408. Global frequency response graph comparing CIC4 and CIC5 Normalized Magnitude (dB) from 0 to -120 versus Frequency (Hz) from 0 to 10 x 10^4.
Figure 408. Global frequency response graph comparing CIC4 and CIC5 Normalized Magnitude (dB) from 0 to -120 versus Frequency (Hz) from 0 to 10 x 10^4.

Figure 409 shows the in-band ripple for a 16 kHz audio signal with a digital microphone working at 1.024 MHz. The filter configuration is the following:

The resulting in-band ripple is ± 0.41 dB for CIC5, and ± 0.45 dB for CIC4.

The - 3 dB cut-off frequency is 7061 Hz.

Figure 409. Detailed frequency response

Figure 409: Detailed frequency response plot showing Normalized Magnitude (dB) versus Frequency (Hz) for CIC5 and CIC4 filters. The plot is titled 'FREQUENCY RESPONSE (CICx + RSFLT + HPF)'. The x-axis ranges from 0 to 7000 Hz with major ticks every 1000 Hz. The y-axis ranges from -2 to 0.1 dB with major ticks every 0.2 dB. Two curves are shown: a solid black line for CIC5 and a dotted red line for CIC4. Both curves start at -2 dB at 0 Hz, rise to a peak of approximately -0.1 dB at 200 Hz, then dip to a local minimum of about -0.6 dB at 2000 Hz. They then rise to a higher peak of about -0.1 dB at 3500 Hz, dip to a minimum of about -0.8 dB at 5000 Hz, rise to a peak of about -0.3 dB at 6000 Hz, and finally drop sharply to -2 dB at 7000 Hz. The CIC5 curve is consistently slightly higher than the CIC4 curve.
Figure 409: Detailed frequency response plot showing Normalized Magnitude (dB) versus Frequency (Hz) for CIC5 and CIC4 filters. The plot is titled 'FREQUENCY RESPONSE (CICx + RSFLT + HPF)'. The x-axis ranges from 0 to 7000 Hz with major ticks every 1000 Hz. The y-axis ranges from -2 to 0.1 dB with major ticks every 0.2 dB. Two curves are shown: a solid black line for CIC5 and a dotted red line for CIC4. Both curves start at -2 dB at 0 Hz, rise to a peak of approximately -0.1 dB at 200 Hz, then dip to a local minimum of about -0.6 dB at 2000 Hz. They then rise to a higher peak of about -0.1 dB at 3500 Hz, dip to a minimum of about -0.8 dB at 5000 Hz, rise to a peak of about -0.3 dB at 6000 Hz, and finally drop sharply to -2 dB at 7000 Hz. The CIC5 curve is consistently slightly higher than the CIC4 curve.

46.7.5 Total ADF gain

This section details how to compute the signal level provided by the ADF according to the filter settings.

A signal level may be expressed in dBFS (decibel full scale). A 0 dBFS level is assigned to the maximum possible digital level. For example, a signal that reaches 50 % of the maximum level, has a - 6 dBFS level (6 dB below full scale).

For example, for the ADF offering a final data width of 24 bits, a signal having an amplitude of 2 × 10⁶ LSB has a level of:

\[20 \times \log_{10} \left( \frac{2 \times 10^6}{2^{(24-1)}} \right) = -12.45 \text{ dBFS}\]

In addition, the data size of a signal having an amplitude (Amp) expressed in LSB is given by:

\[DS = \left( \frac{\ln(\text{Amp})}{\ln(2)} + 1 \right) \text{ bits}\]

One bit need to be added for negative values.

So a signal having an amplitude of 2 × 10⁶ LSB, has a data size of 21.9 bits.

CIC gain

The CIC gain (\(G_{\text{CIC}}\) and \(G_{\text{dB,CIC}}\)) can be deduced from the following formula giving data size in bits (\(DS_{\text{CIC}}\)).

\[DS_{\text{CIC}} = (N \times \log_2(D1)) + DS_{\text{in}}\]

where N represents the CIC order (selected by CICMOD[2:0]), and D1 is the decimation ratio (given by MCICD[8:0]).

\(DS_{\text{in}}\) represents the data size (in bits) of the signal at CIC input.


Warning: \(DS_{CIC}\) is very important for CIC filter. In order to work fine, \(DS_{CIC}\) must not exceed 26 bits.


The CIC gain \(G_{CIC}\) is given by:

\[G_{CIC} = (D1)^N\]

which gives in decibels:

\[GdB_{CIC} = 20 \times \log_{10}((D1)^N)\]

Data size at SCALE output

The data size at SCALE output (including the CIC gain), is a key information as the RSFLT starts to have some saturations, if the peak-to-peak signal amplitude at SCALE output is higher than 22 bits.

If the RSFLT is bypassed, then a peak-to-peak signal amplitude of 24 bits is accepted.

The signal amplitude at SCALE output is:

\[Asout_{SCALE} = D1^N \times 10^{\frac{GdB_{SCALE}}{20}} \times Asin_{DFLT}\]

\(GdB_{SCALE}\) represents the gain selected by SCALE[5:0], in dB.

\(Asout_{SCALE}\) is the signal amplitude at SCALE output (in LSB), and \(Asin_{DFLT}\) is the signal amplitude at CIC input (LSB).

\[DS_{SCALE} = \frac{\ln(Asout_{SCALE})}{\ln(2)} + 1\]

The data size at SCALE output (\(DS_{SCALE}\)) is expressed in bits.

RSFLT gain

The RSFLT gain in the useful bandwidth is typically 9.5 dB, but due to ripple a margin of about ±0.41 dB must be considered.

\[G_{RSFLT} = 10^{\frac{9.5 \text{ dB}}{20}} = 2.98 \text{ typical}\]

Note: The HPF filter has a gain of 0 dB.

SAD gain

The SAD is using only the 16 MSB on the signal, as a consequence, from the SAD point of view, the truncation from 24 to 16 bits can be seen as an attenuation.

\[\mathrm{GdB_{SAD}} = -48.1\mathrm{dB}\]

and

\[\mathrm{G_{SAD}} = 0.003906\]

The Figure 410 shows a simplified view of the filter path and gives, for each significant component, the expression of the bit growth and the gain.

Figure 410. Simplified DFLT view with gain information

Simplified DFLT view with gain information diagram showing DFLTx processing chain: Bin input into CIC filter, D1 decimation, SCALE, SAT, RSFLT decimate by 4, HPF, SAD, and PCM[23:0] output, along with linear and dB gain expressions for each stage.

Gain (linear)

Gain (dB)

(1) The SAD is not always implemented (see the ADF implementation section for details). MSv62698V1

Simplified DFLT view with gain information diagram showing DFLTx processing chain: Bin input into CIC filter, D1 decimation, SCALE, SAT, RSFLT decimate by 4, HPF, SAD, and PCM[23:0] output, along with linear and dB gain expressions for each stage.

Table 430 summarizes of the final data size for different filter configurations.

Table 430. Output signal levels

Filter configurationsFinal signal amplitude (LSB)
CIC + RSFLT + HPF + SAD

Samples provided to the RXFIFO:

\[\mathrm{Asout_{RXFIFO}} = \mathrm{D1}^N \times 10^{\frac{\mathrm{GdB_{SCALE}}}{20}} \times 10^{\frac{9.5}{20}} \times \mathrm{Asin_{DFLT}}\]

Samples provided to the SAD:

\[\mathrm{Asout_{SAD}} = \mathrm{D1}^N \times 10^{\frac{\mathrm{GdB_{SCALE}}}{20}} \times 10^{\frac{9.5}{20}} \times 0.003906 \times \mathrm{Asin_{DFLT}}\]

\(\mathrm{DS_{SCALE}}\) must be lower than 22 bits

CIC + RSFLT (+ HPF)
\[\mathrm{ASout_{HPF}} = \mathrm{D1}^N \times 10^{\frac{\mathrm{GdB_{SCALE}}}{20}} \times 10^{\frac{9.5}{20}} \times \mathrm{Asin_{DFLT}}\]

\(\mathrm{DS_{SCALE}}\) must be lower than 22 bits

CIC (+ HPF)
\[\mathrm{ASout_{HPF}} = \mathrm{D1}^N \times 10^{\frac{\mathrm{GdB_{SCALE}}}{20}} \times \mathrm{Asin_{DFLT}}\]

\(\mathrm{DS_{SCALE}}\) must be lower than 24 bits

Example using the main filter chain

If the ADF filter is programmed as follows:

Check first the data size at CIC output:

\[DS_{\text{CIC}} = (5 \times \log_2(24)) + 1 \text{ bit} = 23.92 \text{ bits}\]

The size is lower than 26 bits, so the CIC works in good conditions.

The data size at CIC output is very close to 24 bits, so the SCALE must be adjusted in order to provide a 22-bit max signal to the RSFLT. An attenuation of 12 dB is needed.

Then the signal level provided to the RSFLT is:

\[As_{\text{out}_{\text{SCALE}}} = 24^5 \times 10^{\frac{-12}{20}} \times 1 = 2.10^6\]

\[DS_{\text{SCALE}} = \frac{\ln(2.10^6)}{\ln(2)} + 1 = 21.93 \text{ bits}\]

If a higher gain is used, the RSFLT may saturate the output signal for strong input signals.

At the end, the final signal amplitude is:

\[As_{\text{out}_{\text{HPF}}} = 24^5 \times 10^{\frac{-12}{20}} \times 10^{\frac{9.5}{20}} \times 1 = 5.9711 \times 10^6\]

\[Ds_{\text{out}_{\text{HPF}}} = \left( \frac{\ln(5.9711 \times 10^6)}{\ln(2)} + 1 \right) = 23.51 \text{ bits}\]

or:

\[SDB_{\text{OUT}} = 20 \times \log_{10} \left( \frac{2^{23.51}}{2^{24}} \right) = -2.84 \text{ dBFS}\]

46.7.6 How to compute SAD thresholds

The SAD does not compute the RMS value of the converted signal, but the average of the absolute values. As a consequence, the estimated level differs from the RMS value of the signal:

Note: FRSIZE[2:0] has a big influence on the accuracy of the level estimation: big FRSIZE[2:0] values give better results.

Threshold programming with SADMOD = 01

Consider the case of a sound capture where the application wants to wake up the system when the captured sound is bigger than 63 dB SPL.

The sound capture can be performed with a digital microphone such as the MP45DT02.

The sensitivity of this microphone is typically -26 dBFS for an input signal of 94 dB SPL.

An acoustic signal at 63 dB SPL produces a digital signal of about:

- 26 dBFS - (94 - 63) = - 57 dBFS.

For this example, the filter configuration is the following:

A SCALE value of 3.5 dB is recommended for this configuration. As DFTL0 provides samples only used for a sound detection (samples not provided to the application), a bigger gain value can be applied: it increases the SAD accuracy and a saturation does not affect the SAD behavior (for example, a SCALE value of 15.6 dB).

The input signal is - 57 dBFS, corresponding to an amplitude

\[A_{in} = 10^{(-57/20)} = 0.00141 \text{ LSB.}\]

The total filter gain for the SAD is:

\[G_{SAD} = 16^5 \times 10^{\frac{15.6}{20}} \times 10^{\frac{9.5}{20}} \times \frac{1}{256} = 73.68 \times 10^3 \text{ or } 97.3 \text{ dB}\]

The signal amplitude received by the SAD is:

\[A_{in\_SAD} = 0.00141 \times G_{SAD} \sim 104 \text{ LSB}\]

The gain can be increased if the expected amplitude is too small. For the targeted application, 104 LSB is fine.

If the input signal is expected to be a sine, the sound level for a signal amplitude of 104 LSB is:

\[SDLVL = \frac{A_{in\_SAD} \times \sqrt{2}}{2} \times 0.9 \sim 66 \text{ LSB}\]

where 0.9 is the correction factor to apply with respect to the RMS value.

ANMIN and SNTHR must be programmed to trigger the SAD when the input signal level reaches 66 LSB.

For SADMOD[1:0] = 01, the threshold value is given by:

\[\mathrm{THRH} = \mathrm{ANMIN} \times 10^{\frac{\mathrm{GdB}_{\mathrm{SNTHR}}}{20}}\]

where GdBSNTHR represents the decibel value selected by SNTHR[3:0].

When SNTHR[3:0] = 6 dB for example, this formula becomes:

\[\mathrm{THRH} = 2 \times \mathrm{ANMIN}\]

So ANMIN = THRH/2 = 66 /2 = 33 LSB.

In Figure 410, the trigger value (THRH in red) is fixed to 66 LSB. The input signal is at - 65dBFS during 256 samples, then its value goes to - 55 dB for 256 samples, and finally it is reduced to - 60 dBFS.

The blue curve is showing the sound level estimation (SDLVL) versus time. Fluctuation on the estimated value can be observed due to windowing effect of FRSIZE samples.

The SAD DETECT state (when green signal is high) is maintained during four additional frames due to hangover function value.

In this example ANSLP = FRSIZE = 3 (64 samples), LFRNB = 0 (2 frames), HGOVR = 0 (4 frames), SNTHR = 1 (6 dB) and ANMIN = 33.

Figure 411. SAD example working with SADMOD = 01

Figure 411: Line graph showing SAD operation with SADMOD = 01. Plots |Sin|, SDLVL, THR, and SAD State against Samples (0 to 900) on the x-axis, and LSB (0 to 120) on the y-axis.
Figure 411: Line graph showing SAD operation with SADMOD = 01. Plots |Sin|, SDLVL, THR, and SAD State against Samples (0 to 900) on the x-axis, and LSB (0 to 120) on the y-axis.

Threshold programming with SADMOD = 1x

Consider the case of a sound capture where the application wants to wake up the system when the captured sound is bigger than 57 dBSPL.

The sound capture can be performed with a digital microphone such as the MP45DT02. The sensitivity of this microphone is typically - 26 dBFS for an input signal of 94 dBSPL.

An acoustic signal at 57 dBSPL produces a digital signal of about:

- 26 dBFS - (94-63) = - 63 dBFS.

A SCALE value of 3.5 dB is recommended for this configuration. The samples provided by DFTL0 are only used for a sound detection, without providing the samples to the application, a bigger gain value can be provided: it increases the SAD accuracy and a saturation does not affect the SAD behavior (for example, a SCALE value of 24 dB).

The input signal is - 63 dBFS, corresponding to an amplitude:

\[A_{in} = 10^{(-63/20)} = 0.000708 \text{ LSB.}\]

The total filter gain for the SAD is:

\[G_{SAD} = 48^4 \times 10^{\frac{24}{20}} \times 0.003906 = 328.6 \times 10^3 \text{ or } 110.3 \text{ dB}\]

The signal amplitude received by the SAD is:

\[A_{in_{SAD}} = 0.000708 \times G_{SAD} \sim 232 \text{ LSB}\]

The gain can be increased if the expected amplitude is too small.

If the input signal is expected to be a sine, the sound level for a signal amplitude of 232 LSB is:

\[SDLVL = \frac{A_{in_{SAD}} \times \sqrt{2}}{2} \times 0.9 \sim 148 \text{ LSB}\]

where 0.9 is the correction factor to apply with respect to the RMS value.

Note: ANLVL converges to average of SDLVL values, with a long constant time.
So SDLVL ~ ANLVL = 148 LSB for a constant input signal at 57 dB SPL.

For SADMOD = 1', the SAD compares the estimated ambient noise multiplied by the gain selected by SNTHR[3:0] to ANMIN[12:0] * 4.

For simplification, SNTHR[3:0] is set to 1 (6 dB), meaning that ANLVL is multiplied by two.

The SAD triggers if 2 × ANLVL > THRH.

In this mode,

\[THRH = 4 \times ANMIN\]

So the SAD triggers if:

\[ANLVL > 2 \times ANMIN\]

So ANMIN = 148 / 2 = 74 LSB

In Figure 411, the trigger value (THR in red) is fixed to 148 LSB. The input signal is at - 75 dBFS during 512 samples, then its value goes to - 62 dB for 11000 samples, and finally it is reduced to - 70 dBFS.

The blue curve shows the sound level estimation (SDLVL) versus time. The black curve shows the ambient noise estimation versus time, increasing or decreasing logarithmically. During the learning phase, it reaches the SDLVL value.

In this example ANSLP = 6, FRSIZE = 3 (64 samples), LFRNB = 0 (2 frames), HGOVR = 0 (4 frames), SNTHR = 1 (6 dB) and ANMIN = 74.

Figure 412. SAD example working with SADMOD = 1x

Figure 412: A line graph showing the SAD example working with SADMOD = 1x. The x-axis represents 'Samples' from 0 to 18000. The y-axis represents 'LSB' from 0 to 300. The graph contains several data series: |Sin| (grey area), SDLVL (blue line), ANLVL (black line), THR (red line), and SAD State (green line). The THR line is constant at 148 LSB. The SDLVL line starts at ~40, jumps to ~160 at sample 512, and drops to ~70 at sample 12000. The ANLVL line starts at ~40 and increases logarithmically to meet the SDLVL line at sample 6000. The SAD State line is green, indicating active periods.
Figure 412: A line graph showing the SAD example working with SADMOD = 1x. The x-axis represents 'Samples' from 0 to 18000. The y-axis represents 'LSB' from 0 to 300. The graph contains several data series: |Sin| (grey area), SDLVL (blue line), ANLVL (black line), THR (red line), and SAD State (green line). The THR line is constant at 148 LSB. The SDLVL line starts at ~40, jumps to ~160 at sample 512, and drops to ~70 at sample 12000. The ANLVL line starts at ~40 and increases logarithmically to meet the SDLVL line at sample 6000. The SAD State line is green, indicating active periods.

46.8 ADF registers

All the ADF registers must be accessed either in word (32-bit) or half-word (16-bit) formats.

46.8.1 ADF global control register (ADF_GCR)

Address offset: 0x000

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
ResResResResResResResResResResResResResResResTRGO
rw

Bits 31:1 Reserved, must be kept at reset value.

Bit 0 TRGO: Trigger output control

This bit is set by software and reset by hardware. It is used to start the acquisition of several filters synchronously. It is also used to synchronize several ADF together by controlling the adf_trgo signal.

0: Write 0 has no effect. Read 0 means that the trigger can be set again to 1.

1: Write 1 generates a positive pulse on the adf_trgo signal and triggers the acquisition on enabled filter having their ACQMOD[2:0] = 01x and selecting TRGO as trigger. Read 1 means that the trigger pulse is still active.

46.8.2 ADF clock generator control register (ADF_CKGCR)

Address offset: 0x004

Reset value: 0x0000 0000

This register is used to control the clock generator. The clock adf_proc_ck must be enabled before enabling other ADF parts.

31302928272625242322212019181716
CKGA
ACTIVE
PROC DIV[6:0]Res.Res.Res.Res.CCK DIV[3:0]
rrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TRG SRC[3:0]Res.Res.Res.TRGSE
NS
Res.CCK1D
IR
CCK0D
IR
CKGM
OD
Res.CCK1E
N
CCK0E
N
CKGD
EN
rwrwrwrwrwrwrwrwrwrwrw

Bit 31 CKGACTIVE: Clock generator active flag

This bit is set and cleared by hardware. It is used by the application to check if the clock generator is effectively enabled (active) or not. The protected fields of this function can only be updated when CKGACTIVE = 0 (see Section 46.4.13: Register protection for details).

The delay between a transition on CKGDEN and a transition on CKGACTIVE is two periods of AHB clock and two 2 periods of adf_proc_ck.

0: The clock generator is not active and can be configured if needed.

1: The clock generator is active and protected fields cannot be configured.

Bits 30:24 PROC DIV[6:0]: Divider to control the serial interface clock

This bitfield is set and reset by software. It is used to adjust the frequency of the clock provided to the SITF.

\[F_{adf\_itf\_ck} = \frac{F_{adf\_ker\_ck}}{(PROC DIV + 1)}\]

This bitfield must not be changed if the filter is enabled (DFTEN = 1).

0: adf_ker_ck provided to the SITF

1: adf_ker_ck/ 2 provided to the SITF

2: adf_ker_ck/ 3 provided to the SITF

...

127: adf_ker_ck/ 128 provided to the SITF

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 23:20 Reserved, must be kept at reset value.

Bits 19:16 CCKDIV[3:0]: Divider to control the ADF_CCK clock

This bitfield is set and reset by software. It is used to adjust the frequency of the ADF_CCK clock. The input clock of this divider is the clock provided to the SITF. More globally, the frequency of the ADF_CCK is given by the following formula:

\[F_{ADF\_CCK} = \frac{F_{adf\_ker\_ck}}{(PROC DIV + 1) \times (CCKDIV + 1)}\]

This bitfield must not be changed if the filter is enabled (DFTEN = 1).

0000: The ADF_CCK clock is adf_proc_ck.

0001: The ADF_CCK clock is adf_proc_ck / 2.

0010: The ADF_CCK clock is adf_proc_ck / 3.

...

1111: The ADF_CCK clock is adf_proc_ck / 16.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 15:12 TRGSRC[3:0]: Digital filter trigger signal selection

This bitfield is set and cleared by software. It is used to select which external signals trigger the corresponding filter. This bitfield is not significant if the CKGMOD = 0.

000x: TRGO selected

0010: adf_trg1 selected

Others: Reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 11:9 Reserved, must be kept at reset value.

Bit 8 TRGSENS: CKGEN trigger sensitivity selection

This bit is set and cleared by software. It is used to select the trigger sensitivity of the trigger signals. This bit is not significant if the CKGMOD = 0.

0: A rising edge event triggers the activation of CKGEN dividers.

1: A falling edge event triggers the activation of CKGEN dividers.

Note: When the trigger source is TRGO, the sensitivity is forced to falling edge, thus TRGSENS value is not taken into account. This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 Reserved, must be kept at reset value.

Bit 6 CCK1DIR: ADF_CCK1 direction

This bit is set and reset by software. It is used to control the direction of the ADF_CCK1 pin.

0: The ADF_CCK1 pin direction is in input.

1: The ADF_CCK1 pin direction is in output.

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 5 CCK0DIR: ADF_CCK0 direction

This bit is set and reset by software. It is used to control the direction of the ADF_CCK0 pin.

0: The ADF_CCK0 pin direction is in input.

1: The ADF_CCK0 pin direction is in output.

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 4 CKGMOD: Clock generator mode

This bit is set and reset by software. It is used to define the way the clock generator is enabled. This bit must not be changed if the filter is enabled (DFTEN = 1).

0: The kernel clock is provided to the dividers as soon as CKGDEN is set to 1.

1: The kernel clock is provided to the dividers when CKGDEN is set to 1 and the trigger condition met.

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 3 Reserved, must be kept at reset value.

Bit 2 CCK1EN: ADF_CCK1 clock enable

This bit is set and reset by software. It is used to control the generation of the bitstream clock on the ADF_CCK1 pin.

0: Bitstream clock not generated

1: Bitstream clock generated on the ADF_CCK1 pin.

Bit 1 CCK0EN: ADF_CCK0 clock enable

This bit is set and reset by software. It is used to control the generation of the bitstream clock on the ADF_CCK0 pin.

0: Bitstream clock not generated

1: Bitstream clock generated on the ADF_CCK0 pin

Bit 0 CKGDEN: CKGEN dividers enable

This bit is set and reset by software. It is used to enable/disable the clock dividers of the CKGEN: PROCDIV and CCKDIV.

0: CKGEN dividers disabled

1: CKGEN dividers enabled

46.8.3 ADF serial interface control register 0 (ADF_SITF0CR)

Address offset: 0x080

Reset value: 0x0000 1F00

This register is used to control the serial interface SITF0.

31302928272625242322212019181716
SITFACTIVERes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
r
1514131211109876543210
Res.Res.Res.STH[4:0]Res.Res.SITFMOD[1:0]Res.SCKSRC[1:0]SITFEN
rwrwrwrwrwrwrwrwrwrw

Bit 31 SITFACTIVE: Serial interface active flag

This bit is set and cleared by hardware. It is used by the application to check if the serial interface is effectively enabled (active) or not. The protected fields of this function can only be updated when SITFACTIVE is set to 0 (see Section 46.4.13: Register protection for details). The delay between a transition on SITFEN and a transition on SITFACTIVE is two periods of AHB clock and two periods of adf_proc_ck.

0: The serial interface is not active, and can be configured if needed.

1: The serial interface is active and protected fields cannot be configured.

Bits 30:13 Reserved, must be kept at reset value.

Bits 12:8 STH[4:0]: Manchester symbol threshold/SPI threshold

This bitfield is set and cleared by software. It is used for Manchester mode to define the expected symbol threshold levels (see Manchester mode for details on computation).

In addition this bitfield is used to define the timeout value for the clock absence detection in Normal SPI mode. STH[4:0] values lower than four are invalid.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 7:6 Reserved, must be kept at reset value.

Bits 5:4 SITFMOD[1:0]: Serial interface type

This bitfield is set and cleared by software. It is used to define the serial interface type.

00: LF_MASTER SPI mode

01: Normal SPI mode

10: Manchester mode: rising edge = logic 0, falling edge = logic 1

11: Manchester mode: rising edge = logic 1, falling edge = logic 0

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 3 Reserved, must be kept at reset value.

Bits 2:1 SCKSRC[1:0]: Serial clock source

This bitfield is set and cleared by software. It is used to select the clock source of the serial interface.

00: Serial clock source is ADF_CCK0.

01: Serial clock source is ADF_CCK1.

others: reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 0 SITFEN: Serial interface enable

This bit is set and cleared by software. It is used to enable/disable the serial interface.

0: Serial interface disabled

1: Serial interface enabled

46.8.4 ADF bitstream matrix control register 0 (ADF_BSMX0CR)

Address offset: 0x084

Reset value: 0x0000 0000

This register is used to select the bitstream to be provided to DFLT0.

Bit 31Bit 30Bit 29Bit 28Bit 27Bit 26Bit 25Bit 24Bit 23Bit 22Bit 21Bit 20Bit 19Bit 18Bit 17Bit 16
31 BSMXA302928272625242322212019181716
CTIVE rRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.BSSEL[4:0]
rwrwrwrwrw
Bit 31BSMXACTIVE: BSMX active flag
Bits 4:0BSSEL[4:0]: Bitstream selection for DFLT0.
Note: This bitfield can be write-protected (seeSection 46.4.13: Register protectionfor details).
RM0457 Rev 52515/5881

Bit 31 BSMXACTIVE: BSMX active flag

This bit is set and cleared by hardware. It is used by the application to check if the BSMX is effectively enabled (active) or not. BSSEL[4:0] can only be updated when BSMXACTIVE is set to 0. This BSMXACTIVE flag cannot go to 0 if DFLT0 is enabled.

0: BSMX is not active and can be configured if needed.

1: BSMX is active and protected fields cannot be configured.

Bits 30:5 Reserved, must be kept at reset value.

Bits 4:0 BSSEL[4:0]: Bitstream selection

This bitfield is set and cleared by software. It is used to select the bitstream to be processed for DFLT0.

00000: bs0_r provided to DFLT0

00001: bs0_f provided to DFLT0

others: reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

46.8.5 ADF digital filter control register 0 (ADF_DFLT0CR)

Address offset: 0x088

Reset value: 0x0000 0000

31302928272625242322212019181716
DFLTACTIVEDFLTRUNRes.Res.NBDIS[7:0]Res.Res.Res.Res.
rrrwrwrwrwrwrwrwrw
1514131211109876543210
TRGSRC[3:0]Res.Res.Res.TRGSENSRes.ACQMOD[2:0]Res.FTHDMAENDFLTEN
rwrwrwrwrwrwrwrwrwrww

Bit 31 DFLTACTIVE: DFLT0 active flag

This bit is set and cleared by hardware. It indicates if DFLT0 is active: can be running or waiting for events.

0: DFLT0 not active (can be re-enabled again, via DFLTEN bit, if needed)

1: DFLT0 active

Bit 30 DFLTRUN: DFLT0 run status flag

This bit is set and cleared by hardware. It indicates if DFLT0 is running or not.

0: DFLT0 not running and ready to accept a new trigger event

1: DFLT0running

Bits 29:28 Reserved, must be kept at reset value.

Bits 27:20 NBDIS[7:0]: Number of samples to be discarded

This bitfield is set and cleared by software. It is used to define the number of samples to be discarded every time DFLT0 is re-started.

0: No sample discarded

1: 1 sample discarded

2: 2 samples discarded

...

255: 255 samples discarded

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 19:16 Reserved, must be kept at reset value.

Bits 15:12 TRGSRC[3:0]: DFLT0 trigger signal selection

This bitfield is set and cleared by software. It is used to select which external signals trigger DFLT0.

0000: TRGO selected

0010: adf_trgi selected

Others: Reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 11:9 Reserved, must be kept at reset value.

Bit 8 TRGSENS: DFLT0 trigger sensitivity selection

This bitfield is set and cleared by software. It is used to select the trigger sensitivity of the external signals

0: A rising edge event triggers the acquisition.

1: A falling edge event triggers the acquisition.

Note: When the trigger source is TRGO, TRGSENS value is not taken into account. When TRGO is selected, the sensitivity is forced to falling edge.

This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 Reserved, must be kept at reset value.

Bits 6:4 ACQMOD[2:0]: DFLT0 trigger mode

This bitfield is set and cleared by software. It is used to select the filter trigger mode.

000: Asynchronous continuous acquisition mode

001: Asynchronous single-shot acquisition mode

010: Synchronous continuous acquisition mode

011: Synchronous single-shot acquisition mode

100: Window continuous acquisition mode

Others: Same as 000

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details)..

Bit 3 Reserved, must be kept at reset value.

Bit 2 FTH: RXFIFO threshold selection

This bit is set and cleared by software. It is used to select the RXFIFO threshold.

0: RXFIFO threshold event generated when the RXFIFO is not empty

1: RXFIFO threshold event generated when the RXFIFO is half-full

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 1 DMAEN: DMA requests enable

This bit is set and cleared by software. It is used to control the generation of DMA request to transfer the processed samples into the memory.

0: DMA interface for the corresponding digital filter disabled

1: DMA interface for the corresponding digital filter enabled

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 0 DFLTEN: DFLT0 enable

This bit is set and cleared by software. It is used to control the start of acquisition of the DFLT0 path. This bit behavior depends on ACQMOD[2:0] and external events. The serial or parallel interface delivering the samples must be enabled as well.

0: Acquisition immediately stopped

1: Acquisition immediately started if ACQMOD[2:0] = 00x or 101, or acquisition started when the proper trigger event occurs if ACQMOD[2:0] = 01x.

46.8.6 ADF digital filer configuration register 0 (ADF_DFLT0CICR)

Address offset: 0x08C

Reset value: 0x0000 0000

This register is used to control the main CIC filter.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.SCALE[5:0]Res.Res.Res.MCICD
8
rwrwrwrwrwrwrw
1514131211109876543210
MCICD[7:0]Res.CICMOD[2:0]Res.Res.DATSRC[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:26 Reserved, must be kept at reset value.

Bits 25:20 SCALE[5:0]: Scaling factor selection

This bitfield is set and cleared by software. It is used to select the gain to be applied at CIC output (see Table 418 for details). If the application attempts to write a new gain value while the previous one is not yet applied, this new gain value is ignored. Reading back this bitfield informs the application on the current gain value.

000000: 0 dB
000001: + 3.5 dB
000010: + 6 dB or shift left by 1 bit
...
011000: + 72 dB or shift left by 12 bits
100000: - 48.2 dB or shift right by 8 bits (default value)
100001: - 44.6 dB
100010: - 42.1 dB or shift right by 7 bits
100011: - 38.6 dB
...
101110: -6 dB or shift right by 1 bit
101111: -2.5 dB
Others: Reserved

Bits 19:17 Reserved, must be kept at reset value.

Bits 16:8 MCICD[8:0]: CIC decimation ratio selection

This bitfield is set and cleared by software.It is used to select the CIC decimation ratio. A decimation ratio smaller than two is not allowed. The decimation ratio is given by (CICDEC+1).

0: Decimation ratio is 2.
1: Decimation ratio is 2.
2: Decimation ratio is 3.
3: Decimation ratio is 4.
...
511: Decimation ratio is 512.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 Reserved, must be kept at reset value.

ST logo
ST logo

Bits 6:4 CICMOD[2:0]: Select the CIC order

This bitfield is set and cleared by software. It is used to select the order of the MCIC.
100: MCIC configured in single Sinc4 filter
101: MCIC configured in single Sinc5 filter
Others: Reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 3:2 Reserved, must be kept at reset value.

Bits 1:0 DATSRC[1:0]: Source data for the digital filter

This bitfield is set and cleared by software.
0x: Stream coming from the BSMX selected
10: Stream coming from the ADCITF1 selected
11: Stream coming from the ADCITF2 selected

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

46.8.7 ADF reshape filter configuration register 0 (ADF_DFLT0RSFR)

Address offset: 0x090

Reset value: 0x0000 0000

This register is used to control the reshape and HPF filter.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.HPFC[1:0]HPFBYPPRes.Res.RSFLTDRes.RSFLT
rwrwrwrwrw

Bits 31:10 Reserved, must be kept at reset value.

Bits 9:8 HPFC[1:0]: High-pass filter cut-off frequency

This bitfield is set and cleared by software. it is used to select the cut-off frequency of the high-pass filter. \(F_{PCM}\) represents the sampling frequency at HPF input.
00: Cut-off frequency = 0.000625 x FPCM
01: Cut-off frequency = 0.00125 x FPCM
10: Cut-off frequency = 0.00250 x FPCM
11: Cut-off frequency = 0.00950 x FPCM

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 HPFBYP: High-pass filter bypass

This bit is set and cleared by software. It is used to bypass the high-pass filter.
0: HPF not bypassed (default value)
1: HPF bypassed

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bits 6:5 Reserved, must be kept at reset value.

Bit 4 RSFLTD: Reshaper filter decimation ratio

This bit is set and cleared by software. It is used to select the decimation ratio for the reshape filter

0: Decimation ratio is 4 (default value).

1: Decimation ratio is 1.

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bits 3:1 Reserved, must be kept at reset value.

Bit 0 RSFLTBYP: Reshaper filter bypass

This bit is set and cleared by software. It is used to bypass the reshape filter and its decimation block.

0: Reshape filter not bypassed (default value)

1: Reshape filter bypassed

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

46.8.8 ADF delay control register 0 (ADF_DLY0CR)

Address offset: 0x0A4

Reset value: 0x0000 0000

This register is used for the adjustment stream delays.

46.8.8column_2Bit 4 Bit 0RSFLTD filter RSFLTBYPdecimation block.column_6column_7column_8column_9column_10column_11column_12column_13column_14for details). for details).RM0457
31302928272625242322212019181716
SKPBF rRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.SKPDLY[6:0]
rwrwrwrwrwrwrw
Bit 31SKPBF: Skip busy flag
Bits 6:0SKPDLY[6:0]: Delay to apply to a bitstream

Bit 31 SKPBF: Skip busy flag

This bit is set and cleared by hardware. It is used to control if the delay sequence is completed.

0: ADF ready to accept a new value into SKPDLY[6:0]

1: Last valid SKPDLY[6:0] still under precessing

Bits 30:7 Reserved, must be kept at reset value.

Bits 6:0 SKPDLY[6:0]: Delay to apply to a bitstream

This bitfield is set and cleared by software. It defines the number of input samples that are skipped. Skipping is applied immediately after writing to this bitfield, if SKPBF = 0 and DFLTEN = 1. If SKPBF = 1, the value written into the register is ignored by the delay state machine.

0: No input sample skipped

1: 1 input sample skipped

...

127: 127 input samples skipped

ST logo
ST logo

46.8.9 ADF DFLT0 interrupt enable register (ADF_DFLT0IER)

Address offset: 0x0AC

Reset value: 0x0000 0000

This register is used for allowing or not the events to generate an interrupt.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.SDLVLI
E
SDDET
IE
RFOVR
IE
CKABI
E
SATIERes.Res.Res.Res.Res.Res.Res.DOVRI
E
FTHIE
rwrwrwrwrwrwrw

Bits 31:14 Reserved, must be kept at reset value.

Bit 13 SDLVLIE: SAD sound-level value ready enable

This bit is set and cleared by software.

0: Sound-level-ready interrupt disabled

1: Sound-level-ready interrupt enabled

Bit 12 SDDETIE: Sound activity detection interrupt enable

This bit is set and cleared by software.

0: Sound-trigger interrupt disabled

1: Sound-trigger interrupt enabled

Bit 11 RFOVRIE: Reshape filter overrun interrupt enable

This bit is set and cleared by software.

0: Reshape filter overrun interrupt disabled

1: Reshape filter overrun interrupt enabled

Bit 10 CKABIE: Clock absence detection interrupt enable

This bit is set and cleared by software.

0: Clock absence interrupt disabled

1: Clock absence interrupt enabled

Bit 9 SATIE: Saturation detection interrupt enable

This bit is set and cleared by software.

0: Saturation interrupt disabled

1: Saturation interrupt enabled

Bits 8:2 Reserved, must be kept at reset value.

Bit 1 DOVRIE: Data overflow interrupt enable

This bit is set and cleared by software.

0: Data overflow interrupt disabled

1: Data overflow interrupt enabled

Bit 0 FTHIE: RXFIFO threshold interrupt enable

This bit is set and cleared by software.

0: RXFIFO threshold interrupt disabled

1: RXFIFO threshold interrupt enabled

46.8.10 ADF DFLT0 interrupt status register 0 (ADF_DFLT0ISR)

Address offset: 0x0B0

Reset value: 0x0000 0000

This register contains the status flags for the digital filter path.

RM0457 Bit 18 Bit 17 Bit 16 Bit 6 Bit 5 Bit 4DEDF DISTURBF PROGFAIL OTPSEC OTPERR OTPNVIR: Disturb flag : Programming failed : OTP with error : OTP not virgin
31 30 292827 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res.Res.Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 131211 10 9 8 7 6 5 4 3 2 1 0
Res. Res. SDLVLSDDETRFOVR
FFF CKABF SATF Res. Res. Res. Res. Res. RXNEF Res. DOVRF FTHF
rc_w1rc_w1rc_w1 rc_w1 rc_w1 r rc_w1 r
Bit 13SDLVLF: Sound level value ready flag
Bit 12SDDETF: Sound activity detection flag
Bit 11RFOVRF: Reshape filter overrun detection flag
Bit 10CKABF: Clock absence detection flag
Bit 9SATF: Saturation detection flag
Bit 3RXNEF: RXFIFO not empty flag 0: RXFIFO empty
Bit 1DOVRF: Data overflow flag

Bits 31:14 Reserved, must be kept at reset value.

Bit 13 SDLVL: Sound level value ready flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that new sound level value is not ready. Write 0 has no effect.

1: Read 1 means that new sound level value is ready. Write 1 clears this flag.

Bit 12 SDDDET: Sound activity detection flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that no sound activity is detected. Write 0 has no effect.

1: Read 1 means that sound activity is detected. Write 1 clears this flag.

Bit 11 RFOVRF: Reshape filter overrun detection flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that no reshape filter overrun is detected. Write 0 has no effect.

1: Read 1 means that reshape filter overrun is detected. Write 1 clears this flag.

Bit 10 CKABF: Clock absence detection flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that no clock absence is detected. Write 0 has no effect.

1: Read 1 means that a clock absence is detected. Write 1 clears this flag.

Bit 9 SATF: Saturation detection flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that no saturation is detected. Write 0 has no effect.

1: Read 1 means that a saturation is detected. Write 1 clears this flag.

Bits 8:4 Reserved, must be kept at reset value.

Bit 3 RXNEF: RXFIFO not empty flag

This bit is set and cleared by hardware according to the RXFIFO level.

0: RXFIFO empty

1: RXFIFO not empty

Bit 2 Reserved, must be kept at reset value.

Bit 1 DOVRF: Data overflow flag

This bit is set by hardware and cleared by software by writing this bit to 1.

0: Read 0 means that no overflow is detected. Write 0 has no effect.

1: Read 1 means that an overflow is detected; Write 1 clears this flag.

Bit 0 FTHF: RXFIFO threshold flag

This bit is set by hardware, and cleared by the hardware when the RXFIFO level is lower than the threshold.

46.8.11 ADF SAD control register (ADF_SADCR)

Address offset: 0x0B8

Reset value: 0x0000 0000

This register is used for the configuration and the control of the sound activity detection.

31302928272625242322212019181716
SADACTIVERes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
r
1514131211109876543210
Res.Res.SADMOD[1:0]Res.FRSIZE[2:0]HYSTENRes.SADST[1:0]DETCFGDATCAP[1:0]SADEN
rwrwrwrwrwrwrrrwrwrwrw

Bit 31 SADACTIVE: SAD Active flag

This bit is set and cleared by hardware. It is used to check if the SAD is effectively enabled (active) or not. The protected fields and registers of this function can only be updated when the SADACTIVE is set to 0 (see Section 46.4.13: Register protection for details).

The delay between a transition on SADEN and a transition on SADACTIVE is two periods of AHB clock and two periods of adf_proc_ck.

Bits 30:14 Reserved, must be kept at reset value.

Bits 13:12 SADMOD[1:0]: SAD working mode

This bitfield is set and cleared by software. It is used to define the way the SAD works.

00: Threshold value computed according to the estimated ambient noise

The SAD triggers when the sound level (SDLVL) is bigger than the defined threshold. In this mode, the SAD works like a voice activity detector.

01: Threshold value equal to ANMIN[12:0], multiplied by the gain selected by SNTHR[3:0]

The SAD triggers when the sound level (SDLVL) is bigger than the defined threshold. In this mode, the SAD works like a sound detector.

1x: Threshold value given by 4 × ANMIN[12:0]

The SAD triggers when the estimated ambient noise (ANLVL), multiplied by the gain selected by SNTHR[3:0] is bigger than the defined threshold. In this mode, the SAD is working like an ambient noise estimator. Hysteresis function cannot be used in this mode.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 11 Reserved, must be kept at reset value.

Bits 10:8 FRSIZE[2:0]: Frame size

This bitfield is set and cleared by software. it is used to define the size of one frame and also to define how many samples are taken into account to compute the short-term signal level.

000: 8 PCM samples used to compute the short-term signal level

001: 16 PCM samples used to compute the short-term signal level

010: 32 PCM samples used to compute the short-term signal level

011: 64 PCM samples used to compute the short-term signal level

100: 128 PCM samples used to compute the short-term signal level

101: 256 PCM samples used to compute the short-term signal level

11x: 512 PCM samples used to compute the short-term signal level

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 HYSTEN: Hysteresis enable

This bit is set and cleared by software. It is used to enable/disable the hysteresis function (see Table 418 for details). This bit must be kept to 0 when SADMOD[1:0] = 1x.

0: Hysteresis function disabled. THRH is always used.

1: Hysteresis function enabled. THRH is used for MONITOR to DETECT transition and THRL is used for DETECT to MONITOR transition.

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bit 6 Reserved, must be kept at reset value.

Bits 5:4 SADST[1:0]: SAD state

This bitfield is set and cleared by hardware. It indicates the SAD state and is meaningful only when SADEN = 1. The SAD state can be:

- LEARN when the SAD is in learning phase or in SDLVL computation mode

- MONITOR when the SAD is in monitoring phase

- DETECT when the SAD detects a sound

00: SAD in LEARN state

01: SAD in MONITOR state

11: SAD in DETECT state

Bit 3 DETCFG: Sound trigger event configuration

This bit is set and cleared by software. It is used to define if the sddet_evt event is generated only when the SAD enters to MONITOR state or when the SAD enters or exits the DETECT state.

0: sddet_evt generated when SAD enters the MONITOR state

1: sddet_evt generated when SAD enters or exits the DETECT state

Note: This bit can be write-protected (see Section 46.4.13: Register protection for details).

Bits 2:1 DATCAP[1:0]: Data capture mode

This bitfield is set and cleared by software. It is used to define in which conditions, the samples provided by DLFT0 are stored into the memory.

00: Samples from DFLT0 not transfered into the memory

01: Samples from DFLT0 transfered into the memory when SAD is in DETECT state

1x: Samples from DFLT0 transfered into memory when SAD and DFLT0 are enabled

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 0 SADEN: Sound activity detector enable

This bit is set and cleared by software. It is used to enable/disable the SAD.

0: SAD disabled and SAD state reset

1: SAD enabled

46.8.12 ADF SAD configuration register (ADF_SADCFGR)

Address offset: 0x0BC

Reset value: 0x0000 0000

This register is used for the configuration of the sound activity detection.

31302928272625242322212019181716
Res.Res.Res.ANMIN[12:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.HGOVR[2:0]Res.LFRNB[2:0]Res.ANSLP[2:0]SNTHR[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bits 28:16 ANMIN[12:0]: Minimum noise level

This bitfield is set and cleared by software. It is used to define the minimum noise level and then the sensitivity. It represents a positive number.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 15 Reserved, must be kept at reset value.

Bits 14:12 HGOVR[2:0]: Hangover time window

This bitfield is set and cleared by software. Once the SAD state is DETECT, this parameter is used to define the amount of time the sound is allowed to remain below the threshold, before switching the SAD to MONITOR state (see FRSIZE bitfield for the description of a frame).

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 11 Reserved, must be kept at reset value.

Bits 10:8 LFRNB[2:0]: Number of learning frames

This bitfield is set and cleared by software. It is used to define the number of learning frames to perform the first estimate of the noise level.

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bit 7 Reserved, must be kept at reset value.

Bits 6:4 ANSLP[2:0]: Ambient noise slope control

This bitfield is set and cleared by software. It is used to define the positive and negative slope of the noise estimator, in charge of updating the ANLVL (see Ambient noise estimation (ANLVL) for information about programming this bitfield).

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

Bits 3:0 SNTHR[3:0]: Signal to noise threshold

This bitfield is set and cleared by software. It is used to define \(THR_H\) (and \(THR_L\) if hysteresis is enabled). See Table 418 for details.

0000: \(THR_H\) is 3.5 dB higher than ANLVL

0001: \(THR_H\) is 6.0 dB higher than ANLVL

0010: \(THR_H\) is 9.5 dB higher than ANLVL

0011: \(THR_H\) is 12 dB higher than ANLVL

0100: \(THR_H\) is 15.6 dB higher than ANLVL

0101: \(THR_H\) is 18 dB higher than ANLVL

0110: \(THR_H\) is 21.6 dB higher than ANLVL

0111: \(THR_H\) is 24.1 dB higher than ANLVL

1000: \(THR_H\) is 27.6 dB higher than ANLVL

1001: \(THR_H\) is 30.1dB higher than ANLVL

others: Reserved

Note: This bitfield can be write-protected (see Section 46.4.13: Register protection for details).

46.8.13 ADF SAD sound level register (ADF_SADSDLVR)

Address offset: 0x0C0

Reset value: 0x0000 0000

This register contains the short-term sound-level computed by the SAD.

column_1column_2Bits 6:4 Bits 3:0ANSLP[2:0] (ANLVL) SNTHR[3:0]is enabled). See others: Reservedcolumn_6Table 418for details.column_9column_10column_11column_12column_13column_14column_15RM0457 for details). for details).
31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
151413121110987 SDLVL[14:0]6543210
rrrrrrrrrrrrrrr
Bits 14:0SDLVL[14:0]: Short term sound level

Bits 31:15 Reserved, must be kept at reset value.

Bits 14:0 SDLVL[14:0]: Short term sound level

This bitfield is set by hardware. It contains the latest sound level computed by the SAD. To refresh this value, SDLVLF must be cleared.

46.8.14 ADF SAD ambient noise level register (ADF_SADANLVR)

Address offset: 0x0C4

Reset value: 0x0000 0000

This register contains the ambient noise level computed by the SAD.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.ANLVL[14:0]
rrrrrrrrrrrrrrr

Bits 31:15 Reserved, must be kept at reset value.

Bits 14:0 ANLVL[14:0]: Ambient noise level estimation

This bitfield is set by hardware. It contains the latest ambient noise level computed by the SAD. To refresh this bitfield, the SDLVLF flag must be cleared.

46.8.15 ADF digital filter data register 0 (ADF_DFLT0DR)

Address offset: 0x0F0

Reset value: 0x0000 0000

This register is used to read the data processed by the digital filter.

31302928272625242322212019181716
DR[23:8]
rrrrrrrrrrrrrrrr
1514131211109876543210
DR[7:0]Res.Res.Res.Res.Res.Res.Res.Res.
rrrrrrrr

Bits 31:8 DR[23:0]: Data processed by DFT0

Bits 7:0 Reserved, must be kept at reset value.

46.8.16 ADF hardware configuration register (ADF_HWCFGR)

Address offset: 0xFF0

Reset value: 0x0010 0104

31302928272625242322212019181716
OPTION_REGOUT[7:0]SAD[3:0]FLT_CFG[3:0]
rrrrrrrrrrrrrrrr
1514131211109876543210
NBF[7:0]FIFO_SIZE[7:0]
rrrrrrrrrrrrrrrr

46.8.17 ADF version register (ADF_VERR)

Address offset: 0xFF4

Reset value: 0x0000 0011

column_1column_2Bits 31:24 Bits 23:20 Bits 19:16 Bits 15:8 Bits 7:0... SAD[3:0] NBF[7:0] ... ...FLT_CFG[3:0] FIFO_SIZE[7:0]column_6column_7column_8column_9column_10column_11column_12column_13column_14column_15RM0457
31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.MAJREV[3:0]MINREV[3:0]
rrrrrrrr
Bits 7:4MAJREV[3:0]: ADF major revision
Bits 3:0MINREV[3:0]: ADF minor revision

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:4 MAJREV[3:0]: ADF major revision

Bits 3:0 MINREV[3:0]: ADF minor revision

46.8.18 ADF identification register (ADF_IPIDR)

Address offset: 0xFF8

Reset value: 0x0011 0032

31302928272625242322212019181716
ID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
ID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 ID[31:0]: ADF identifier value

46.8.19 ADF size identification register (ADF_SIDR)

Address offset: 0xFFC

Reset value: 0xA3C5 DD04

31302928272625242322212019181716
SID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
SID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 SID[31:0]: Size identification

These bits returns the size of the memory region allocated to the ADF registers.
The size of this memory region is of 4 Kbytes.

46.8.20 ADF register map

Table 431. ADF register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x000ADF_GCRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TRGO
Reset value0
0x004ADF_CKGCRCKGACTIVEPROCDIV[6:0]Res.Res.Res.Res.CCKDIV [3:0]TRGSRC [3:0]Res.Res.Res.TRGSENSRes.CCK1DIRCCK0DIRCKGMODRes.CCK1ENCCK0ENCKGDN
Reset value00000000000000000000000000
0x008 - 0x07CReservedReserved

Table 431. ADF register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x080ADF_SITF0CRSITFACTIVERes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.STH[4:0]Res.Res.SITFMOD [1:0]Res.SCKSRC [1:0]SITFEN
Reset value01111100000
0x084ADF_BSMX0CRBSMXACTIVERes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.BSSEL[4:0]
Reset value000000
0x088ADF_DFLT0CRDFLTACTIVEDFLTRUNRes.Res.NBDIS[7:0]Res.Res.Res.Res.TRGSRC [3:0]Res.Res.Res.TRGSENSRes.ACQMOD [2:0]Res.FTHDMAENDFLTEN
Reset value000000000000000000000
0x08CADF_DFLT0CICRRes.Res.Res.Res.Res.Res.SCALE[5:0]Res.Res.Res.MCICD[8:0]Res.CICMOD[2:0]Res.Res.DATSRC[1:0]
Reset value00000000000000000000
0x090ADF_ DFLT0RSFRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HPFC[1:0]HPFBYPRes.Res.RSFLTDRes.Res.Res.RSFLTBYP
Reset value00000
0x094 - 0x0A0ReservedReserved
0x0A4ADF_DLY0CRSKPBFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SKPDLY[6:0]
Reset value00000000
0x0A8ReservedReserved
0x0ACADF_DFLT0IERRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SDLVLIESDDETIERFOVRIECKABIESATIERes.Res.Res.Res.Res.Res.Res.DOVRIEFTHIE
Reset value00000000
0x0B0ADF_DFLT0ISRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SDLVLFSDDETFRFOVRFCKABFSATFRes.Res.Res.Res.Res.RXNEFRes.DOVRFFTHF
Reset value00000000
0x0B4ReservedReserved
0x0B8ADF_SADCRSADACTIVERes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SADMOD[1:0]Res.FRSIZE[2:0]Res.HYSTENRes.SADST[1:0]DETCFGDATCAP[1:0]SADEN
Reset value0000000000000

Table 431. ADF register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x0BCADF_SADCFGRRes.Res.Res.ANMIN[12:0]Res.Res.HGOVR
[2:0]
Res.Res.LFRNB
[2:0]
Res.Res.Res.Res.ANSLP[
2:0]
Res.Res.Res.SNTHR
[2:0]
Res.
Reset value00000000000000000000000000000
0x0C0ADF_SADSDLVRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SDLVL[14:0]Res.Res.
Reset value000000000000000
0x0C4ADF_SADANLVRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ANLVL[14:0]Res.Res.
Reset value000000000000000
0x0C8 - 0x0ECReservedReserved
0x0F0ADF_DFLT0DRDR[23:0]Res.Res.Res.Res.Res.Res.Res.
Reset value00000000000000000000000000000000
0xFF0ADF_HWCFGROPTION_REGOUT
[7:0]
SAD[3:0]FLT_CFG
[3:0]
NBF[7:0]FIFO_SIZE[7:0]
Reset value00000000000100000000001000001000
0xFF4ADF_VERRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MAJREV
[3:0]
MINREV
[3:0]
Reset value00010001
0xFF8ADF_IPIDRID[31:0]
Reset value00000000000100010000000000110010
0xFFCADF_SIDRSID[31:0]
Reset value10100011110001011101110100000100
Refer to Section 2.4 for the register boundary addresses.