The STA321 is a single chip solution for digital audio processing applications of up to
4.0 channels.
The STA321 is part of the Sound Terminal™ family that together with the digital power stage
provides full digital audio streaming to the speaker, offering cost effectiveness, low energy
dissipation and sound enrichment.
The STA321 input section consists of two multiplexed stereo analog inputs, a 16-bit ADC
and two independent digital input interfaces. The serial audio data input interface accepts all
possible formats, including the popular I
by the ADC or by the digitally processed signals.
The device has a full assortment of digital processing features. This includes sample rate
converter, pre and post mixing, up to 13 programmable 28-bit biquads (EQ) per channel,
bass/treble tone control and DRC. The embedded headphone detector indicates when
headphone jack is inserted.
The STA321 provides four independent channels of FFX™ output capabilities. In
conjunction with a power device, it provides high-quality, high-efficiency, all digital
amplification.
2
S format. There is also a digital output interface fed
The embedded CMOS bridge supplies up to 0.5 W into an 8-Ω load and 70 mW into a 16-Ω
load for the headphones output.
Figure 1.STA321 block diagram
SDATAO1
BICLKO
LRCLKO
SDATAO2
Serial audio
Osc
interface
4-channel
SRC
XTI
XTO
PLL
pre mixer
MCLK
V_BIAS
VCM
VHI
VLO
BICLKI1
LRCLKI1
SDATAI1
BICLKI2
LRCLKI2
SDATAI2
INL1
INL2
INR1
INR2
HPDET
Bias
Serial audio
interface
Serial audio
interface
PGA
PGA
HP detection
.
ADC
RSTN
Pre scaler
Divider
CLKOUT
STBY
Equalizer
TM
EAFTN
EATSN
EAPDN
Delay
13 biquad filters
Post mixer
Volume control and
saturation
FFX™
modulator
CMOS
headphone
bridge
EAPWM4
EAPWM3
EAPWM2
EAPWM1
OUT1
OUT2
OUT3
PWM00
I2C interface
SCL
MUTE
SDA
I2CDIS
ACLK
REG_BYP
Doc ID 15351 Rev 39/157
Pin descriptionSTA321
2 Pin description
Figure 2.Pin out
BICLKO
BICLKI1
BICLKI2
LRCLKO
LRCLKI1
LRCLKI2
SDATAO1
SDATAO2
SDATAI1
SDATAI2
MCLK
XTI
XTO
NC
PGND
PVDD
64
63
62
61
SCL
VCC1
OUT1
GND1
GND2
OUT2
VCC2
VCC3
OUT3
GND3
NC
PWM00
NC
HPDET
GND33
VCC33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
605958
19
20
21
57
56
STA321
22
23
24
25
55
54
53
52
51
50
49
48
TM
47
VDDIO2
46
VDD_REG2
45
DGND2
44
I2CDIS
43
ACLK
42
EAPDN
41
EATSN
40
EAFTN
39
EAPWM1
38
EAPWM2
37
EAPWM3
36
EAPWM4
35
STBY
34
RSTN
33
26
27
28
29
30
31
32
INL1
SDA
MUTE
CLKOUT
Table 2.Pin list
Pin PullNameTypeDescription
1-SCLIn (digital), schmitt tr I
3-OUT1Out (analog)HP/line-out PWM 1
6-OUT2Out (analog)HP/line-out PWM 2
9-OUT3Out (analog)HP/line-out PWM 3
11-NC-Not connected
10/157 Doc ID 15351 Rev 3
12-PWM00Out (digital)Auxiliary PWM
13-NC-Not connected
14-HPDET In (analog)Headphone detection
DGND1
REG_BYP
VDD_REG1
AGND
V_BIAS
VDDIO1
VHI
VLO
2
C serial clock, schmitt trigger input
AVDD
INR1
VCM
INR2
INL2
STA321Pin description
Table 2.Pin list (continued)
Pin PullNameTypeDescription
17-CLKOUTOut (digital)Buffered clock output
18-SDAIn/Out (digital)I
19HMUTEIn (digital)Mute (active high)
21-REG_BYPASS In (analog)
24-BIASIn/Out (analog)ADC microphone bias voltage
26-VLOIn (analog)ADC low reference voltage
27-VHIIn (analog)ADC high reference voltage
29-INR1In/Out (analog)ADC right channel line input1
30-INR2In/Out (analog)ADC right channel line input2
31-VCMIn/Out (analog)ADC common mode voltage
32-INL2In (analog)ADC left channel line input2 or microphone input2
33-INL1In (analog)ADC left channel line input1 or microphone input1
2
C serial data
DC regulator bypass:
0: normal operation, regulator enabled
The STA321 has an integrated oscillator between pins XTI and XTO.
The architecture is a single-stage oscillator with an inverter working as an amplifier. The
oscillator stage is biased by an internal resistor (of about 500 kΩ), and requires an external
PI network consisting of a crystal and two capacitors as shown in Figure 4 below. An enable
feature is provided in bit 7 of register MISC (address 0xC8) to stop the oscillator and thereby
to reduce power consumption.
Not all crystals operate satisfactorily with the type of oscillator used in the STA321. To find
out if a crystal is suitable for this device the following transconductance formula must be
evaluated and compared to the critical transconductance for the embedded oscillator:
Gm = Rm * ω
2
* (C + 2 * Co)2 < Gm
CRITICAL
/ 3
where ω is the crystal operating frequency, C = CA = CB, Co and Rm are shown in Figure 5
and Gm
CRITICAL
is given in Table 7 .
Figure 5.Equivalent circuit of crystal and external components
Table 7.Oscillator specifications
SymbolParameterMinTypMaxUnit
I
OSC
Duty
OSC
T
UP
Gm
CRITICAL
1. If no crystal is connected then the power consumption could be much higher.
2. τx is the time constant of the crystal and external components; a typical value is 44 µs.
Oscillator power consumption with crystal
connected
(1)
--215µA
Duty cycle46.947.8% 48.9%
Startup time-15 * τx-s
(2)
Oscillator transconductance1060--µA/V
18/157 Doc ID 15351 Rev 3
STA321Electrical specifications
3.5 Embedded DC regulator
The power supply to the digital STA321 core and PLL is provided via embedded linear DC
regulators as shown below in Figure 6. When pin REG_BYPASS is tied to ground, the DC
regulators are active so that a voltage in the range 2.5 V to 3.6 V applied to pins VDD_REGx
or PVDD provides a regulated internal voltage to the core and the PLL. The voltages Vddi
and Vddipll range from 1.55 V to 1.95 V depending on operating conditions.
Figure 6.Embedded DC regulator scheme
PVDD
DC
DC
DC
Vddi
Vddi
Vddipll
Core
PLL
STA321
VDD_REG1
VDD_REG2
REG_BYPASS
If the application allows multiple supplies or the power supply requirements are a
fundamental constraint, pin REG_BYPASS can be tied high and a 1.8 V external supply can
be applied directly to pins VDD_REGx and PVDD. In this case the operating range for such
an external supply is 1.55 V to 1.95 V.
Embedded DC regulators imply also static power consumption that must be take into
account when the power-down modes are active. The STA321 provides a deep powerdown
mode where also the regulators are active but in a low power consumption mode (see
Section 4.3.2 on page 27).
Doc ID 15351 Rev 319/157
Power-up and power-down sequencesSTA321
K
4 Power-up and power-down sequences
4.1 Device power-up
After providing the power supply to the device, it is necessary to wait until the DC regulator
PWUP time has elapsed before the device can be set up and used for normal operations.
(see Figure 7).
Figure 7.Startup sequence
VVDDIO
VDDIO
PVDD
3v3
2v2
VDDREG
VVDD_REG
VPVDD
STBY (activeH)
STBY (active H)
RSTN (active L)
RSTN (active L)
DC Reg.PWDN
PWDN (active H)
(active High)
DC Reg.A. OK(active High)
A.OK (active H)
I2C Writings
I2C read
I2C CL
I2C clock
XTI /MCLK
XTI / MCLK
Vdd ramp
DC reg. PWUP time
Table 8.Power-up signal description
Device in reset mode
User configuration via I2C
Signal/pinTypeDescription
VDDIOSupplyPower supply of the digital pads (= VDDIO1,2)
VDD_REGSupplyPower supply of the system core (= VDD_REG1,2)
PVDDSupplyPower supply of the PLL
STBYIn (digital)External standby signal provided by the user
RSTNIn (digital)External reset signal provided by the user
PWDNInternalPower-down of the DC regulator cell, controlled by the core
A. OKInternalDC regulator status, when active the 1.8 V is provided to the core
2
C readIn (I2C)Configuration commands coming to the I2C interface
I
2
I
C clockInternalI2C peripheral clock
XTI/MCLKIn (digital)Clock input source
20/157 Doc ID 15351 Rev 3
STA321Power-up and power-down sequences
Table 9.Startup timings
ParameterDescriptionMinTypMaxUnit
DC reg. power-up time
Device in reset mode
Table 10.Configuration example
Register
address
Start up time of the DC Regulator after
connecting the power
Must be greater than
(VDD time + DC reg. power-up time)
--300µs
---µs
ValueDescription
0xC90x00Remove PLL bypass
0xCA0x00Headphone detection polarity = 0
0xB80x4AConfigure SAI output: SAI_out1 = SAI_in1, SAI_out2 = SAI_in2
0xB70x38SRC source select: SRC1 = ADC, SRC2 = ADC
0xC60x02ADC clock on
2
0xB20xF3I
S configuration
0xC80x21Core clock on, SAI/ADC audio set to 32 kHz - 48 kHz range
0xB20xD3SAI_out: output enabled
0xA00x00Soft volume removed
0x000x00Remove bridge 3-state
4.2 Software power-down mode
The software power-down is obtained by configuring the appropriate I2C registers.
In order to obtain flexibility every peripheral has its independent, standby signal and several
gating clock cells are available.
Obviously, the I
recover from the power-down state only via the reset pin.
In the table below EA is embedded amplifier and CB is CMOS bridge. For complete
information this table must be used in conjunction with Chapter 14: Register description on
page 77.
Table 11.Registers for power-down
Put EA in standbyFFXCFG1[7]0x00 on page 81
Put CB in standbyFFXCFG1[6]0x00
Put PLL in standbyPLLPFE[5]0xC4 on page 132
Put ADC in standbyADCCFG0[3]0xC6 on page 133
Turn core clock offMISC[0]0xC8 on page 135
Turn ADC clock off ADCCFG0[1]0xC6
2
C peripheral can not be turned off in this mode, otherwise the device can
DescriptionRegister bitAddress
Doc ID 15351 Rev 321/157
Power-up and power-down sequencesSTA321
Table 11.Registers for power-down (continued)
DescriptionRegister bitAddress
Turn SRC clock off CKOCFG[3]0xC7 on page 134
Turn PROC clock off CKOCFG[2]0xC7
Turn FFX clock off CKOCFG[4]0xC7
4.2.1 Configuration example
This is an example of the register setup for power-down clock. It is assumed that every
peripheral is already configured and working correctly.
There are other configuration examples to help you get started please refer to other
chapters and also to Chapter 14: Register description on page 77 in order to get all the
necessary and complementary details.
Turn off all the peripherals.
Note:The MCLK (or XTI) must be used as system clock (sys_clk) before setting the PLL to
standby.
Table 12.Example configurations for power-down
Register bitAddressValueDescription
EA_STBY
CB_STBY
0x00 on page 810xC0
Set the embedded power amplifier and CMOS
bridge to power-down
CLK_FFX_ON0xC7 on page 134 0x0CTurn off the FFX modulator clock
ADC_STBY0xC6 on page 133 0x09Set the ADC into standby mode
CLK_ADC_ON0xC60x80Turn the ADC clock off
CLK_PROC_ON 0xC70x08Turn the processing clock off
CLK_SRC_ON0xC70x00Turn the sample rate converter clock to off
Bypass the PLL clock and use MCLK (or XTI) as
PLL_BYP_UNL0xC4 on page 132 0x80
source clock when the PLL is not locked (a
safety operational mode)
PLL_PWDN0xC40xA0Put the PLL in standby
CLK_CORE_ON 0xC8 on page 135 0x00Turning off the core clock
22/157 Doc ID 15351 Rev 3
STA321Power-up and power-down sequences
_
_
4.3 Hardware power-down mode
The hardware power-down is obtained by asserting pin STBY to high.
There are two power-down options available, namely mild mode and full (or deep) mode,
that could be selected using the DC_STBY_EN signal in register STBY_MODES
Figure 8 summarizes the main power-down sequence. “Power on” is the normal operating
status where all the startup procedures have already been executed. The rectangular boxes
indicate the steps to be done by the user whilst the rounded boxes indicate the steps done
by the device.
Figure 8.Hardware power-done sequence
Power on
2
I
C programming
register
STBY_MODES
bits:
CMP_EN_N
DC_STBY_EN
CMP_EN_N = 1 ?
NO
YES
Comp Cell Pwdn
Pin STBY <= 1'
DC_STBY_EN = 1 ?
NO
YES
DC Reg. Stby
Embedded amp.
CMOS bridge
Powerdown
I2C off
CLK
CLK
ADC off
Power-down mode
CLK Core off
PLL power down
Doc ID 15351 Rev 323/157
Power-up and power-down sequencesSTA321
Table 13.Frequently used signals
NameDescription
STBYInput pin STBY on page 11
PWDN
DC regulator
Internal
A. OK
DC regulator
Internal
CMP_EN_NBit 1, register STBY_MODES on page 139
EA_STBY
CB_STBY
Bits 7:6, register FFXCFG1 on page 81
EA/CB volumeInternal
PLL_UNLOCKBit 7, register PLLST on page 132
PLL_PWDNBit 5, register PLLPFE on page 132
CLK_PROC_ONBit 2, register CKOCFG on page 134
CLK_PROCProcessing clock
CLK_FFX_ONBit 4, register CKOCFG on page 134
clk_ffxFFX clock
CLK_ADC_ONBit 1, register ADCCFG0 on page 133
clk_adcADC clock
CLK_SRC_ONBit 3, register CKOCFG on page 134
clk_srcSRC clock
CMP_EN_NBit 1, register STBY_MODES on page 139
DC_STBY_ENBit 0, register STBY_MODES on page 139
FFX_ULCK_PLLBits 4:3, register FFXCFG1 on page 81
24/157 Doc ID 15351 Rev 3
STA321Power-up and power-down sequences
4.3.1 Mild power-down
In this case, the device is put into a mild power-down mode.
All the peripherals are set to standby and their clocks turned off.
2
The I
C configuration is not required as the default values of the registers are sufficient.
zInitial conditions:
FFX_ULCK_PLL = 10
CMP_EN_N = 0
DC_STBY_EN = 0
zGoing into power-down:
After the assertion of the pin STBY, the following actions are taken by the device:
1.Embedded amplifier (EA) and CMOS bridge (CB) volume are set to mute (the length of
this step changes according to the fade-out ramp configuration).
2. EA and CB are put into power-down.
After the previous operation is completed:
3. All peripherals are turned off (regardless the register settings).
4. The PLL clock is bypassed, the system clock (sys_clk in Figure 11 on page 29) is XTI.
5. All clocks are shut down.
zReturning to normal mode:
After the release of the pin STBY, the power-up procedure takes place:
1.All clocks are turned on.
2. All peripherals are restored to their previous status (based on the last register settings).
3. If the PLL clock was the system clock it will be selected again after the locking time.
4. The EA and the CB execute the fade-in procedure before becoming ready to be used
(the length of this step changes according to the fade-in ramp configuration).
Doc ID 15351 Rev 325/157
Power-up and power-down sequencesSTA321
Figure 9.Hardware powerdown sequence (mild mode)
STBY (active H)
DC Reg. PWDN
(active High)
DC Reg. A. OK
(active High)
Comp Cell PWDN
(active High)
EA is in Pwdn
EA Volume
CB is in Pwdn
CB Volume
PLL LOCKED
(active High)
PLL_PWDN
(active High)
I2C [CORE_CLK_ON]
CLK_I2C
Operational Volume
Operational Volume
MUTEO.V.
O.V.MUTE
I2C [CLK_PROC_ON]
CLK_PROC_CLK
I2C [CLK_FFX_ON]
CLK_FFX_CLK
I2C [CLK_ADC_ON]
CLK_ADC_CLK
I2C [CLK_SRC_ON]
CLK_SRC_CLK
E.A Fade InE.A Fade Out
Bridge Fade OutBridge Fade In
PLL Locking Time
26/157 Doc ID 15351 Rev 3
STA321Power-up and power-down sequences
4.3.2 Full power-down
In this case the device is put into a full power-down mode.
This implies lower power consumption than the mild mode, but has a drawback in that it
takes longer to execute.
zInitial conditions
FFX_ULCK_PLL = 10
CMP_EN_N = 1
DC_STBY_EN = 1
zGoing into power-down:
This mode differs from the previous one by an additional step at the end of the powerdown procedure and at the beginning of the power-up:
1.Embedded amplifier (EA) and CMOS bridge (CB) volume are set to mute (the length of
this step changes according to the fade-out ramp configuration).
2. EA and CB are put into power-down.
After the acknowledge signals (EA is in power-down and CB is in power-down) are
received:
3. All peripherals are turned off (regardless the register settings).
4. PLL clock is bypassed, the system clock (sys_clk in Figure 11 on page 29) is XTI.
5. All clocks are shut down.
6. DC regulator is put into standby mode. After this point the device is in a very low power
consumption mode.
zReturning to normal mode:
After the release of pin STBY, the power-up procedure will take place:
1.DC regulator is set to operational mode
After the acknowledge signal (DCAOK) from the DC regulator is received:
2. All clocks are turned on.
3. All peripherals are restored to the status based on their relative register settings.
4. If the PLL clock was the system clock it is selected again after the locking time.
5. The EA and the CB execute the fade-in procedure before being ready to be used (the
length of this step changes according to the fade-in ramp configuration).
Figure 11 above shows the STA321 clock management scheme with all the major clocks. As
can be seen, the system clock (sys_clk) is selected from one of three sources by using
register PLLB on page 136:
zan external clock BICLKI1
z(default) an external clock XTI or MCLK (the unused one must, however, be set to 0)
zthe internal PLL.
If the PLL is used there are some design constraints:
zpll_clk_in_i must be in the range: 2.048 MHz to 49.152 MHz
zpll_clk_out must be in the range: 65.536 MHz to 98.304 MHz.
The sys_clk is routed to the peripherals through the clock manager section.
5.1.1 Configuration example
This is an example of the PLL register setup. It is assumed that every peripheral is already
configured and working correctly.
There are other configuration examples to help you get started please refer to other
chapters and also to Chapter 14: Register description on page 77 in order to get all the
necessary and complementary details.
Starting with MCLK as system clock switching to PLL as source
Table 16.Register setup to provide sys_clk from MCLK to PLL
RegisterAddressValueDescription
PLLPFE0xC40x80
PLLB0xC90x00Remove the PLL bypass and use its clock as system
Safety operational mode: automatic use of MCLK (or XTI)
as system clock if the PLL is not locked
30/157 Doc ID 15351 Rev 3
STA321Clock management
r
5.2 Peripheral clock manager
This block manages the clocks of the core processing peripherals ADC, FFX, PROC
(including memories and SAI interfaces) and SRC.
A clock divider (by 2) is attached before every block except the FFX.
Each block is attached to a global gating cell and to a dedicated one. This allows a flexible
power-consumption management because it is possible to turn off either the whole
processing chain or just a single block. The only exception is the I
2
C peripheral clock which
is disabled only when the device is in hardware power-down mode. In all the other cases this
clock remains active.
5.3 Fractional PLL
The PLL specifications are given in Table 6 on page 14.
Figure 12. PLL block diagram
PLL_CLK_in
pll_clk_in
PLLCFG0(3-0)
PLLCFG0[3:0]
CLKIN
CLKIN
IDF
IDF
IDF
Input freq. divider
Lock detect
F_INT
LOCKP
LOCKP
PLLCFG3(7)
PLLCFG3[7]
PLLCFG3[6]
PLLCFG3(6)
PLLCFG0[6]
PLL_FR_CTRL
PLLCFG0(6)
5.3.1 PLL block description
Phase/frequency detector (PFD)
This block compares the phase difference between the corresponding rising edges of the
F_INT and the clock coming from the loop frequency divider.
It generates voltage pulses with widths proportional to the input phase error.
Charge pump and loop filter (LPF/CPUMP)
PLL_PWDN
PLL_PWDN
pll_strb
PLL_STRB
pll_strbbyp
PLL_STRBBYP
pll_fr_ctrl
Buffer
DITHER
DITHER
Disable
PLLCFG0(5-4)PLLCFG1(7-0)
Disable
PLLCFG0[5:4]
PFD
LDF
Loop freq. divider
Fractional
controlle
FRAC
FRAC
Input
Input
PLLCFG2(7-0)
PLLCFG1[7:0]
PLLCFG2[7:0]
LPF
cpump
NDIV
NDIV
PLLCFG3(5-0)
PLLCFG3[5:0]
VCO
FVCO
FVCO
This block converts the voltage pulses from the phase/frequency detector to current pulses
which charge the loop filter and generate the control voltage for the voltage controlled
oscillator (VCO).
Doc ID 15351 Rev 331/157
Clock managementSTA321
Voltage controlled oscillator (VCO)
This is the oscillator inside the PLL, which produces a frequency, f
proportional to the input control voltage.
Input frequency divider (IDF)
This frequency divider divides the PLL input clock CLKIN by the input division factor (IDF) to
generate the PFD input frequency. IDF is programmed in register PLLCFG0[3:0].
Loop frequency divider (LDF)
This frequency divider is present within the PLL for dividing the VCO output by the loop
division factor (LDF). LDF is programmed in register bits PLLCFG3[5:0].
Lock circuit
The output of this block, signal LOCKP, is asserted high when the PLL enters the state of
coarse lock in which the output frequency is ±10% of the desired frequency. LOCKP is
refreshed every 32 cycles of F_INT. The status bit PLL_UNLOCK is in register PLLST on
page 132.
5.3.2 Output frequency computation
The input clock frequency of the phase/frequency detector (PFD) is
f
= CLKIN / IDF
F_INT
The VCO frequency depends on the value of register bit PLLCFG0.PLL_FR_CTRL such
that
, on output FVCO
VCO
When PLL_FR_CTRL = 1
f
VCO
= f
* (LDF + FRAC / 216 + 1 / 217)
F_INT
and when PLL_FR_CTRL = 0
f
VCO
= f
F_INT
* LDF
Notes:
1. When dither is disabled (PLL_DDIS = 1), the factor 1 / 2
17
is not used in the multiplication.
2. There are some limits to the input and output frequencies as given in Ta bl e 1 7 and
Ta bl e 1 8 when selecting the values for IDF, LDF, and FRAC.
3. The LDF values of 5, 6 and 7 cannot be used when fractional synthesis mode is on, that
is, when PLL_FR_CTRL = 1.
4. The fractional control bits (FRAC_INPUT) must be set to the required values before
activating the fractional synthesis mode.
1. The LDF values of 5, 6 and 7 cannot be used when fractional synthesis mode is ON (PLL_FR_CTRL = 1)
Doc ID 15351 Rev 333/157
Digital processing stageSTA321
r
r
6 Digital processing stage
6.1 Signal processing flow
The STA321 provides 4 channels of audio signal processing. The block diagram is shown in
the following figure.
Figure 13. Processing flow
-1
kZ
kZ
kZ
kZ
Delay
Vol 0
-1
-1
-1
Post mix
Vol 1
Vol 2
Volume control
Master volume
Limite
FFX modulator
Processing data mux
Sample
rate
converte
- G0
- G1
Pre mix
- G2
- G3Vol 3
Pre scaler
Bq0
Bq0
Bq0
Bq0
EQ - tone control
Bq12
Bq12
Bq12
Bq12
13 biquads
Left and right channels coming from the two serial audio interfaces and ADC (left and right
channels) are fed into the selection multiplexer (controlled by register SRCINSEL on
page 128), so that each channel can be connected to any desired processing chain. The
four channels are then sample rate converted to the fixed internal sampling rate. Pre mix,
EQ/tone processing, programmable delay, post mix, and volume/limiter make up the
STA321 signal processing chain.
The sample rate converter (SRC) re samples the input data source in order to send to the
processing block an audio stream always with a fixed frequency:
sampling frequency, f
In all the examples given here, f
S
= f
sys_clk
= 96 kHz.
S
16
000
32
001
32
010
24
011
24
100
24
101
24
else
16
000
32
001
32
010
24
011
24
100
24
101
24
else
P2SDATA[2:0]
/ 1024 where f
SAI_out1
2-channel signal
1-channel signal
SAI_out2
is the system clock frequency.
sys_clk
Figure 16. Sample rate converter block diagram
Data input
LRCK_IN
Interpolation
FIR x2
DRLL
Threshold
selector
Ratio
Interpolation
FIR x2
Precomp.
FIR
Sync 6
async.
Data output
The selection between x2 FIR interpolation and direct input data is made automatically by
the threshold selector block. If the input sampling frequency (measured by the DRLL) is
higher than the SRC threshold (that is, more than 81 kHz) the direct connection is selected
(first filter bypassed), otherwise the first x2 filter is added to the data path.
A 3-kHz hysteresis is fixed around the SRC threshold nominal value in order to prevent
unstable oscillations.
Doc ID 15351 Rev 335/157
Digital processing stageSTA321
6.3 Pre-EQ mix 1 and post-EQ mix
The four-channel data, received from the sample rate converters, is sent to Mix1 block to
produce the four mixed-channel data for processing. All this data can be mapped to any
internal processing channel through the appropriate configuration of the RAM memory
locations.
Table 19.Channel mapping
FunctionChannel Memory location (RAM)
Ch0from 0x00
Pre mixer
Post mixer
Ch1from 0x04
Ch2from 0x08
Ch3from 0x0c
Ch0from 0x118
Ch1from 0x11c
Ch2from 0x120
Ch3from 0x124
The post-EQ mixer acts in a similar way for the output channels from the processing and
directed to the FFX. It is placed after the delay block which provides a full 4-channel input
mix on every channel.
Figure 17. Mixers block diagram
G2_0
pre: 0x08
pos: 0x120
ch0_in
pre: 0x00
pos: 0x118
G0_0
ch0_in
ch1_in
ch2_in
G0_1
G0_2
pre: 0x01
pos: 0x119
pre: 0x02
pos: 0x11A
ch0_out
++
ch1_in
ch2_in
G2_1
G2_2
pre: 0x09
pos: 0x121
pre: 0x0A
pos: 0x122
ch2_out
ch3_in
G0_3
pre: 0x03
pos: 0x11B
ch3_in
G2_3
pre: 0x0B
pos: 0x123
pre: 0x04
ch0_in
G1_0
pos: 0x11C
pre: 0x05
ch1_in
G1_1
pos: 0x11D
pre: 0x06
ch2_in
ch3_in
pos: 0x11E
G1_2
pos: 0x11Ff
G1_3
pre: 0x07
ch1_out
+
ch0_in
ch1_in
ch2_in
ch3_in
G3_0
G3_1
G3_2
G3_3
pre: 0x0C
pos: 0x124
pre: 0x0D
pos: 0x125
pre: 0x0E
pos: 0x126
pre: 0x0F
pos: 0x127
ch3_out
+
36/157 Doc ID 15351 Rev 3
STA321Digital processing stage
6.3.1 Presets
By default, each mixer output is connected to its corresponding input without any attenuation
and without any mixing with the other channels:
The pre scale block, which precedes the first biquad, could be used to attenuate the input
signal when the filters of the processing chain have a gain that could reach the clamping
value.
Each channel has a dedicated 24-bit signed multiplier in the range -1 (0x800000) to almost
+1 (0x7FFFFF).
6.4.1 Presets
By default, all pre-scale factors are set to 0x7FFFFF
6.5 Equalization, tone control and effects
Figure 18. EQ/tone block diagram
From
prescaler
Biquad
00
Biquad
ReservedRAM
07
ReservedReserved
ReservedRAM
Biquad
08
RAM
To
delay stage
Biquad
09
effects_en[0]
High
pass
treb_selbass_sel
effects_en[1]
RAMDeemph.
Treble
RAM
Biquad
12
Biquad
10
Reserved
RAM
Reserved
RAMBass
Biquad
11
Four channels of input data are fed to the EQ processing block which provides 13
user-programmable biquad filters per channel as shown in Figure 18 above.
A description of the biquad programming is given in Section 6.14 on page 44.
Some filter coefficients are pre-programmed and stored in the non-volatile memory in order
to supply particular EQ effects (see Figure 19 and Table 20 on page 38).
The selection of RAM, ROM bass/treble or ROM effects is made using registers
EFFS_EN_CHn on page 109 for the effects and BASS_SELn_R on page 111 and
TREB_SELn_R on page 113 for the bass/treble. Each biquad can be configured
independently.
Doc ID 15351 Rev 337/157
Digital processing stageSTA321
Figure 19. Biquad coefficient selection
RAM
ROM - Effects
RAM
ROM - Effects
ROM - Bass
RAM
ROM - Effects
ROM - Trebl.
Coefficients
ROMCHxx_
ROMCHxx & BASS_SELxx
Coefficients
ROMCHxx & TREB_SELxx
Coefficients
Biquads (00-10)
Biquads (11)
Biquads (12)
Table 20.EQ control signals
Signal nameDescriptionChannelRegister addr
Ch00x71
Ch10x73
effects_en[1]1: enable deemphasysa filter
Ch20x73
Ch30x77
Ch00x78
Ch10X79
bass_sel[5]1: enable bass tone control
Ch20X7A
Ch30X7B
Ch00X7C
Ch10X7D
treb_sel[5]1: enable treble tone control
Ch20X7E
Ch30X7F
38/157 Doc ID 15351 Rev 3
STA321Digital processing stage
6.6 Biquads
The biquads are based on the following equation and is shown diagramatically in Figure 20.
where Y[n] represents the output and X[n] represents the input. Fractional multipliers
are 24-bit signed with coefficient values in the range -1 (0xFFFFFF) to +1 (0x7FFFFF).
Figure 20. Biquad filter
-1
-1
6.6.1 Presets
By default all the biquads values in RAM are set to give a bypass function; in actual fact, the
signal passes through unchanged. The coefficients for this are:
The standard high-pass filter is provided by the STA321
Figure 21. High-pass filter frequency response
b0/2
b1/2
b2 Z
2
2Z
+
+
+
2
-a1/2
-a2
-1
Z
-1
Z
High Pass Filter
0
−5
−10
−15
Gain [dB]
−20
−25
−30
0
10
1
10
10
2
Freq. [Hz]
3
10
4
10
5
10
Doc ID 15351 Rev 339/157
Digital processing stageSTA321
6.8 Deemphasis filter
The standard deemphasis filter is provided by the STA321.
Figure 22. Deemphasis filter frequency response
40/157 Doc ID 15351 Rev 3
STA321Digital processing stage
6.9 Bass and treble control
Preset values for the 11th and 12th biquads of every channel are stored in ROM in order to
achieve a bass and treble tone control.
They are channel independent and have 24 curves ranging from -12 to +12 dB gain with
1 dB steps. Their selection (and enable) is via registers BASS_SELx_R and TREB_SELx_R
where x is the number of the channel to be equalized.
The EQ curve and filter cut-off frequencies are shown in Figure 23 and Figure 24.
With a sampling frequency of 96 kHz (inside the processing block), the cut-off frequencies
are 3 kHz for treble curves and 150 Hz for bass curves.
Figure 23. Frequency responses of treble control at 1-dB gain steps
Figure 24. Frequency responses of bass control at 1-dB gain steps
Doc ID 15351 Rev 341/157
Digital processing stageSTA321
6.9.1 Configuration example
This is an example of the tone control register setup. It is assumed that every peripheral is
already configured and working correctly.
Ta bl e 2 1 gives the register values to obtain +12 dB of bass on all channels and -10 dB of
treble on channels 0 and 1.
Table 21.Selecting EQ curves
Register - AddressProgrammed valueDescription
BASS_SEL0_R 0x38CH0 +12 dB bass
BASS_SEL1_R 0x38CH1 +12 dB bass
BASS_SEL2_R 0x38CH2 +12 dB bass
BASS_SEL3_R 0x38CH3 +12 dB bass
TREB_SEL0_R0x22CH0 -10 dB treble
TREB_SEL1_R 0xx22CH1 - 10 dB treble
6.10 Programmable delay
Every channel, just after the biquads stage, is connected to a dedicated delay block.
The length of the delay is stored in RAM at location 0x128 and can vary from 0 to 35
samples. The corresponding time delay depends on the processing sampling frequency.
6.10.1 Presets
The delay of every channel is set to 0.
6.11 Volume and mute control
The STA321 provides a flexible volume and mute control stage. Using the registers VOLCH0
to VOLCH3 on page 122 it is possible to set the volume for each channel individually from
+36 dB to -105 dB with 0.5-dB steps.
There is a master volume control, register MVOL on page 120, as well. The master volume
adds an offset to all the individual volume settings.
The mute function offers the possibility to turn off the sound by reducing the volume setting
to -127.5 dB. It could be activated in two ways:
zregister FFXCFG0 on page 82 provides a dedicated mute control for each channel.
zpin MUTE, driven by an external signal, puts all four channels into mute mode.
Register VOLCFG on page 120 provides some flexibility to set how the mute and volume
change procedures are applied. If bit SVOL_ONx is activated the volume of channel x is
changed gradually (soft volume or soft mute); using a ramp it starts from the current value
and goes down to the target value or to -127.5 dB for mute. The slope of the ramp is set with
with the value TIM_SVOL which represents how many samples are needed to achieve a
0.5-dB step.
= 2
TIM_SVOL
/ f
t
STEP
S
42/157 Doc ID 15351 Rev 3
STA321Digital processing stage
The ramp procedure ends when the target volume or mute level is reached. The time for the
volume change is calculated as:
t
CHANGE
= (volume
CURRENT
- volume
TA R GE T
) / 0.5 * t
STEP
If SVOL_ONx is not used, the volume and mute are set instantaneously.
The STA321 also has the possibility to put the FFX into mute in the event of bad input data
using register FFXCFG0. If bit BAD_CKS_M is set to 1 the FFX is muted when BICLK and
LRCLK do not meet the specifications. If MIS_BICK_M is set to 1 the FFX is muted when
BICLK is missing. The mute can be applied gradually or abruptly via bit BAD_IN_M.
6.12 Limiter (clamping)
The saturation stage provides an individual or a global limitation on the output signal
amplitude such that if the signal is above the limiting value then it is truncated (clamped).
A 23-bit saturation value made up using registers SATCHxCFG1, SATCHxCFG2 and
SATCHxCFG3 can be set for each channel x.
However, if bit 7 of register SATCH0CFG1 on page 116 is set to 1, all the channels take the
saturation value of channel 0 and ignore the individual settings.
6.13 FFX channel re-mapping
Figure 25. FFX re-mapping
Processing block
Channle 0
Channel 1
Channel 2
Channel 3
The channels are re-mapped through registers PWMMAP1, PWMMAP2 and PWMMAP3 on
page 86. The default configuration routes the channels directly to their respective CB/EA
signals:
pwm_1a -> cb_pwm_1
pwm_1b -> cb_pwm_2
pwm_2a -> cb_pwm_3
pwm_2b -> pwm_00 (PWM00)
pwm_3a -> ea_pwm_1 (EAPWM1)
pwm_3b -> ea_pwm_2 (EAPWM2)
pwm_4a -> ea_pwm_3 (EAPWM3)
pwm_4b -> ea_pwm_4 (EAPWM4)
FFX blockChannel re-map
FFX ch1
FFX ch2
FFX ch3
FFX ch4
pwm_1a
pwm_1b
pwm_2a
pwm_2b
pwm_3a
pwm_3b
pwm_4a
pwm_4b
cb1_map
cb2_map
cb3_map
pwm00_map
ea1a_map
ea1b_map
ea2a_map
ea2b_map
cb_pwm_1
cb_pwm_2
cb_pwm_3
pwm_00
ea_pwm_1a
ea_pwm_1b
ea_pwm_2a
ea_pwm_2b
CMOS
bridge
OUT1
OUT2
OUT3
Doc ID 15351 Rev 343/157
Digital processing stageSTA321
6.14 Memory programming
Table 22 on page 47 shows the RAM mapping for the programmable functions in the signal
processing stage. Changing or reading this data is done through the I
single-word mode or in multi-word mode. Register PROCCTRL on page 107 sets the
desired mode and whether to read or write:
z1-word mode:
this is for write only; the address of the memory location must be specified in registers
START_ADDR2 and START_ADDR1 on page 108 and the value of the parameter must
be written into registers I2CB0_TOP, I2CB0_MID and I2CB0_BOT on page 102.
z5-word mode:
in this case it is possible to write/read 5 contiguous locations. Only the address of the
first one must be specified in registers START_ADD1-2, all the others are generated
automatically. The values of the parameters must be placed in (or taken from) registers
The 5-word mode is particular useful during the biquad programming when a set of five
coefficients needs to be updated. Not only is it more efficient to change all of them at the
same time but it avoids the generation of possible unpleasant acoustical side-effects.
The following sections explain how to implement this programming using the I
6.14.1 Writing one coefficient/location to RAM
zWrite RAM address to registers START_ADDR2 and START_ADDR1
z(b0) Write 8 MSBs of coefficient in register I2CB0_TOP
zWrite 8 middle bits of coefficient in register I2CB0_MID
zWrite 8 LSBs of coefficient in register I2CB0_BOT
zWrite 1 to bit W1 in register PROCCTRL.
2
C interface in either
2
C interface.
Figure 26. Writing RAM location
Write address to
START_ADDR[8:0]
Write top 8 bits
of coefficient
Write middle 8 bits
of coefficient
Write bottom 8 bits
of coefficient
Write 1 to bit W1
in PROC_CTRL
44/157 Doc ID 15351 Rev 3
0x61 = address[8]
0x62 = address[7:0]
0x51 = top_val
0x52 = mid_val
0x53 = bot_val
0x60 = 0x01
STA321Digital processing stage
6.14.2 Writing a set of five coefficients/locations to RAM
zWrite RAM address of b0 to registers START_ADDR2 and START_ADDR1
z(b0) Write 8 MSBs of coefficient in register I2CB0_TOP
zWrite 8 middle bits of coefficient in register I2CB0_MID
zWrite 8 LSBs of coefficient in register I2CB0_BOT
z(b1) Write 8 MSBs of coefficient in register I2CB1_TOP
zWrite 8 middle bits of coefficient in register I2CB1_MID
zWrite 8 LSBs of coefficient in register I2CB1_BOT
z(b2) Write 8 MSBs of coefficient in register I2CB2_TOP
zWrite 8 middle bits of coefficient in register I2CB2_MID
zWrite 8 LSBs of coefficient in register I2CB2_BOT
z(a1) Write 8 MSBs of coefficient in register I2CA1_TOP
zWrite 8 middle bits of coefficient in register I2CA1_MID
zWrite 8 LSBs of coefficient in register I2CA1_BOT
z(a2) Write 8 MSBs of coefficient in register I2CA2_TOP
zWrite 8 middle bits of coefficient in register I2CA2_MID
zWrite 8 LSBs of coefficient in register I2CA2_BOT
zWrite 1 to bit WA in register PROCCTRL.
Figure 27. Writing five contiguous RAM locations
Write address to
START_ADDR[8:0]
Write top 8 bits
of coefficient
0x61 = address[8]
0x62 = address[7:0]
0x51/0x54/0x57/0x5A/0x5D
= top_val
Write middle 8 bits
of coefficient
Write bottom 8 bits
of coefficient
Repeat for all 5 coefficients
Write 1 to bit WA
in PROC_CTRL
0x52/0x55/0x58/0x5B/0x5E
= mid_val
0x53/0x56/0x59/0x5C/0x5F
= bot_val
0x60 = 0x02
Doc ID 15351 Rev 345/157
Digital processing stageSTA321
6.14.3 Reading a set of five coefficients/locations from RAM
zWrite RAM address of b0 to registers START_ADDR2 and START_ADDR1
zWrite 1 to bit RA in register PROCCTRL
z(b0) Read 8 MSBs of coefficient in register I2CB0_TOP
zRead 8 middle bits of coefficient in register I2CB0_MID
zRead 8 LSBs of coefficient in register I2CB0_BOT
z(b1) Read 8 MSBs of coefficient in register I2CB1_TOP
zRead 8 middle bits of coefficient in register I2CB1_MID
zRead 8 LSBs of coefficient in register I2CB1_BOT
z(b2) Read 8 MSBs of coefficient in register I2CB2_TOP
zRead 8 middle bits of coefficient in register I2CB2_MID
zRead 8 LSBs of coefficient in register I2CB2_BOT
z(a1) Read 8 MSBs of coefficient in register I2CA1_TOP
zRead 8 middle bits of coefficient in register I2CA1_MID
zRead 8 LSBs of coefficient in register I2CA1_BOT
z(a2) Read 8 MSBs of coefficient in register I2CA2_TOP
zRead 8 middle bits of coefficient in register I2CA2_MID
zRead 8 LSBs of coefficient in register I2CA2_BOT
Figure 28. Reading five contiguous RAM locations
Write address to
START_ADDR[8:0]
Write 1 to bit RA
in PROC_CTRL
Read top 8 bits
of coefficient
Read middle 8 bits
of coefficient
Read bottom 8 bits
of coefficient
Repeat for All 5 Coefficients
0x61 = address[8]
0x62 = address[7:0]
0x60 = 0x08
top_val =
0x51/0x54/0x57/0x5A/0x5D
mid_val =
0x52/0x55/0x58/0x5B/0x5E
bot_val =
0x53/0x56/0x59/0x5C/0x5F
46/157 Doc ID 15351 Rev 3
STA321Digital processing stage
6.14.4 RAM mapping
Table 22.RAM mapping for processing stage
AddrDescr.DefaultBlockAddrDescr.DefaultBlock
0x000ch0i0x7FFFFF
0x021#2 a20x000000
0x001ch1i0x0000000x022#2 a10x000000
Pre mix: ch0
0x002ch2i0x0000000x023#3 b00x400000
0x003ch3i0x0000000x024#3 b10x000000
0x004ch0i0x000000
0x025#3 b20x000000
0x005ch1i0x7FFFFF0x026#3 a20x000000
Pre mix: ch1
0x006ch2i0x0000000x027#3 a10x000000
0x007ch3i0x0000000x028#3 b00x400000
0x008ch0i0x000000
0x029#4 b10x000000
0x009ch1i0x0000000x02A#4 b20x000000
Pre mix: ch2
0x00Ach2i0x7FFFFF0x02B#4 a20x000000
0x00Bch3i0x0000000x02C #4 a10x000000
0x00Cch0i0x000000
0x02D#5 b00x400000
0x00Dch1i0x0000000x02E#5 b10x000000
Pre mix: ch3
0x00Ech2i0x0000000x02F#5 b20x000000
0x00Fch3i0x7FFFFF0x030#5 a20x000000
0x010ch00x7FFFFF
0x031#5 a10x000000
0x011ch10x7FFFFF0x032#6 b00x400000
Pre scaler
0x012ch20x7FFFFF0x033#6 b10x000000
0x013ch30x7FFFFF0x034#6 b20x000000
(Ch0-biquad)
0x014#0 b00x400000
0x035#6 a20x000000
0x015#0 b10x0000000x036#6 a10x000000
0x016#0 b20x0000000x037#7 b00x400000
0x017#0 a20x0000000x038#7 b10x000000
0x018#0 a10x0000000x039#7 b20x000000
0x019#1 b00x4000000x03A#7 a20x000000
0x01A#1 b10x0000000x03B#7 a10x000000
Ch0-biquad
0x01B#1 b20x0000000x03C#8 b00x400000
0x01C#1 a20x0000000x03D #8 b10x000000
0x01D#1 a10x0000000x03E#8 b20x000000
0x01E#2 b00x4000000x03F#8 a20x000000
0x01F#2 b10x0000000x040#8 a10x000000
0x020#2 b20x0000000x041#9 b00x400000
Doc ID 15351 Rev 347/157
Digital processing stageSTA321
Table 22.RAM mapping for processing stage (continued)
AddrDescr.DefaultBlockAddrDescr.DefaultBlock
0x042#9 b10x000000
0x065#3 b10x000000
0x043#9 b20x0000000x066#3 b20x000000
0x044#9 a20x0000000x067#3 a20x000000
0x045#9 a10x0000000x068#3 a10x000000
0x046#10 b00x4000000x069#3 b00x400000
0x047#10 b10x0000000x06A#4 b10x000000
0x048#10 b20x0000000x06B#4 b20x000000
0x049#10 a20x0000000x06C #4 a20x000000
0x04A#10 a10x0000000x06D#4 a10x000000
0x04B#11 b00x4000000x06E#5 b00x400000
(Ch0-biquad)
0x04C#11 b10x0000000x06F#5 b10x000000
0x04D#11 b20x0000000x070#5 b20x000000
0x04E#11 a20x0000000x071#5 a20x000000
0x04F#11 a10x0000000x072#5 a10x000000
0x050#12 b00x4000000x073#6 b00x400000
0x051#12 b10x0000000x074#6 b10x000000
0x052#12 b20x0000000x075#6 b20x000000
0x053#12 a20x0000000x076#6 a20x000000
(Ch1-biquad)
0x054#12 a10x0000000x077#6 a10x000000
0x055#0 b00x400000
0x078#7 b00x400000
0x056#0 b10x0000000x079#7 b10x000000
0x057#0 b20x0000000x07A#7 b20x000000
0x058#0 a20x0000000x07B#7 a20x000000
0x059#0 a10x0000000x07C #7 a10x000000
0x05A#1 b00x4000000x07D#8 b00x400000
0x05B#1 b10x0000000x07E#8 b10x000000
0x05C#1 b20x0000000x07F#8 b20x000000
Ch1-biquad
0x05D#1 a20x0000000x080#8 a20x000000
0x05E#1 a10x0000000x081#8 a10x000000
0x05F#2 b00x4000000x082#9 b00x400000
0x060#2 b10x0000000x083#9 b10x000000
0x061#2 b20x0000000x084#9 b20x000000
0x062#2 a20x0000000x085#9 a20x000000
0x063#2 a10x0000000x086#9 a10x000000
0x064#3 b00x4000000x087#10 b00x400000
48/157 Doc ID 15351 Rev 3
STA321Digital processing stage
Table 22.RAM mapping for processing stage (continued)
AddrDescr.DefaultBlockAddrDescr.DefaultBlock
0x088#10 b10x000000
0x0AB #4 b10x000000
0x089#10 b20x0000000x0AC #4 b20x000000
0x08A#10 a20x0000000x0AD #4 a20x000000
0x08B#10 a10x0000000x0AE #4 a10x000000
0x08C#11 b00x4000000x0AF #5 b00x400000
0x08D#11 b10x0000000x0B0#5 b10x000000
0x08E#11 b20x0000000x0B1#5 b20x000000
(Ch1-biquad)
0x08F#11 a20x0000000x0B2#5 a20x000000
0x090#11 a10x0000000x0B3#5 a10x000000
0x091#12 b00x4000000x0B4#6 b00x400000
0x092#12 b10x0000000x0B5#6 b10x000000
0x093#12 b20x0000000x0B6#6 b20x000000
0x094#12 a20x0000000x0B7#6 a20x000000
0x095#12 a10x0000000x0B8#6 a10x000000
0x096#0 b00x400000
0x0B9#7 b00x400000
0x097#0 b10x0000000x0BA #7 b10x000000
0x098#0 b20x0000000x0BB #7 b20x000000
0x099#0 a20x0000000x0BC #7 a20x000000
(Ch2-biquad)
0x09A#0 a10x0000000x0BD #7 a10x000000
0x09B#1 b00x4000000x0BE #8 b00x400000
0x09C#1 b10x0000000x0BF #8 b10x000000
0x09D#1 b20x0000000x0C0 #8 b20x000000
0x09E#1 a20x0000000x0C1#8 a20x000000
0x09F#1 a10x0000000x0C2 #8 a10x000000
0x0A0#2 b00x4000000x0C3#9 b00x400000
Ch2-biquad
0x0A1#2 b10x0000000x0C4#9 b10x000000
0x0A2#2 b20x0000000x0C5#9 b20x000000
0x0A3#2 a20x0000000x0C6#9 a20x000000
0x0A4#2 a10x0000000x0C7#9 a10x000000
0x0A5#3 b00x4000000x0C8#10 b00x400000
0x0A6#3 b10x0000000x0C9#10 b10x000000
0x0A7#3 b20x0000000x0CA #10 b20x000000
0x0A8#3 a20x0000000x0CB #10 a20x000000
0x0A9#3 a10x0000000x0CC #10 a10x000000
0x0AA #3 b00x4000000x0CD #11 b00x400000
Doc ID 15351 Rev 349/157
Digital processing stageSTA321
Table 22.RAM mapping for processing stage (continued)
AddrDescr.DefaultBlockAddrDescr.DefaultBlock
0x0CE #11 b10x000000
0x0F1#5 b10x000000
0x0CF #11 b20x0000000x0F2#5 b20x000000
0x0D0#11 a20x0000000x0F3#5 a20x000000
0x0D1#11 a10x0000000x0F4#5 a10x000000
0x0D2#12 b00x4000000x0F5#6 b00x400000
(Ch2-biquad)
0x0D3#12 b10x0000000x0F6#6 b10x000000
0x0D4#12 b20x0000000x0F7#6 b20x000000
0x0D5#12 a20x0000000x0F8#6 a20x000000
0x0D6#12 a10x0000000x0F9#6 a10x000000
0x0D7#0 b00x400000
0x0FA#7 b00x400000
0x0D8#0 b10x0000000x0FB #7 b10x000000
0x0D9#0 b20x0000000x0FC #7 b20x000000
0x0DA #0 a20x0000000x0FD #7 a20x000000
0x0DB #0 a10x0000000x0FE #7 a10x000000
0x0DC #1 b00x4000000x0FF#8 b00x400000
0x0DD #1 b10x0000000x100#8 b10x000000
0x0DE #1 b20x0000000x101#8 b20x000000
0x0DF #1 a20x0000000x102#8 a20x000000
(Ch3-biquad)
0x0E0#1 a10x0000000x103#8 a10x000000
0x0E1#2 b00x4000000x104#9 b00x400000
0x0E2#2 b10x0000000x105#9 b10x000000
0x0E3#2 b20x0000000x106#9 b20x000000
Ch3-biquad
0x0E4#2 a20x0000000x107#9 a20x000000
0x0E5#2 a10x0000000x108#9 a10x000000
0x0E6#3 b00x4000000x109#10 b00x400000
0x0E7#3 b10x0000000x10A#10 b10x000000
0x0E8#3 b20x0000000x10B#10 b20x000000
0x0E9#3 a20x0000000x10C#10 a20x000000
0x0EA #3 a10x0000000x10D#10 a10x000000
0x0EB #3 b00x4000000x10E#11 b00x400000
0x0EC #4 b10x0000000x10F#11 b10x000000
0x0ED #4 b20x0000000x110#11 b20x000000
0x0EE #4 a20x0000000x111#11 a20x000000
0x0EF#4 a10x0000000x112#11 a10x000000
0x0F0#5 b00x4000000x113#12 b00x400000
50/157 Doc ID 15351 Rev 3
STA321Digital processing stage
Table 22.RAM mapping for processing stage (continued)
AddrDescr.DefaultBlockAddrDescr.DefaultBlock
0x114#12 b10x000000
0x120ch0i0x000000
0x115#12 b20x0000000x121ch1i0x000000
(Ch3-biquad)
0x116#12 a20x0000000x122ch2i0x7FFFFF
0x117#12 a10x0000000x123ch3i0x000000
0x118 ch0i0x7FFFFF
0x124ch0i0x000000
0x119 ch1i0x0000000x125ch1i0x000000
Post mix: ch0
0x11A ch2i0x0000000x126ch2i0x000000
0x11B ch3i0x0000000x127ch3i0x7FFFFF
0x11C ch0i0x000000
0x128delay0x000000 Delay
0x11D ch1i0x7FFFFF----
Post mix: ch1
0x11E ch2i0x000000----
0x11Fch3i0x000000----
Post mix: ch2
Post mix: ch3
Doc ID 15351 Rev 351/157
FFXSTA321
7 FFX
7.1 Functional description
Figure 29. FFX processing schematic
up
dw
PWM
generator
pwma
pwm
b
384/768 kHz
1 bits
d
in
96 kHz
24 bits
16x
oversampling
stage
1536 kHz
24 bits
dw
Intersector
up
3rd, 4th, 5th -order
up
dw
noise
shaper
384/768 kHz
8/7 bits
The FFX modulator is a digital low-distortion low-noise PCM-to-PWM converter, based on a
pseudo-natural sampling technique, which converts the 4 by 24-bit digital inputs into
differential pulse-width modulated outputs at a frequency of either 384 or 768 kHz (selected
by register FFXCFG2, bit PWM_FREQ) and with a time resolution of 98.304 MHz. This
gives a dynamic range that is approaching 100 dB.
The signal is compared with two different carrier signals (rising and falling sawtooth
waveforms at the PWM frequency), to get a double edge modulation and to have the
possibility to drive a differential (full bridge) power stage.
The order of the noise shaper can be modified by the user, via register bit
FFXCFG2.NS_ORD, depending on the acceptable amount of noise out of the audio band,
that is, noise above 20 kHz. The higher the noise shaper order, the better is the SNR but the
higher is the out of band noise.
The PWM generator block converts the amplitude quantization into time quantization to
generate a PWM signal.
7.2 Modulation schemes
It is possible to use each of the two intersections with up-carrier and down-carrier to force a
rising or a falling edge on each of the two PWM outputs (A and B). This flexibility is achieved
through programming registers PWMOnCFG1-2 (where n is the number, 1 to 4, of the
output) beginning on page 91.
PWM output A can be modulated in one of, or a hybrid of, two basic ways via bits PM_nA:
zwith the wave starting from level 0 at the beginning of the period, and rising to level 1
when the audio signal intersects the down-carrier
zwith the wave starting from level 1 at the beginning of the period, and falling to level 0
52/157 Doc ID 15351 Rev 3
when the audio signal intersects the up-carrier;
STA321FFX
PWM output B can be similarly modulated via bits PM_nB:
zwith the wave starting from level 1 at the beginning of the period, and falling to level 0
when the audio signal intersects the down-carrier;
zwith the wave starting from level 0 at the beginning of the period, and rising to level 1
when the audio signal intersects the up-carrier;
The hybrid mode is the toggling between the two methods of modulation for each PWM
period.
Figure 30. PWM modes for outputs A and B
up
00: dn -> rising
up
dn
dn
PWM mode
for output A
01: up -> falling
10: hybrid 1
11: hybrid 2
00: dn -> falling
PWM mode
for output B
01: up -> rising
10: hybrid 1
11: hybrid 2
The various single output modulation schemes can be combined together on the two
outputs to get the desired differential modulation schemes.
Doc ID 15351 Rev 353/157
FFXSTA321
In particular, for the traditional schemes (binary, phase shift), and the new one (new phase
shift modulation) the mode bits must be set according to Ta ble 2 3 below.
Table 23.Modulation type with register programming
Register bit
PWMOnCFG1.PM_nA
Register bit
PWMOnCFG2.PM_nB
Resulting modulation
0000
binary
0101
1010
phase shift
1111
0001
new phase shift
0100
Figure 31. Modulation waveforms corresponding to Tabl e 23
PWM mode
A: 01
B: 01
Binary
A - B
A: 10
B: 10
A: 00
B: 01
Phase shift
New phase
shift
A-B
54/157 Doc ID 15351 Rev 3
STA321FFX
7.3 PWM shift feature
In new phase shift modulation it is possible to shift one output with respect to the other one.
This can reduce the noise generated by the simultaneous switching of two or more outputs.
The shift is performed through by programming bits PS_nA and PS_nB in registers
PWMOnCFG1-2 (where n is the number, 1 to 4, of the output) beginning on page 91.
Figure 32. New phase shift modulation with shift feature
dnup
’
up
without
shift
with
shift
A
B
A-B
A
B
A-B
Doc ID 15351 Rev 355/157
FFXSTA321
7.4 Ternary mode
The ternary mode feature is also available. It is activated by bits TERNARY_n in registers
PWMOnCFG0 beginning on page 91 (where n is the number, 1 to 4, of the output).
This feature overrides the PWM mode bits settings PM_nA and PM_nB.
Figure 33. Ternary modulation
PWM mode
A: 10
TERNARY_n
= 0
B: 10
A: 00
B: 01
A: 10
B: 10
TERNARY_n
= 1
A: 00
B: 01
7.5 Minimum pulse limitation
The FFX modulator has a minimum pulse limitation feature which has a double purpose:
zto limit the maximum/minimum duty cycle when the audio signal is near to full scale;
zto have the commutations on the same channel outputs A and B separated by a
minimum pulse distance.
The first feature is always enabled.
The second feature is enabled with register bit PWMOnCFG0.MP_ZERO_n, where n is the
output 1 to 4. It is possible to prevent the commutations on outputs A and B to happen
exactly at the same time using bit AZPLS_n. The minimum pulse size is determined by the
number of system clock (98.304 MHz) periods programmed in bits MIN_PLS_n[3:0].
Phase
shift
New
phase
shift
Ternary
56/157 Doc ID 15351 Rev 3
STA321FFX
7.6 Headphone modulation
The FFX modulator can be used for driving a headphone load with the common terminal
available, together with left and right terminals.
In this case it is possible to drive the common terminal with a 50% fixed duty cycle square
wave coming from output B of the modulator, by setting bit HALFB_n to 1, and the left and
right terminals from the output A of two different channels. For the three outputs used in this
way bits PM_nA and PM_nB can be 00 or 01.
Figure 34. Modulation for headphones
Left
Common
Right
Output 0A
Output 0B
Output 1A
Left
Common
Right
Doc ID 15351 Rev 357/157
FFXSTA321
7.7 pfStart™ operation
In order to avoid pop noise the bypass capacitor, situated between the filtered amplifier
output and the load in single-ended applications, needs to be pre-charged to half of the
power supply voltage. This is usually done by connecting a resistive partition to the output
and then disconnecting it at the end of the charging phase (see the analog pop free
description in section 9).
In the STA321 the FFX digital pop-free feature allows the digital pre-charging of the bypass
capacitor using the amplifier instead of a resistive partition. This active pre-charge is also
faster than the resistive partition method. The digital pop-free function can be independently
set on both power stages, that is, the CMOS bridge stage using bit CB_PFDIG and the
embedded amplifier stage using bit EA_PFDIG in register FFXCFG2 on page 83.
Registers CB_PFRAMP1-6 beginning on page 97 and EA_PFRAMP1-6 beginning on page
99 control the charging function. The register usage is given in the following description.
The capacitor is charged from zero to half the supply voltage with the PWM signal. By
applying a suitable ramp to the input of the modulator the PWM signal begins from near 0%
duty cycle to 50% duty cycle.
The method is based on a slow ramp signal (from ground to V
/ 2), implemented using
CC
both pulse density modulation (PDM) and pulse width modulation (PWM). At the beginning
of the ramp PDM is used starting from an initial value set by bits CBRMPINI and EARMPINI,
and then switching to PWM when reaching a threshold value set by bits CBRMPTH and
EARMPTH.
The total ramp time can be modified via bits EATIM_RMP and CBTIM_RMP.
Figure 35. Digital pop-free ramp implementation
0000 …000
Ramp
value
Output
RAMP_THOLD
RAMP_INIT
1000 …000
0
PDM
PWM
The PDM is realized with a noise shaper circuit, where the sampling time (Td) of the noise
shaper is equal to the minimum pulse size set by bits CBRMP_MP and EARMP_MP.
58/157 Doc ID 15351 Rev 3
STA321FFX
7.8 PWM00 output
Pin PWM00 is an additional output with a maximum driving capability of 2 mA to control an
external bridge or external operational amplifier.
By default, PWM00 is tied to logical 0. When register bit CKOCFG[0] is set to 1 then any
FFX PWM channel output can be mapped to it.
When the CMOS bridge is in standby the output PWM00 is, by default, turned off. However,
it is possible to have the FFX signal PWM3A as the PWM00 output by using bit 3 of register
FFXCFG0 on page 82, and this whatever the status of power-down or the 3-state signals of
both bridges, even if they are different from the normal operating mode where the output is 0
when in power-down or 3-state mode.
Doc ID 15351 Rev 359/157
CMOS power stageSTA321
8 CMOS power stage
The CMOS half-bridge circuit of Figure 36 is a single channel analog output power stage.
There are three such output stages in the STA321, one for each of the outputs OUT1-3.
The switching mode is regulated by the logic circuit which ensures that the MOSFETs are
switched in such a way as to avoid (or minimize) conditions where both the PMOS and the
NMOS are conducting at the same time.
The input is a 1.8-V to 3.3-V level shifter followed by some combinational logic.
Figure 36. CMOS half bridge block diagram
VDDVCC33VCCx
FaultN
OutN
FFX-ch N
Powerdown
Tristate
PopFree
Table 24.CMOS bridge signal descriptions
Level
shifter
GNDx
GND33GND
Enable
logic
Logic
GND33
Vcc33
Driver P
Driver N
Fault
Pop-free
Power
Pin NameDirectionDescription
FFX-chInDigital audio signal coming from FFX block
PowerdownInPowerdown signal coming from the FFX block
TristateIn3-state signal from the FFX block
PopFreeInPop-free signal from the FFX block
FaultOutShort-circuit fault output feedback signal to digital core (active low)
OutOutChannel half-bridge analog output
VCC33/GND33SupplyPre-driver analog supply
VDD/GNDSupplyDigital core supply generated by internal regulator
VCCx/GNDxSupplyHalf-bridge power supply
60/157 Doc ID 15351 Rev 3
STA321CMOS power stage
The CMOS bridge power rating can be calculated using the following formulas:
P (<1%) = (R
P (<1%) = (R
/ 2) * (M * VCC / 2 / (RL + 2 * RDS))2 for BTL
L
/ 2) * (M * VCC / 2 / (RL + RDS))2 for single ended
L
P (10%) = 1.28 * P(<1%)
where R
is composed of the MOST R
DS
and the board and connector parasitic
DSON
resistances (including power supplies and coils) and M is the modulation index obtained
from
M = 1 - 2 * (MIN_PLS_n + 1) / f
where MIN_PLS_n is the value in register PWMOnCFG0 for channel n, f
frequency of the FFX clock and τ
is the PWM clock period (384 kHz or 768 kHz selected by
S
clk_ffx
/ τ
S
is the
clk_ffx
register bit FFXCFG2.PWM_FREQ).
For the CMOS bridge, MIN_PLS_n can be set to 0; this gives M = 0.9922.
Table 25.Power output (at 1% THD) in headphone mode
Load, RL in ΩPower, P in mW (for 3.3-V supply)
1670
3232
The analog pop_free function is available in the CMOS bridge circuit by setting the
appropriate bridge start-up as per Ta bl e 2 6 . The CMOS bridge enable and pop-free signals
are generated from the three signals Powerdown, Tristate and PopFree provided by the
digital core and controlled/configured through register bits FFXCFG1.CB_STBY,
FFXCFG1.CB_TRISTn and PFEFAULT.PFEn for the three outputs, n = 1 to 3.
Figure 37. Analog pop-free schematic
VCCx
OutN
PFE & not(Tristate) & Powerdown
GNDx
Doc ID 15351 Rev 361/157
CMOS power stageSTA321
Table 26.Logic circuit at bridge input
PowerdownTristatePopFreePop-free resistorsBridge status
000Disconnected3-state
001Disconnected3-state
101Connected 3-state
111DisconnectedOn
110DisconnectedOn
At the appropriate time the two pop-free resistors allow the bypass capacitor to be charged
to V
/ 2. The STA321 generates automatically the bridge start-up and switch-off
CCx
sequence to provide the correct charging. The time TT in Figure 38 below is set using
registers CBTTF0-1 and CBTTP0-1. TT must be chosen for the specific application
depending on the decoupling capacitor, load and power supply.
After powerdown is applied again the decoupling capacitor discharges slowly due to
capacitor leakage.
The analog pop-free implementation cannot be used with the digital pfStart implementation
Both analog and digital pop-free features must be disabled if binary headphone modulation
is used.
Figure 38. Analog pop-free start-up and switch-off sequence
Powerdown
PFE
TT
TT
Tristate
V(capacitor)
Vcc / 2
The CMOS bridge circuit includes over-current protection. The FAULT signal indicates to the
output the status of the over-current condition due to a short circuit. The over-current
thresholds detected by the CMOS bridge are fixed at 1.8 A.
62/157 Doc ID 15351 Rev 3
STA321Fault detection and recovery
9 Fault detection and recovery
9.1 External amplifier
When Fault is reported on pin EAFTN and bit EA_TSFT_ON of register FFXCFG2 on
page 83 is active, then pin EATSN is reset to 0 and the embedded bridge outputs are put in
the high-impedance state. When the fault signal disappears (that is, goes to 1) the
embedded bridge is kept in 3-state for a time defined in register EATTF0-1 on page 86, after
which time the outputs recover.
9.2 CMOS bridge
When Fault is reported to the digital core and CB_TSFT_ON of register FFXCFG2 on
page 83 is active then the tristate is activated thus putting the STA321 OUTn outputs in the
high-impedance state. When the fault signal disappears, the CMOS bridge is kept in 3-state
status for a time defined in register CBTTF0-1 on page 88, after which time the outputs
recover.
Doc ID 15351 Rev 363/157
ADCSTA321
10 ADC
10.1 Description
The STA321 analog input is provided through a low-power, low-voltage complete low-cost
analog-to-digital converter front end designed for stereo audio applications. It includes
programmable gain amplifier, anti-aliasing filter, low-noise microphone biasing circuit, a third
order MASH2-1 delta-sigma modulator, a digital decimating filter and a 1st-order
DC-removal filter.
The ADC works with either a microphone input or a line input, selected using bit
ADC_INSEL in register ADCCFG0 on page 133.
A programmable gain amplifier (PGA) is available in microphone-in mode giving the
possibility to amplify the signal from 0 to 42 dB in steps of 6 dB using register bit
ADCCFG0.ADC_PGA.
The ADC specifications are given in Table 6 on page 14.
Figure 39. ADC front-end block diagram
INL 1
INL 2
INR 2
INR 1
00
10
10
00
ADCCFG1[7:6]
PGA
PGA
1
0
ADCINSEL[4]
0
1
ADC left
ADC right
16 bits
16 bits
64/157 Doc ID 15351 Rev 3
STA321ADC
10.2 Application schematic
Figure 40. Typical connections for power supplies and inputs
10.2.1 Configuration example
This is an example of the register setup for the ADC inputs. It is assumed that every
peripheral is already configured and working correctly.
There are other configuration examples to help you get started please refer to other
chapters and also to Chapter 14: Register description on page 77 in order to get all the
necessary and complementary details.
Ta bl e 2 7 shows the register settings for selecting INL2 and INR2 as input source for SRC
and SAI_out1 and using the PGA with a 12-dB gain.
Table 27.Example register settings for ADC
RegisterValueDescription
ADCCFG10x40Selecting INL2 and INR2 as sources
ADCCFG00x52PGA Gain = +12 dB, PGA enabled, ADC clock on
P2SDATA0x40ADC Data routed also to the SAI_out
Doc ID 15351 Rev 365/157
Serial audio interfaceSTA321
11 Serial audio interface
The data on pins SDATAI, SDATAO, LRCLKI and LRCLKO are always synchronous with the
bit clock. The data on these pins changes with the BICLK active (or clocking) edge.
The BICLK strobe edge latches the data SDATAI, SDATAO, LRCLKI, LRCLKO; thus this
data should be stable near the BICLK strobe edges. The slave device uses the strobe edges
to latch the serial data internally.
The active and strobe edges can be selected to be the rising edge or the falling edge by
appropriately programming register bits SAI_IN1_CFG0[7], SAI_OUT_CFG0[7] and
SAI_IN2_CFG0[7].
The serial-to-parallel interface and the parallel-to-serial interface can have different
sampling rates. Figure 41 shows a typical setup.
Figure 41. SAI typical sampling rates
Fs = CLK / 1024
SAI_in
Fs = 8 - 192 kHzFs = CLK / 1024
Sample rate
converter
96 kHz
Processing
Fs = CLK / 1024
96 kHz
SAI_out
or
Fs = CLK / 2048
96 kHz or
48 kHz
11.1 Master mode
In this mode BICLKI/BICLKO and LRCLKI/LRCLKO are configured as outputs and are
generated by the core.
Figure 42. Timing diagram for master mode
Biclki/Biclko
BICLKI
BICLKO
LRCLKI
LRCLKO
SDATAO
SDATAI
CLK98 MHz
PLL
t
DST
t
DHT
t
t
DDA
DL
66/157 Doc ID 15351 Rev 3
STA321Serial audio interface
Table 28.Timing parameters for master mode
SymbolParameterMinTypMaxUnit
t
DL
t
DDA
t
DST
t
DHT
LRCLKI/LRCLKO propagation delay from BICLK active
edge
SDATAI propagation delay from BICLKI/O active edge0-15ns
SDATAO setup time to BICLKI/O strobing edge10--ns
SDATAO hold time from BICLKI/O strobing edge10--ns
11.2 Slave mode
In this mode BICLKI/O and LRCLKI/O are configured as inputs and supplied by the external
peripheral.
Figure 43. Timing diagram for slave mode
BICLKI
BICLKO
LRCLKI
LRCLKO
SDATAO
t
BCH
t
BCy
t
t
BCL
DS
t
LRH
t
LRSU
0-10ns
t
DH
SDATAI
t
DD
Table 29.Timing parameters for slave mode
Symbol ParameterMinTypMaxUnit
t
BCy
t
BCH
t
BCL
t
LRSU
t
LRH
t
DS
t
t
DH
DD
BICLK cycle time50--ns
BICLK pulse width high20--ns
BICLK pulse width low20--ns
LRCLKI/LRCLKO setup time to BICLK strobing edge10--ns
LRCLKI/LRCLKO hold time to BICLK strobing edge10--ns
SDATAO setup time to BICLK strobing edge10--ns
SDATAO hold time to BICLK strobing edge10--ns
SDATAI propagation delay from BICLK active edge0-10ns
Doc ID 15351 Rev 367/157
Serial audio interfaceSTA321
11.3 Serial formats
Different audio formats are supported in both master and slave modes. Clock and data
configurations can be customized to match most of the serial audio protocols available on
the market.
Data length can be customized for 8, 16, 24 or 32 bits.
11.3.1 Right justified
Figure 44. Right justified serial format
LRCLKI
LRCLKO
BICLKI
BICLKO
SDATAO
SDATAI
11.3.2 Left justified
Figure 45. Left justified serial format
LRCLKI
LRCLKO
BICLKI
BICLKO
SDATAO
SDATAI
68/157 Doc ID 15351 Rev 3
STA321Serial audio interface
11.3.3 DSP
Figure 46. DSP serial format
LRCLKI
LRCLKO
BICLKI
BICLKO
Right
SDATAO
SDATAI
Left
11.3.4 I2S
Figure 47. I2S serial format
LRCLKI
LRCLKO
BICLKI
BICLKO
SDATAO
SDATAI
3nn
11.3.5 PCM/IF (non-delayed mode)
zMSB first
z16-bit data.
Figure 48. PCM (non-delayed) serial format
Any width
LRCLKI
LRCLKI
LRCLK
LRCLKO
BICLKI BICLKO
BICLKI
BICLKO
-1
1 2 3n n
-1
SDATAO
SDATAI
1 2 3nn
-1
SDATAO/SDATAI
Doc ID 15351 Rev 369/157
Serial audio interfaceSTA321
11.3.6 PCM/IF (delayed mode)
zMSB first
z16-bit data.
Figure 49. PCM (delayed) serial format
LRclki/
LRCLKI
LRclko
LRCLKO
BIclki/ BIclko
BICLKI
BICLKO
SDATAO/SDATAI
SDATAO
SDATAI
1 2 3nn
-1
70/157 Doc ID 15351 Rev 3
STA321Serial audio interface
11.4 Invalid detection
STA321 has an invalid input detection feature that can detect an invalid serial interface bit
clock or frame clock and then mute the processing channels to avoid any speaker or
headphone damage and, moreover, to avoid loud audible transients which may be
discomforting to the listener. The control is active only for the SAI input. The configuration
programmed in bits 0, 1 and 2 of register FFXCFG0 on page 82 is applicable to both SAI1
and SAI2 whilst the checks are independent for each interface. The mute on the processing
channel is asserted depending on the input interface mapping.
Figure 50 shows the invalid detection schematic. Here, two different checks are available.
The first one is enabled by register bit FFXCFG0.BAD_CKS_M and evaluates the ratio of
BICLK and LRCLK. The resulting number must be the same as that written in bits
S2Pn_BOS (for example, 32 * f
SAI_IN2_CFG1, otherwise the channels are muted.
The second check is enabled by register bit FFXCFG0.MIS_BICK_M and is related to the
presence of BICLK. Basically, a 8-bit watchdog counter decrements, starting from 0xFF, with
each edge of clk_proc. The counter is reset to 0xFF at each BICLK edge; so, if the
watchdog counter ever reaches 0x00, a missing bit clock error is signalled and the mute
command is issued.
Figure 50. Invalid input detection schematic
or 64 * fS) in registers SAI_IN1_CFG1 on page 123 and
S
00
mute ch0
clk_proc
Is
alive?
BICLKI1
LRCLKI1
LRCLKI2
BICLKI2
Ratio
calculator
Ratio
calculator
Is
alive?
MIS_BICK_M
=
BAD_CKS_M
S2P1_BOS
S2P2_BOS
BAD_CKS_M
=
MIS_BICK_M
clk_proc
MUTE0
OR
MUTE1
MUTE0
MUTE1
MUTE2
MUTE3
MUTE2
OR
MUTE3
01
1x
SRC1_INSEL
00
mute ch1
01
1x
00
mute ch2
01
1x
SRC2_INSEL
00
mute ch3
01
1x
Doc ID 15351 Rev 371/157
Headphone detectionSTA321
12 Headphone detection
The headphone detector circuit, shown in Figure 51, is made with two schmitt-trigger
comparators (with different thresholds) which sense the value of the HPDECT input voltage
and modifies the HP_DET1 or the HP_DET2 level as given in Ta bl e 3 0 and Table 3 1 below.
The comparators are enabled or disabled with bits E_HP1 and E_HP2 in register HPDET2
on page 138
Table 30.Headphone 1 detector
E_HP1
(register HPDET2)
HP-jack statusHP_DET voltageHP_DET1
Status register bit
HPDST.HP_DET_FILT
1UnpluggedLow0-
1PluggedHigh1-
0XX1-
Table 31.Headphone 2 detector
E_HP2
(register HPDET2)
HP-jack statusHP_DET voltageHP_DET2
Status register bit
HPDST.HP_DET_FILT
1UnpluggedLow1-
1PluggedHigh0-
0XX1-
The comparator output status is provided via bits 1 and 0 of register HPDET2 on page 138.
One of the comparator outputs is then selected with register bit HPDET1.HPD_SEL, and
that signal is passed through a digital debouncing filter and supplied to the FFX modulator.
The PWM outputs are then modified depending on the settings of register bits
HPDST.HP_DET_FILT and HPDET1.HPD_ACT_MODE.
72/157 Doc ID 15351 Rev 3
STA321Headphone detection
12.1 Applications circuits
Two applications circuits are given here, one for the binary single-ended application and one
for the binary headphone application.
Figure 51. Headphone detection circuit for single-ended configuration
VCC33
VCC33
100 k
TUD_EN
HP_DET1
HP_DET2
Filter
I2C
HP_DET_FILT
CMOS
bridge
HP_DET
L1
L2
5 k
1 k
1 k
EAPWM
FFX
modulator
out
Figure 52. Headphone detection circuit for binary HP configuration
VCC33
VCC33
100 k
TUD_EN
HP_DET1
HP_DET2
HP_DET
L1
I2C
5 k
1 k
L2
hp_det_filt
Filter
CMOS
bridge
EAPWM
FFX
modulator
out
L3
1 k
1 k
Doc ID 15351 Rev 373/157
Headphone detectionSTA321
12.2 Configuration example
This is an example of the register setup for headphones detection. It is assumed that every
peripheral is already configured and working correctly.
There are other configuration examples to help you get started please refer to other
chapters and also to Chapter 14: Register description on page 77 in order to get all the
necessary and complementary details.
Ta bl e 3 2 and Tabl e 3 3 below give a possible setup for the headphones detection
configurations shown in Figure 51 and Figure 52, respectively.
Table 32.Headphone detection configuration sequence for binary SE
RegisterValueDescription
MISC on page 135
0x21Enable core clock
PLLB on page 1360x00Use PLL clock
User FFX and CMOS bridge configuration
HPDET2 on page 1380x80Disable the HP_DET pull-up
HPDET1 on page 1370x57
Use HP1 for hpdet filter; polarity = high; action =
mute; mod = binary SE; average time 170 ms.
HPDET2 on page 1380x80 Select E_HP1 comparator
FFXCFG1 on page 810x00Remove the tristate from the bridges
Table 33.Headphone detection configuration sequence for binary headphone
Register ValueDescription
MISC on page 135
0x21Enable core clock
PLLB on page 1360x00Use PLL clock
User FFX and CMOS bridge configuration
HPDET2 on page 1380x80Disable the HP_DET pull-up
HPDET1 on page 1370x5F
Use HP1 for hpdet filter; polarity = high; action =
mute; mod = binary HP; average time 170 ms.
HPDET2 on page 1380x80 Select E_HP1 comparator
FFXCFG1 on page 810x00Remove the tristate from the bridges
Note:The pullup on HPDET pad must always be disabled before using the HPDET function.
Note:Comparator 1 and comparator 2 cannot be enabled simultaneously.
74/157 Doc ID 15351 Rev 3
STA321I2C interface
13 I2C interface
13.1 Communication protocol
13.1.1 Data transition and change
Data changes on the SDA line must only occur when the SCL clock is low. SDA transition
while the clock is high is used to identify a START or STOP condition.
13.1.2 Start condition
START is identified by a high to low transition of the SDA bus while the clock signal, SCL, is
stable in the high state. A START condition must precede any command for data transfer.
13.1.3 Stop condition
STOP is identified by a low to high transition on the SDA bus while the clock signal, SCL, is
stable in the high state. A STOP condition terminates communication between STA321 and
the bus master.
13.1.4 Data input
During the data input the STA321 samples the SDA signal on the rising edge of clock SCL.
For correct device operation the SDA signal must be stable during the rising edge of the
clock and the data can change only when the SCL line is low.
13.1.5 Device addressing
To start communication between the master and the STA321, the master initiates with a
start condition. Following this, the master sends 8 bits (MSB first) on the SDA line which
corresponds to the device select address and read or write mode.
The 7 MSBs are the device address identifiers, corresponding to the I
the STA321 the I
2
C interface has the device address 0x30.
After a START condition the STA321 identifies the device address and if a match is found,
acknowledges the identification on SDA bus during the 9th bit time. The byte following the
device identification byte is the internal space address.
13.1.6 Write operation
Following the START condition the master sends a device select code with the RW bit set
to 0. After the STA321 acknowledge, the master sends the byte of internal address. On
receiving the internal byte address the STA321 responds with acknowledge.
Byte write
2
C bus definition. In
In the byte write mode the master sends one data byte, this is acknowledged by the
STA321. The master then terminates the transfer by generating a STOP condition.
Doc ID 15351 Rev 375/157
I2C interfaceSTA321
Multi-byte write
The multi-byte write mode starts from any internal address. The master generates a STOP
condition to terminate the transfer.
13.1.7 Read operation
Current address byte read
Following the START condition the master sends a device select code with the RW bit set
to 1. The STA321 acknowledges and then responds by sending one byte of data. The
master then terminates the transfer by generating a STOP condition.
Current address multi-byte read
The multi-byte read mode start from any internal address. Data bytes are read from
sequential addresses within the STA321. The master acknowledges each data byte read
and then generates a STOP condition to terminate the transfer.
Random address byte read
Following the START condition the master sends a device select code with the RW bit set
to 0. The STA321 acknowledges and then the master writes the internal address byte. After
receiving, the internal byte address the STA321 again responds with an acknowledge. The
master then initiates another START condition and sends the device select code with the
RW bit set to 1. The STA321 acknowledges this and then responds by sending one byte of
data. The master then terminates the transfer by generating a STOP condition.
Random address multi-byte read
The multi-byte read modes start from any internal address. Data bytes are read from
sequential addresses within the STA321. The master acknowledges each data byte read
and then generates a STOP condition to terminate the transfer.
00: parked
11: ready
10: going to park
01: going to ready
[3:2] CBRMP_ST[1:0]: pop free ramp status
00: parked
11: ready
10: going to park
01: going to ready
[1] EABINSS_AC
1: ramp active (going to park or ready)
CBBINSS_AC
[0]
1: ramp active (going to park or ready)
CBTTP0
Doc ID 15351 Rev 389/157
Register descriptionSTA321
POWSTStatus register for external amplifier
76543210
ReservedEA_TWEA_PDEA_FTEA_TS
Address:0x0F
Type:RO
Reset:0x05
Description:
[7:4] Reserved
[3] EA_TW
1: EA thermal warning
[2] EA_PD
EA power-down
1:
[1] EA_FT
EA is in fault
1:
[0]
EA_TS
1: EA is in 3-state
POWST1 Status register for CMOS bridge
76543210
ReservedCB_PDCB_FT[2:0]CB_TS[2:0]
Address:0x10
Type:RO
Reset:0x47
Description:
[7] Reserved
[6] CB_PD
1: CMOS bridge
[5:3] CB_FT[2:0]
xx1: CMOS bridge channel 1 is in fault
x1x: CMOS bridge channel 2 is in fault
1xx: CMOS bridge channel 3 is in fault
[2:0] CB_TS[2:0]
xx1: CMOS bridge channel 1 is in 3-state
x1x: CMOS bridge channel 2 is in 3-state
1xx: CMOS bridge channel 3 is in 3-state
is in power-down
90/157 Doc ID 15351 Rev 3
STA321Register description
PWMO1CFG0
7 6 54 3210
AZPLS_1TERNARY_1HALFB_1MP_ZERO_1MIN_PLS_1[3:0]
Address:0x11
Type:RW
Reset:0x20
Description:
[7] AZPLS_1
1: avoid zero pulse
[6] TERNARY_1
1: ternary modulation
[5] HALFB_1
1: 1B is modulated as null signal
[4] MP_ZERO_1
1:
apply the minimum pulse settings also for values near 0
[3:0] MIN_PLS_1[3:0]
minimum pulse length = clock period * (MIN_PLS_1 + 1)
PWMO1CFG1
76543210
PM_1A[1:0]PS_1A[5:0]
Address:0x12
Type:RW
Reset:0x00
Description:Configuration for PWM-A
[7:6] PM_1A[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_1A[5:0]: PWM shift
The PWM waveform could be shifted by (PS_1A * clock period / 64)
Doc ID 15351 Rev 391/157
Register descriptionSTA321
PWMO1CFG2
76543210
PM_1B[1:0]PS_1B[5:0]
Address:0x13
Type:RW
Reset:0x48
Description:Configuration for PWM-B
[7:6] PM_1B[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: ibrid mode: alternation of modes 00 and 01
11: ibrid mode: alternation of modes 01 and 00
[5:0] PS_1B[5:0]: PWM shift
The PWM waveform could be shifted by (PS_1B * clock period / 64)
PWMO2CFG0
7 6 54 3210
AZPLS_2TERNARY_2HALFB_2MP_ZERO_2MIN_PLS_2[3:0]
Address:0x14
Type:RW
Reset:0x20
Description:
[7] AZPLS_2
1: avoid zero pulse
[6] TERNARY_2
1: ternary modulation
[5] HALFB_2
1: 2B is modulated as null signal
[4] MP_ZERO_2
1:
apply the minimum pulse settings also for values near 0
[3:0] MIN_PLS_2[3:0]
Minimum pulse length = clock period * (MIN_PLS_2 + 1)
92/157 Doc ID 15351 Rev 3
STA321Register description
PWMO2CFG1
76543210
PM_2A[1:0]PS_2A[5:0]
Address:0x15
Type:RW
Reset:0x10
Description:
[7:6] PM_2A[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_2A[5:0]: PWM shift
The PWM waveform could be shifted by (PS_2A * clock period / 64)
PWMO2CFG2
76543210
PM_2B[1:0]PS_2B[5:0]
Address:0x16
Type:RW
Reset:0x58
Description:
[7:6] PM_2B[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_2B[5:0]: PWM shift
The PWM waveform could be shifted by (PS_2B * clock period / 64)
Doc ID 15351 Rev 393/157
Register descriptionSTA321
PWMO3CFG0
7 6 54 3210
AZPLS_3TERNARY_3HALFB_3MP_ZERO_3MIN_PLS_3[3:0]
Address:0x17
Type:RW
Reset:0x00
Description:
[7] AZPLS_3
1: avoid zero pulse
[6] TERNARY_3
1: ternary modulation
[5] HALFB_3
1: 3B is modulated as null signal
[4] MP_ZERO_3
1:
apply the minimum pulse settings also for values near 0
[3:0] MIN_PLS_3[3:0]
Minimum pulse length = clock period * (MIN_PLS_3 + 1)
PWMO3CFG1
76543210
PM_3A[1:0]PS_3A[5:0]
Address:0x18
Type:RW
Reset:0x20
Description:
[7:6] PM_3A[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_3A[5:0]: PWM shift
The PWM waveform could be shifted by (PS_3A * clock period / 64)
94/157 Doc ID 15351 Rev 3
STA321Register description
PWMO3CFG2
76543210
PM_3B[1:0]PS_3B[5:0]
Address:0x19
Type:RW
Reset:0x68
Description:
[7:6] PM_3B[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_3B[5:0]: PWM shift
The PWM waveform could be shifted by (PS_3B * clock period / 64)
PWMO4CFG0
7 6 54 3210
AZPLS_4TERNARY_4HALFB_4MP_ZERO_4MIN_PLS_4[3:0]
Address:0x1A
Type:RW
Reset:0x00
Description:
[7] AZPLS_4
1: avoid zero pulse
[6] TERNARY_4
1: ternary modulation
[5] HALFB_4
1: 4B is modulated as null signal
[4] MP_ZERO_4
1:
apply the minimum pulse settings also for values near 0
[3:0] MIN_PLS_4[3:0]
Minimum pulse length = clock period * (MIN_PLS_4 + 1)
Doc ID 15351 Rev 395/157
Register descriptionSTA321
PWMO4CFG1
76543210
PM_4A[1:0]PS_4A[5:0]
Address:0x1B
Type:RW
Reset:0x30
Description:
[7:6] PM_4A[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_4A[5:0]: PWM shift
The PWM waveform could be shifted by (PS_4A * clock period / 64)
PWMO4CFG2
76543210
PM_4B[1:0]PS_4B[5:0]
Address:0x1C
Type:RW
Reset:0x78
Description:
[7:6] PM_4B[1:0]: PWM mode
00: generate a rising edge using a down carrier
01: generate a falling edge using an up carrier
10: hybrid mode: alternation of modes 00 and 01
11: hybrid mode: alternation of modes 01 and 00
[5:0] PS_4B[5:0]: PWM shift
The PWM waveform could be shifted by (PS_4B * clock period / 64)
96/157 Doc ID 15351 Rev 3
STA321Register description
CB_PFRAMP1
76543210
CBRMP_MP[5:0]Reserved
Address:0x20
Type:RW
Reset:0x14
Description:
[7:2] CBRMP_MP[5:0]
Minimum pulse width of the PDM signal
[1:0] Reserved
CB_PFRAMP2
76543210
CBRMPINI[15:8]
Address:0x21
Type:RW
Reset:0x80
Description:Initial value of the ramp signal
[7:0] CBRMPINI[15:8]
MSBs of CB ramp init
CB_PFRAMP3
76543210
CBRMPINI[7:0]
Address:0x22
Type:RW
Reset:0x3C
Description:
[7:0] CBRMPINI[7:0]
LSBs of CB ramp init
Doc ID 15351 Rev 397/157
Register descriptionSTA321
CB_PFRAMP4
76543210
CBTIM_RMP[3:0]Reserved
Address:0x23
Type:RW
Reset:0x10
Description:
[7:4] CBTIM_RMP[3:0]
EA timing duration of the ramp (= slope)
[3:0] Reserved
CB_PFRAMP5
76543210
CBRMPTH[15:8]
Address:0x24
Type:RW
Reset:0x14
Description:During the ramp, if the signal is below the threshold, the signal is modulated with
PDM, otherwise with PWM
[7:0] CBRMPTH[15:8]
MSBs of CB ramp threshold
CB_PFRAMP6
76543210
CBRMPTH[7:0]
Address:0x25
Type:RW
Reset:0x00
Description:During the ramp, if the signal is below the threshold, the signal is modulated with
PDM, otherwise with PWM
[7:0] CBRMPTH[7:0]
LSBs of CB ramp threshold
98/157 Doc ID 15351 Rev 3
STA321Register description
EA_PFRAMP1
76543210
EARMP_MP[5:0]Reserved
Address:0x26
Type:RW
Reset:0x1C
Description:
[7:2] EARMP_MP[5:0]
Minimum pulse width of the PDM signal
[1:0] Reserved
EA_PFRAMP2
76543210
EARMPINI[15:8]
Address:0x27
Type:RW
Reset:0x80
Description:Initial value of the ramp signal
[7:0] EARMPINI[15:8]
MSBs of EA ramp init
EA_PFRAMP3
76543210
EARMPINI[7:0]
Address:0x28
Type:RW
Reset:0x60
Description:
[7:0] EARMPINI[7:0]
LSBs of EA ramp init
Doc ID 15351 Rev 399/157
Register descriptionSTA321
EA_PFRAMP4
76543210
EATIM_RMP[3:0]Reserved
Address:0x29
Type:RW
Reset:0x10
Description:
[7:4] EATIM_RMP[3:0]
EA timing duration of the ramp (= slope)
[3:0] Reserved
EA_PFRAMP5
76543210
EARMPTH[15:8]
Address:0x2A
Type:RW
Reset:0x80
Description:During the ramp, if the signal is below the threshold, the signal is modulated with
PDM, otherwise with PWM
[7:0] EARMPTH[15:8]
MSBs of EA ramp threshold
EA_PFRAMP6
76543210
EARMPTH[7:0]
Address:0x2B
Type:RW
Reset:0x60
Description:During the ramp, if the signal is below the threshold, the signal is modulated with
PDM, otherwise with PWM
[7:0] EARMPTH[7:0]
LSBs of EA ramp threshold
100/157 Doc ID 15351 Rev 3
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.