4 sai state machine, Sai state machine -25 – Motorola DSP56012 User Manual
Page 203
Serial Audio Interface
Programming Considerations
MOTOROLA
DSP56012 User’s Manual
6-25
When operating in the Master mode, the following initialization procedure is
recommended:
1. Write the left data words to the transmit data registers.
2. Enable the operation of the SAI receivers while ensuring that RXIE = 1 (RCS
register).
3. Enable the operation of the SAI transmitters while ensuring that TXIE = 0 (TCS
register). Enabling the transmitters will transfer the left data words from the
transmit data registers to the shift registers.
4. Poll the TRDE status bit in the TCS register to detect when it is possible to load
the right data words into the transmit data registers. Write the right data
words to the transmit data registers when TRDE is set.
5. From now on, the receive interrupts should be used to service both the
transmitters and receivers. When the left channel receive interrupt is
generated, the interrupt service routine should write the left data words to the
transmitters and read the received left data words from the receivers (repeat
this methodology for the right channel receivers/transmitters).
6.4.4
SAI State Machine
When the SAI operates in the Slave mode and the bit clock and word select inputs
change unexpectedly, irregular or unexpected operation might result. In particular,
this can happen when SCKR (SCKT) runs freely and WSR/WST transitions occur
earlier or later than expected (in terms of complete bit clock cycles). In order to
explore the SAI reaction in such irregular conditions, the operation of the SAI state
machine is described here. After completion of a data word transfer (or upon exiting
the individual reset state) the SAI searches for the particular WSR/WST transition
with regard to the left/right orientation of the next expected word. For example, after
completion of a right data word transfer or upon exiting the individual reset state,
the SAI searches for a WSR/WST transition, which determines the start of a left data
word transfer. Similarly, after completion of a left data word transfer, the SAI
searches for a WSR/WST transition, which determines the start of a right data word
transfer. As soon as the correct transition is detected the SAI begins to shift the data
in (receive) or out (transmit) one shift per bit-clock cycle. A data word transfer is
complete when the number of the incoming bit clocks in SCKR (SCKT) since the
detection of the correct WSR/WST transition reaches the value of the
pre-programmed data word length. During a data word transfer (i.e., before
completion), all transitions in WSR/WST are ignored. After completion of a data
word transfer the SAI stops shifting data in and out until the next correct WSR/WST
transition is detected.