Serial audio interface (SAI)
RM0090
922/1731
DocID018909 Rev 11
mode definition. In AC’97 protocol, it will be an SAI output even if the SAI (link controller) is
set-up to consume the SCK clock (and so to be in Slave mode).
29.4 Main
SAI
modes
Each audio sub-block of the SAI can be configured to be master or slave via bit MODE[0] in
the SAI_xCR1 register of the selected audio block.
In master mode:
•
The bit clock is generated by the SAI using the clock generator on pin SCK_A or
SCK_B (depending which audio block is declared as a master in the SAI).
•
The dedicated pin SCK_x is considered as an output.
In slave mode:
•
The slave must be enabled before the master is enabled.
•
The slave audio block’s SCK clock I/O pin is considered input if it is configured in
asynchronous mode.
•
If the audio block is declared synchronous
with the second audio block in the SAI, its
SCK I/O pin is released to leave it free to be used as a general purpose I/O and is
connected internally to the SCK pin of the device with which it will be synchronized.
Each audio sub-block can be independently defined as a transmitter or receiver by bit
MODE[1] in the SAI_xCR1 register of the relevant audio block. The I/O pin SD will be
defined respectively as an output or an input.
It is possible to declare two master audio blocks in the same SAI with two different MCLK
and SCK clock frequencies (they have to be declared asynchronous).
Each of the audio blocks in the SAI are enabled by bit SAIxEN in the SAI_xCR1 register. As
soon as this bit is active, the transmitter or the receiver is sensitive to the activity on the
clock line, data line and synchronization line in slave mode.
In master TX mode, enabling the audio block immediately generates the bit clock for the
external slaves even if there is no data in the FIFO, However FS signal generation is
conditioned by the presence of data in the FIFO. After the FIFO receives the first data to
transmit, this data is output to external slaves. If there is no data to transmit in the FIFO, 0
values are then sent in the audio frame with an underrun flag generation.
In slave mode, the audio frame starts when the audio block is enabled and when a start of
frame is detected.
In Slave TX mode, no underrun event is possible on the first frame after the audio block is
enabled, because the mandatory operating sequence in this case is:
1.
Write into the SAI_xDR (by software or by DMA).
2. Wait until the FIFO threshold
(
FLH
) flag is different from 000b (FIFO empty).
3. Enable the audio block in slave transmitter mode.